On 12.05.16 22:39 Dejay Clayton wrote:

> How are you invoking the playbook?  Just because a host is in two groups, 
> doesn't mean it will execute the logic for both groups. 

The problem is that the list called firewallports gets overwritten by
whatever vars file is processed last.

For example, first it gets set to list from databases var file, then
to webserver list.

I do not know if it is possible to tell ansible to add lists together
automatically.

Quick and dirty: I would name the lists differently, and duplicate the
task:

- name: add database ports to the firewall
  firewalld: port={{ item }} permanent=true zone=work state=enabled
  with_items: "{{ db_firewallports }}"
  when: db_firewallports is defined

- name: add webserver ports to the firewall
  firewalld: port={{ item }} permanent=true zone=work state=enabled
  with_items: "{{ web_firewallports }}"
  when: web_firewallports is defined

Or join all lists together before the task into another list:
set_fact: firewallports= db_firewallports + web_firewallports
(or something in this manner)

Johannes

-- 
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/573639D3.4000807%40ojkastl.de.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to