ansible-roles/vpn/bridge/tasks/main.yml

53 lines
1.3 KiB
YAML
Raw Normal View History

2022-12-20 19:47:11 +01:00
---
- name: "post-up nftables inet script"
ansible.builtin.template:
2023-07-08 09:45:59 +02:00
src: "./post-up-br0-inet.nft"
2022-12-20 19:47:11 +01:00
dest: "/usr/local/sbin/post-up-br0-inet.nft"
mode: 0755
register: vpn_bridge_post_up_br0_inet_nft
- name: "post-up nftables ipv4 script"
ansible.builtin.template:
2023-07-08 09:45:59 +02:00
src: "./post-up-br0-ipv4.nft"
2022-12-20 19:47:11 +01:00
dest: "/usr/local/sbin/post-up-br0-ipv4.nft"
mode: 0755
register: vpn_bridge_post_up_br0_ipv4_nft
- name: "configure interface"
ansible.builtin.template:
2023-07-08 09:45:59 +02:00
src: "./br0"
2022-12-20 19:47:11 +01:00
dest: "/etc/network/interfaces.d/br0"
mode: 0644
validate: >
bash -c
'if ! diff %s /etc/network/interfaces.d/br0 && ip link show dev br0 ;
then
ifdown br0 ;
fi'
register: vpn_bridge_intf
- name: "restart interface"
ansible.builtin.shell: |
if ip link show dev br0
then
ifdown br0 && ifup br0
else
ifup br0
fi
when:
vpn_bridge_post_up_br0_inet_nft.changed or
vpn_bridge_post_up_br0_ipv4_nft.changed or
vpn_bridge_intf.changed
- name: "pre-down nftables inet script"
ansible.builtin.copy:
src: "./pre-down-br0-inet.nft"
dest: "/usr/local/sbin/pre-down-br0-inet.nft"
mode: 0755
- name: "pre-down nftables ipv4 script"
ansible.builtin.copy:
src: "./pre-down-br0-ipv4.nft"
dest: "/usr/local/sbin/pre-down-br0-ipv4.nft"
mode: 0755