blob: 930b32cf2c2249aafd433ee374be048af77f97c3 (
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
---
- name: Ensure firewalld service is not enabled
systemd:
name: firewalld
state: stopped
enabled: no
masked: yes
register: task_result
failed_when: "task_result|failed and 'could not' not in task_result.msg|lower"
- name: Install iptables packages
package: name={{ item }} state=present
with_items:
- iptables
- iptables-services
when: not openshift.common.is_atomic | bool
- name: Start and enable iptables service
systemd:
name: iptables
state: started
enabled: yes
masked: no
daemon_reload: yes
register: result
- name: need to pause here, otherwise the iptables service starting can sometimes cause ssh to fail
pause: seconds=10
when: result | changed
- name: Add iptables allow rules
os_firewall_manage_iptables:
name: "{{ item.service }}"
action: add
protocol: "{{ item.port.split('/')[1] }}"
port: "{{ item.port.split('/')[0] }}"
with_items: "{{ os_firewall_allow }}"
- name: Remove iptables rules
os_firewall_manage_iptables:
name: "{{ item.service }}"
action: remove
protocol: "{{ item.port.split('/')[1] }}"
port: "{{ item.port.split('/')[0] }}"
with_items: "{{ os_firewall_deny }}"
|