Hi Team,
I'm a newbie to ansible, trying to complete this project for opening
firewall ports. Below is my project structure
| - group_vars
| - dbserver
| - webserver
| - applicationserver
| - host_vars
| - roles
| - Common
| - files
| - app.app
| - handlers
| - main.yml
| - tasks
| - main.yml
| - hosts
| - site.yml
Contents of /hosts
[dbserver]
host1 ansible_ssh_host=10.10.10.1
host2 ansible_ssh_host=10.10.10.2
[webserver]
host2 ansible_ssh_host=10.10.10.2
host3 ansible_ssh_host=10.10.10.3
[applicationserver]
host1 ansible_ssh_host=10.10.10.1
host3 ansible_ssh_host=10.10.10.3
Contents of /group_vars/dbserver
---
firewallports:
- 27017
- 6379
Contents of /group_vars/webserver
---
firewallports:
- 80
Contents of /group_vars/applicationserver
---
firewallports:
- 8080
Contents of /roles/common/tasks/main.yml
---
- name: add ports to the firewall
firewalld: port={{ item }} permanent=true zone=work state=enabled
with_items: "{{ firewallports }}"
Here i have host2 available on both dbserver and webserver groups and im
expecting it open both the ports of dbserver (port - 27017 , 6379) and
webserver (port - 80) group related. But only one among them is working,
not both.
Is there a way i can open multiple ports on the same host using group_vars.
Thanks
Manoj Badam
--
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/5c13eb86-2703-42a2-95c2-98f21746903d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.