Run a command with different args everytime in Ansible playbook

11 views
Skip to first unread message

Xenia Ioannidou

unread,
Apr 27, 2020, 8:58:00 AM4/27/20
to Ansible Project
I am trying to run a command in Ansible so as to find the neighbors in my network:

- name: Get neighbors
  junos_rpc:
    rpc: "get-lldp-interface-neighbors"
    output: 'xml'
    args:
      interface_device: A
  register: net_topology
I have tried to loop over the args like this:
- name: Get neighbors
  junos_rpc:
    rpc: "get-lldp-interface-neighbors"
    output: 'xml'
    args:
      interface_device: "{{ item }}"
  loop:
    - A
    - B
    - C
  register: net_topology
But this is not working, because in this way the "A" is not recognised and i am getting an error like this: 
{"ansible_loop_var": "item", "changed": false, "item": "A", "msg": "Unsupported parameters for (junos_rpc) module: junos_rpc Supported parameters include: args, attrs, host, output, password, port, provider, rpc, ssh_keyfile, timeout, transport, username"}

Reply all
Reply to author
Forward
0 new messages