Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Firewall Configurations ###
- - hosts: testservers
- tasks:
- # CentOS #
- - name: Allow HTTP CentOS
- command: firewall-cmd --add-service=http --permanent
- when: ansible_distribution == "CentOS"
- - name: Allow HTTPs CentOS
- command: firewall-cmd --add-service=https --permanent
- when: ansible_distribution == "CentOS"
- - name: Allow SQL CentOS
- command: firewall-cmd --add-port=3306/tcp --permanent
- when: ansible_distribution == "CentOS"
- # SUSE #
- - name: Allow HTTP SUSE
- lineinfile: dest=/etc/sysconfig/SuSEfirewall2 line='FW_CONFIGURATIONS_EXT="apache2"' create="yes"
- when: ansible_os_family == "Suse"
- - name: Allow SSH SUSE
- lineinfile: dest=/etc/sysconfig/SuSEfirewall2 line='FW_SERVICES_EXT_TCP="ssh"' create="yes"
- when: ansible_os_family == "Suse"
- - name: Allow PING SUSE
- lineinfile: dest=/etc/sysconfig/SuSEfirewall2 line='FW_ALLOW_PING_FW="yes"' create="yes"
- when: ansible_os_family == "Suse"
- ### Firewall reboot ###
- # CentOS #
- - name: Reload Firewall settings CentOS
- command: firewall-cmd --reload
- when: ansible_distribution == "CentOS"
- # SUSE #
- - name: Reload init Firewall settings SUSE
- command: /etc/init.d/SuSEfirewall2_init restart
- when: ansible_os_family == "Suse"
- - name: Reload setup Firewall settings SUSE
- command: /etc/init.d/SuSEfirewall2_setup restart
- when: ansible_os_family == "Suse"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement