On Wed, 15 Dec 2021 at 18:44, Vladimir Botka <vbo...@gmail.com> wrote:

> It's not possible to delegate a task to a group. Delegate to a host
> instead. Change the inventory. For example
>
>   shell> cat hosts
>   zabbixprimary ansible_host=localhost ansible_port=2235
>   zabbixslave ansible_host=localhost ansible_port=2236
>
>   [zabbix]
>   zabbixprimary
>   zabbixslave
>
> You should be able to delegate to the hosts. For example
>
>   - hosts: zabbix
>     tasks:
>       - shell: echo OK
>         delegate_to: zabbixprimary
>         run_once: true
>       - shell: echo OK
>         delegate_to: zabbixslave
>         run_once: true
>
> should work as expected
>
>   TASK [shell] *********************************************
>   changed: [zabbixprimary -> zabbixprimary]
>
>   TASK [shell] *********************************************
>   changed: [zabbixprimary -> zabbixslave]
>
> --
> Vladimir Botka
>

Interesting! And can I use the "delegate_to" command to more than one host
at a time?

Cheers!
Lucas

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAE_gQfW%3DAO280BWu%3DA23NcSm6DKe9UnyMSgnJcxYt2itNhmS%2Bw%40mail.gmail.com.

Reply via email to