debian: don’t set up firewall for proxmox hosts
Also factor firewall setup into a separate task. There is no good way to distinguish Debian and Proxmox hosts in Ansible, so we rely on the cluster_type NetBox variable.
This commit is contained in:
parent
45d3e6c4ec
commit
ef69e31357
2 changed files with 29 additions and 23 deletions
26
roles/debian/tasks/firewall.yml
Normal file
26
roles/debian/tasks/firewall.yml
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
- name: Install nftables
|
||||||
|
package:
|
||||||
|
name: nftables
|
||||||
|
|
||||||
|
- name: Set up generic firewall rules
|
||||||
|
copy:
|
||||||
|
dest: /etc/nftables.conf
|
||||||
|
src: nftables.conf
|
||||||
|
notify: reload nftables
|
||||||
|
|
||||||
|
- name: Create nftables include directory
|
||||||
|
file:
|
||||||
|
path: /etc/nftables.d
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: Set up local firewall rules
|
||||||
|
template:
|
||||||
|
dest: /etc/nftables.d/services.nft
|
||||||
|
src: services.nft.j2
|
||||||
|
notify: reload nftables
|
||||||
|
|
||||||
|
- name: Enable firewall
|
||||||
|
service:
|
||||||
|
name: nftables
|
||||||
|
enabled: yes
|
||||||
|
state: started
|
|
@ -30,7 +30,6 @@
|
||||||
name:
|
name:
|
||||||
- git
|
- git
|
||||||
- ifupdown2
|
- ifupdown2
|
||||||
- nftables
|
|
||||||
- rsync
|
- rsync
|
||||||
- vim
|
- vim
|
||||||
- tmux
|
- tmux
|
||||||
|
@ -76,28 +75,9 @@
|
||||||
value: 'prohibit-password'
|
value: 'prohibit-password'
|
||||||
notify: reload sshd
|
notify: reload sshd
|
||||||
|
|
||||||
- name: Set up generic firewall rules
|
- name: Set up firewall
|
||||||
copy:
|
include_tasks: firewall.yml
|
||||||
dest: /etc/nftables.conf
|
when: is_virtual or cluster_type != 'proxmox' # proxmox has its own firewall configuration
|
||||||
src: nftables.conf
|
|
||||||
notify: reload nftables
|
|
||||||
|
|
||||||
- name: Create nftables include directory
|
|
||||||
file:
|
|
||||||
path: /etc/nftables.d
|
|
||||||
state: directory
|
|
||||||
|
|
||||||
- name: Set up local firewall rules
|
|
||||||
template:
|
|
||||||
dest: /etc/nftables.d/services.nft
|
|
||||||
src: services.nft.j2
|
|
||||||
notify: reload nftables
|
|
||||||
|
|
||||||
- name: Enable firewall
|
|
||||||
service:
|
|
||||||
name: nftables
|
|
||||||
enabled: yes
|
|
||||||
state: started
|
|
||||||
|
|
||||||
- name: Install automatic upgrade package
|
- name: Install automatic upgrade package
|
||||||
package:
|
package:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue