Created
August 26, 2014 15:46
-
-
Save kuon/10e8d324059357ad0555 to your computer and use it in GitHub Desktop.
Mapping groups to ports in ansible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vars: | |
fw_ports: | |
- ["5000", "6000"] | |
- "{{ groups['api-server'] }}" # this should map to a list of IP | |
tasks: | |
- name: Open ports | |
firewalld: | |
permanent={{ permanent }} | |
state=enabled | |
rich_rule='rule family="ipv4" source address="{{ item[1) }}" port port="{{ item[0] }}" protocol="tcp" accept' | |
when: fw_ports is defined | |
with_nested_items: fw_ports | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment