[ansible-project] Re: Ansible dynamic looping

2018-02-01 Thread Mạnh Hùng
Vào 07:01:51 UTC+7 Thứ Sáu, ngày 02 tháng 2 năm 2018, Andrew Morgan đã viết:
> Hello all,
> 
> I have a play I want to run wich deletes all hosts matching a certain 
> criteria:
> 
> 
> 
> tasks:
>   - name: Delete unavailable nodes
>     zabbix_host:
>      server_url: http://zabbix.aa.net/zabbix
>      login_user: Admin
>      login_password: aq!
>      host_groups: Discovered hosts
>      status: disabled
>      state: absent
>      host_name: "{{ item }}"
>     with_items:
>      - ip-10-1-*-*.us-west-2.compute.internal
>     
> 
> The above doesnt work, but if I list out the items
> with_items:
>      - ip-10-1-65-27.us-west-2.compute.internal
>      - ip-10-1-65-28.us-west-2.compute.internal
>      - ip-10-1-65-37.us-west-2.compute.internal
> 
> then it works, but I want it to be dynamic and find all ips matching      - 
> ip-10-1-*-*.us-west-2.compute.internal
> 
> any help please?



Vào 07:01:51 UTC+7 Thứ Sáu, ngày 02 tháng 2 năm 2018, Andrew Morgan đã viết:
> Hello all,
> 
> I have a play I want to run wich deletes all hosts matching a certain 
> criteria:
> 
> 
> 
> tasks:
>   - name: Delete unavailable nodes
>     zabbix_host:
>      server_url: http://zabbix.aa.net/zabbix
>      login_user: Admin
>      login_password: aq!
>      host_groups: Discovered hosts
>      status: disabled
>      state: absent
>      host_name: "{{ item }}"
>     with_items:
>      - ip-10-1-*-*.us-west-2.compute.internal
>     
> 
> The above doesnt work, but if I list out the items
> with_items:
>      - ip-10-1-65-27.us-west-2.compute.internal
>      - ip-10-1-65-28.us-west-2.compute.internal
>      - ip-10-1-65-37.us-west-2.compute.internal
> 
> then it works, but I want it to be dynamic and find all ips matching      - 
> ip-10-1-*-*.us-west-2.compute.internal
> 
> any help please?



Vào 07:01:51 UTC+7 Thứ Sáu, ngày 02 tháng 2 năm 2018, Andrew Morgan đã viết:
> Hello all,
> 
> I have a play I want to run wich deletes all hosts matching a certain 
> criteria:
> 
> 
> 
> tasks:
>   - name: Delete unavailable nodes
>     zabbix_host:
>      server_url: http://zabbix.aa.net/zabbix
>      login_user: Admin
>      login_password: aq!
>      host_groups: Discovered hosts
>      status: disabled
>      state: absent
>      host_name: "{{ item }}"
>     with_items:
>      - ip-10-1-*-*.us-west-2.compute.internal
>     
> 
> The above doesnt work, but if I list out the items
> with_items:
>      - ip-10-1-65-27.us-west-2.compute.internal
>      - ip-10-1-65-28.us-west-2.compute.internal
>      - ip-10-1-65-37.us-west-2.compute.internal
> 
> then it works, but I want it to be dynamic and find all ips matching      - 
> ip-10-1-*-*.us-west-2.compute.internal
> 
> any help please?

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/61deebdb-1531-4186-b997-f087ef6da350%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible dynamic looping

2018-02-01 Thread Mạnh Hùng
Vào 07:01:51 UTC+7 Thứ Sáu, ngày 02 tháng 2 năm 2018, Andrew Morgan đã viết:
> Hello all,
> 
> I have a play I want to run wich deletes all hosts matching a certain 
> criteria:
> 
> 
> 
> tasks:
>   - name: Delete unavailable nodes
>     zabbix_host:
>      server_url: http://zabbix.aa.net/zabbix
>      login_user: Admin
>      login_password: aq!
>      host_groups: Discovered hosts
>      status: disabled
>      state: absent
>      host_name: "{{ item }}"
>     with_items:
>      - ip-10-1-*-*.us-west-2.compute.internal
>     
> 
> The above doesnt work, but if I list out the items
> with_items:
>      - ip-10-1-65-27.us-west-2.compute.internal
>      - ip-10-1-65-28.us-west-2.compute.internal
>      - ip-10-1-65-37.us-west-2.compute.internal
> 
> then it works, but I want it to be dynamic and find all ips matching      - 
> ip-10-1-*-*.us-west-2.compute.internal
> 
> any help please?

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5df025ec-fe71-42ec-9255-ed28fd3cd3ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.