From 170cb7a5918860b0507e179a8cfb11b41e6eeca4 Mon Sep 17 00:00:00 2001 From: james-otten Date: Sun, 29 Dec 2024 19:11:24 -0500 Subject: [PATCH] netplan --- ansible/roles/chrony_server/tasks/main.yaml | 31 +++++++++---------- .../templates/netplan_dummy0.yaml.j2 | 9 ------ .../templates/netplan_dummy1.yaml.j2 | 9 ------ ansible/roles/requirements.yml | 2 +- 4 files changed, 16 insertions(+), 35 deletions(-) delete mode 100644 ansible/roles/chrony_server/templates/netplan_dummy0.yaml.j2 delete mode 100644 ansible/roles/chrony_server/templates/netplan_dummy1.yaml.j2 diff --git a/ansible/roles/chrony_server/tasks/main.yaml b/ansible/roles/chrony_server/tasks/main.yaml index 416e871..3cf78d2 100644 --- a/ansible/roles/chrony_server/tasks/main.yaml +++ b/ansible/roles/chrony_server/tasks/main.yaml @@ -58,18 +58,6 @@ enabled: true daemon_reload: true -- name: Netplan dummy0 interface - ansible.builtin.template: - src: netplan_dummy0.yaml.j2 - dest: /etc/netplan/dummy0.yaml - mode: "600" - -- name: Netplan dummy1 interface - ansible.builtin.template: - src: netplan_dummy1.yaml.j2 - dest: /etc/netplan/dummy1.yaml - mode: "600" - - name: Iptables rules ansible.builtin.template: src: iptables.j2 @@ -81,10 +69,21 @@ cmd: "bash -c '/sbin/iptables-restore < /etc/iptables/rules.v4'" creates: /tmp/fake_for_linter -- name: Netplan apply - ansible.builtin.command: - cmd: "bash -c 'netplan apply && touch /tmp/netplan_applied'" - creates: /tmp/netplan_applied +- name: Cleanup old netplan file + ansible.builtin.file: + path: /etc/netplan/dummy0.yaml + state: "absent" + +- name: Cleanup old netplan file + ansible.builtin.file: + path: /etc/netplan/dummy1.yaml + state: "absent" + +- name: Import the netplan_loopback role from the nycmesh.common collection + ansible.builtin.import_role: + name: nycmesh.common.netplan_loopback + vars: + netplan_loopback_ips: "{{ NTP_IP }};{{ ROUTER_ID }}" - name: Restart and enable iptables service ansible.builtin.service: diff --git a/ansible/roles/chrony_server/templates/netplan_dummy0.yaml.j2 b/ansible/roles/chrony_server/templates/netplan_dummy0.yaml.j2 deleted file mode 100644 index ef1138a..0000000 --- a/ansible/roles/chrony_server/templates/netplan_dummy0.yaml.j2 +++ /dev/null @@ -1,9 +0,0 @@ -network: - version: 2 - renderer: networkd - ethernets: - lo: - dhcp4: no - dhcp6: no - addresses: - - {{ NTP_IP }}/32 diff --git a/ansible/roles/chrony_server/templates/netplan_dummy1.yaml.j2 b/ansible/roles/chrony_server/templates/netplan_dummy1.yaml.j2 deleted file mode 100644 index 220d3bb..0000000 --- a/ansible/roles/chrony_server/templates/netplan_dummy1.yaml.j2 +++ /dev/null @@ -1,9 +0,0 @@ -network: - version: 2 - renderer: networkd - ethernets: - lo: - dhcp4: no - dhcp6: no - addresses: - - {{ ROUTER_ID }}/32 diff --git a/ansible/roles/requirements.yml b/ansible/roles/requirements.yml index ae2158b..68d2967 100644 --- a/ansible/roles/requirements.yml +++ b/ansible/roles/requirements.yml @@ -7,4 +7,4 @@ collections: - name: nycmesh.common source: git+https://github.com/nycmeshnet/nycmesh-ansible.git type: git - version: main + version: james/netplan_loopback_ip