On 3/17/20 11:04 AM, דודו דודו wrote:
> I have a partial success that I can not figure what is the problem.
> I have 2 tasks, one not in group and the other in group
>
> The first task is running as required, the second task is skipping all groups - Can not understand why
>
> - name: install java-11-openjdk' packages
> yum:
> name: ['java-11-openjdk']
> state: latest
> when:
> - inventory_hostname not in groups.kafka
> - inventory_hostname not in groups.kafka_master
>
>
> - name: install java-8-openjdk' packages
> yum:
> name: ['java-1.8.0-openjdk']
> state: latest
> when:
> - inventory_hostname in groups.kafka
> - inventory_hostname in groups.kafka_master
That is because both conditions are combined with an AND, so I can't be true.
You can try or (untested):
when: inventory_hostname in groups.kafka or inventory_hostname in groups.kafka_master
Regards
Racke
> On Tuesday, 17 March 2020 08:33:46 UTC+2, דודו דודו wrote:
>
> HI,
>
> I have a task that runs only on servers that are under Kafka group. How can i run the task on Kafka and
> Webserver groups only.
>
> Thanks
>
> - name: install java-8-openjdk' packages
> yum:
> name: ['java-1.8.0-openjdk']
> state: latest
> when: "'kafka' in group_names"
>
> --
> 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-proje...@googlegroups.com <mailto:
ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/ansible-project/81d98394-39d7-4ec9-90bc-97f024638073%40googlegroups.com
> <
https://groups.google.com/d/msgid/ansible-project/81d98394-39d7-4ec9-90bc-97f024638073%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.