1 #####################################
2 ### someone's ansible provisioner ###
3 #####################################
4 # Part of: https://git.somenet.org/root/pub/somesible.git
5 # 2017-2024 by someone <someone@somenet.org>
8 - name: install networking tools
22 ignore_errors: "{{ignore_online_errors | bool}}"
25 - name: copy interfaces config
28 dest: "/etc/network/interfaces"
33 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/interfaces"
34 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/interfaces"
35 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/interfaces"
36 - "default/interfaces"
37 notify: restart networking.service
40 - name: copy nftables config
43 dest: "/etc/nftables.conf"
47 validate: "nft --check --file %s"
49 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/nftables.conf"
50 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/nftables.conf"
51 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/nftables.conf"
52 - "default/nftables.conf"
54 - restart nftables.service
55 - restart fail2ban.service
58 - name: copy fail2ban jail config
61 dest: "/etc/fail2ban/jail.local"
66 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/fail2ban.jail.local"
67 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/fail2ban.jail.local"
68 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/fail2ban.jail.local"
69 - "default/fail2ban.jail.local"
70 notify: restart fail2ban.service
73 - name: copy fail2ban/action.d/nftables-common.local
76 dest: "/etc/fail2ban/action.d/nftables-common.local"
81 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/fail2ban.nftables-common.local"
82 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/fail2ban.nftables-common.local"
83 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/fail2ban.nftables-common.local"
84 - "default/fail2ban.nftables-common.local"
85 notify: restart fail2ban.service
88 - name: copy fail2ban/filter.d/repeated-offenders.conf
91 dest: "/etc/fail2ban/filter.d/repeated-offenders.conf"
96 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/fail2ban.filter.repeated-offenders.conf"
97 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/fail2ban.filter.repeated-offenders.conf"
98 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/fail2ban.filter.repeated-offenders.conf"
99 - "default/fail2ban.filter.repeated-offenders.conf"
100 notify: restart fail2ban.service
103 - name: copy vnstat.conf
106 dest: "/etc/vnstat.conf"
111 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/vnstat.conf"
112 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/vnstat.conf"
113 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/vnstat.conf"
114 - "default/vnstat.conf"
115 notify: restart vnstat.service
118 - name: enable and start nftables.service
119 include_role: name="base/systemd/enable-and-start"
121 service_name: nftables.service
124 - name: enable and start fail2ban.service
125 include_role: name="base/systemd/enable-and-start"
127 service_name: fail2ban.service
128 # maybe the system is not fully setup yet.
132 - name: enable and start vnstat.service
133 include_role: name="base/systemd/enable-and-start"
135 service_name: vnstat.service
136 # maybe the system is not fully setup yet.