|
1 | 1 | # Add firewall rules for all the Ceph Services |
2 | 2 |
|
3 | | -- name: Ensure firewall is temporarily stopped |
4 | | - delegate_to: "{{ node }}" |
5 | | - become: true |
6 | | - ansible.builtin.systemd: |
7 | | - name: "{{ item }}" |
8 | | - state: stopped |
9 | | - loop: |
10 | | - - iptables |
11 | | - - nftables |
12 | | - |
13 | 3 | - name: Manage Ceph iptables rules |
14 | | - when: ceph_firewall_type == "iptables" |
| 4 | + when: |
| 5 | + - ceph_firewall_enabled | bool | default(true) |
| 6 | + - ceph_firewall_type == "iptables" |
15 | 7 | block: |
16 | 8 | - name: Ceph Migration - Apply the Ceph cluster rules (iptables) |
17 | 9 | delegate_to: "{{ node }}" |
|
29 | 21 | -A INPUT -p tcp -m tcp --dport 2049 -m conntrack --ctstate NEW -m comment --comment "111 ceph_nfs ipv4" -j ACCEPT |
30 | 22 | -A INPUT -p tcp -m tcp --dport 12049 -m conntrack --ctstate NEW -m comment --comment "111 ceph_nfs_backend ipv4" -j ACCEPT |
31 | 23 | -A INPUT -p tcp -m tcp --dport 6800:7300 -m conntrack --ctstate NEW -m comment --comment "112 ceph_mds_mgr ipv4" -j ACCEPT |
| 24 | + -A INPUT -p tcp -m tcp --dport 9283 -m conntrack --ctstate NEW -m comment --comment "113 ceph_prometheus ipv4" -j ACCEPT |
32 | 25 | loop: "{{ ceph_iptables_path }}" |
33 | 26 |
|
34 | 27 | - name: Ensure firewall is enabled/started - iptables |
35 | | - when: ceph_firewall_enabled | bool | default(false) |
| 28 | + when: |
| 29 | + - ceph_firewall_enabled | bool | default(true) |
| 30 | + - ceph_firewall_type == "iptables" |
36 | 31 | delegate_to: "{{ node }}" |
37 | 32 | become: true |
38 | 33 | ansible.builtin.systemd: |
|
41 | 36 | enabled: true |
42 | 37 |
|
43 | 38 | - name: Manage Ceph nftables rules |
44 | | - when: ceph_firewall_type == "nftables" |
| 39 | + when: |
| 40 | + - ceph_firewall_enabled | bool | default(true) |
| 41 | + - ceph_firewall_type == "nftables" |
45 | 42 | block: |
46 | 43 | - name: Ceph Migration - Apply the Ceph cluster rules (nftables) |
47 | 44 | delegate_to: "{{ node }}" |
|
50 | 47 | marker_begin: "BEGIN ceph firewall rules" |
51 | 48 | marker_end: "END ceph firewall rules" |
52 | 49 | path: "{{ ceph_nftables_path }}" |
| 50 | + mode: "0644" |
53 | 51 | block: | |
54 | | - # 100 ceph_alertmanager {'dport': [9093]} |
55 | | - add rule inet filter TRIPLEO_INPUT tcp dport { 9093 } ct state new counter accept comment "100 ceph_alertmanager" |
56 | | - # 100 ceph_dashboard {'dport': [8443]} |
57 | | - add rule inet filter TRIPLEO_INPUT tcp dport { 8443 } ct state new counter accept comment "100 ceph_dashboard" |
58 | | - # 100 ceph_grafana {'dport': [3100]} |
59 | | - add rule inet filter TRIPLEO_INPUT tcp dport { 3100 } ct state new counter accept comment "100 ceph_grafana" |
60 | | - # 100 ceph_prometheus {'dport': [9092]} |
61 | | - add rule inet filter TRIPLEO_INPUT tcp dport { 9092 } ct state new counter accept comment "100 ceph_prometheus" |
62 | | - # 100 ceph_rgw {'dport': ['8080']} |
63 | | - add rule inet filter TRIPLEO_INPUT tcp dport { 8080 } ct state new counter accept comment "100 ceph_rgw" |
64 | | - # 110 ceph_mon {'dport': [6789, 3300, '9100']} |
65 | | - add rule inet filter TRIPLEO_INPUT tcp dport { 6789,3300,9100 } ct state new counter accept comment "110 ceph_mon" |
66 | | - # 112 ceph_mds {'dport': ['6800-7300', '9100']} |
67 | | - add rule inet filter TRIPLEO_INPUT tcp dport { 6800-7300,9100 } ct state new counter accept comment "112 ceph_mds" |
68 | | - # 113 ceph_mgr {'dport': ['6800-7300', 8444]} |
69 | | - add rule inet filter TRIPLEO_INPUT tcp dport { 6800-7300,8444 } ct state new counter accept comment "113 ceph_mgr" |
70 | | - # 120 ceph_nfs {'dport': ['12049', '2049']} |
71 | | - add rule inet filter TRIPLEO_INPUT tcp dport { 2049 } ct state new counter accept comment "120 ceph_nfs" |
72 | | - # 122 ceph rgw {'dport': ['8080', '8080', '9100']} |
73 | | - add rule inet filter TRIPLEO_INPUT tcp dport { 8080,8080,9100 } ct state new counter accept comment "122 ceph rgw" |
74 | | - # 123 ceph_dashboard {'dport': [3100, 9090, 9092, 9093, 9094, 9100, 9283]} |
75 | | - add rule inet filter TRIPLEO_INPUT tcp dport { 3100,9090,9092,9093,9094,9100,9283 } ct state new counter accept comment "123 ceph_dashboard" |
| 52 | + # 100 ceph_alertmanager (9093) |
| 53 | + add rule inet filter EDPM_INPUT tcp dport { 9093 } ct state new counter accept comment "100 ceph_alertmanager" |
| 54 | + # 100 ceph_dashboard (8443) |
| 55 | + add rule inet filter EDPM_INPUT tcp dport { 8443 } ct state new counter accept comment "100 ceph_dashboard" |
| 56 | + # 100 ceph_grafana (3100) |
| 57 | + add rule inet filter EDPM_INPUT tcp dport { 3100 } ct state new counter accept comment "100 ceph_grafana" |
| 58 | + # 100 ceph_prometheus (9092) |
| 59 | + add rule inet filter EDPM_INPUT tcp dport { 9092 } ct state new counter accept comment "100 ceph_prometheus" |
| 60 | + # 100 ceph_rgw (8080) |
| 61 | + add rule inet filter EDPM_INPUT tcp dport { 8080 } ct state new counter accept comment "100 ceph_rgw" |
| 62 | + # 110 ceph_mon (6789, 3300, 9100) |
| 63 | + add rule inet filter EDPM_INPUT tcp dport { 6789,3300,9100 } ct state new counter accept comment "110 ceph_mon" |
| 64 | + # 112 ceph_mds (6800-7300, 9100) |
| 65 | + add rule inet filter EDPM_INPUT tcp dport { 6800-7300,9100 } ct state new counter accept comment "112 ceph_mds" |
| 66 | + # 113 ceph_mgr (6800-7300, 8444) |
| 67 | + add rule inet filter EDPM_INPUT tcp dport { 6800-7300,8444 } ct state new counter accept comment "113 ceph_mgr" |
| 68 | + # 120 ceph_nfs (2049, 12049) |
| 69 | + add rule inet filter EDPM_INPUT tcp dport { 2049,12049 } ct state new counter accept comment "120 ceph_nfs" |
| 70 | + # 123 ceph_dashboard (9090, 9094, 9283) |
| 71 | + add rule inet filter EDPM_INPUT tcp dport { 9090,9094,9283 } ct state new counter accept comment "123 ceph_dashboard" |
| 72 | + insertbefore: '^# Lock down INPUT chains' |
76 | 73 |
|
77 | 74 | - name: Ensure firewall is enabled/started - nftables |
78 | | - when: ceph_firewall_enabled | bool | default(false) |
| 75 | + when: |
| 76 | + - ceph_firewall_enabled | bool | default(true) |
| 77 | + - ceph_firewall_type == "nftables" |
79 | 78 | delegate_to: "{{ node }}" |
80 | 79 | become: true |
81 | 80 | ansible.builtin.systemd: |
|
0 commit comments