diff --git a/ansible/roles/networking/tasks/main.yml b/ansible/roles/networking/tasks/main.yml index c8ac3d9..b15cc2f 100644 --- a/ansible/roles/networking/tasks/main.yml +++ b/ansible/roles/networking/tasks/main.yml @@ -45,3 +45,18 @@ src: ham-hotspot-nat.nft.j2 mode: "0644" notify: Restart nftables + +# Install ham-hotspot-nat.service +- name: Install ham-hotspot-nat.service + ansible.builtin.template: + dest: /etc/systemd/system/ham-hotspot-nat.service + src: ham-hotspot-nat.service.j2 + mode: "0644" + notify: Reload systemd + +# Enable and start ham-hotspot-nat.service +- name: Enable and start ham-hotspot-nat.service + ansible.builtin.systemd: + name: ham-hotspot-nat.service + enabled: true + state: started diff --git a/ansible/roles/networking/templates/ham-hotspot-nat.service.j2 b/ansible/roles/networking/templates/ham-hotspot-nat.service.j2 new file mode 100644 index 0000000..614eb49 --- /dev/null +++ b/ansible/roles/networking/templates/ham-hotspot-nat.service.j2 @@ -0,0 +1,12 @@ +[Unit] +Description=Ham Hotspot NAT Configuration +After=network-online.target +Wants=network-online.target + +[Service] +Type=oneshot +ExecStart=/sbin/nft -f /etc/nftables.d/10-ham-hotspot-nat.nft +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target