I have tried with  name: "{{ item }}" still the same issue.

When i tried with this  with_items: "{{ip_addr.split(' ')}}"
giving space it is executing on first IP address.


On Friday, November 30, 2018 at 5:42:17 PM UTC+5:30, srinivas a wrote:
>
> I want to pass multiple switch IP's and single port number using 
> vars_prompt to perform the task on single port. I used with_items: 
> "{{ip_addr.split(',')}}". But when i am passing multiple IP the task is not 
> performing, when i try to pass single IP. The task performs successfully.
>
> - hosts: localhost
>   gather_facts: no
>   vars_prompt:
>   - name: ip_addr
>     prompt: Please enter the switch name
>     private: no
>   - name: port_name
>     prompt: Please enter the port name
>     private: no
>
>   vars_files:
>     - ../vars/password.yml
>
>   vars:
>     port_speed: "8"
>
>   tasks:
>   - add_host:
>       name: "{{ip_addr}}"
>       groups: dynamically_created_hosts
>     with_items: "{{ip_addr.split(',')}}" 
>   - name: Change port speed
>     port_speed_change:
>       switch_ip: "{{ip_addr}}"
>       user: "{{user}}"
>       password: "{{password}}"
>       checkmode: "{{ansible_check_mode}}"
>       name: "{{port_name}}"
>       speed: "{{port_speed}}"
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/9f3260a9-f547-40f3-ac19-e58f93990e3e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to