-
Notifications
You must be signed in to change notification settings - Fork 40
/
13_bastion_networking.yml
51 lines (45 loc) · 1.52 KB
/
13_bastion_networking.yml
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
47
48
49
50
51
---
- name: Bastion networking playbook
hosts: bastion
become: true
tasks:
- name: Checking Bastion internal network interfaces
ansible.builtin.fail:
msg: "{{ host_interface }} not found in {{ ansible_facts.interfaces }}"
when: host_interface not in ansible_facts.interfaces
- name: Ensure firewalld is enabled and running
ansible.builtin.service:
name: firewalld
state: started
enabled: true
# - name: Adding interface {{ host_interface }} to internal zone
# community.general.nmcli:
# conn_name: "{{ host_interface }}"
# zone: internal
# state: present
- name: Adding interface to internal zone # noqa no-changed-when
ansible.builtin.command: nmcli con mod {{ host_interface }} connection.zone internal
- name: Adding Bastion interface to firewall internal zone
ansible.posix.firewalld:
zone: internal
interface: "{{ host_interface }}"
permanent: true
state: enabled
- name: Allow required service for internal zone
ansible.posix.firewalld:
zone: internal
state: enabled
permanent: true
service: "{{ item }}"
loop: "{{ services }}"
- name: Allow tftp and pxe ports
ansible.posix.firewalld:
zone: internal
state: enabled
permanent: true
port: "{{ item }}"
loop: "{{ ports }}"
- name: Reload Bastion firewalld service
ansible.builtin.service:
name: firewalld
state: restarted