summaryrefslogtreecommitdiffstats
path: root/roles/ands_network/tasks/firewall.yml
blob: d5ba5f34e9f33a21453a2260654024fa185a2fcb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
- name: Ensure firewall template directory exists
  file: path="{{ firewall_template_path }}" state="directory" mode=0644 owner=root group=root

#Just in case we already added but not reloaded yet
#- name: Reload firewalld rules
#  shell: firewall-cmd --reload

- name: Get list of existing firewalld services
  shell: "firewall-cmd --get-services | tr ' ' '\n'"
  changed_when: false
  register: services

- name: Configure missing firewalld services
  include_tasks: firewall_service.yml
  with_items: "{{ firewall_services }}"
  vars:
    servicelist: "{{ services.stdout_lines }}"
  loop_control:
    loop_var: service

- name: Reload firewalld rules
  shell: firewall-cmd --reload

- name: Enable MySQL and Galera services if ands_hostnet_db is enabled
  firewalld: service="{{ item }}" state="enabled" permanent="true" immediate="true"
  when: ands_hostnet_db | default(false)
  with_items:
    - mysql
    - galera

- name: Reload firewalld rules
  shell: firewall-cmd --reload