summaryrefslogtreecommitdiff
path: root/ansible/roles/wireguard2/tasks/absent.yml
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2020-08-21 13:44:50 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2020-08-21 13:44:50 +0200
commit9158fc8ff671707c686fcd40e13b06310112eada (patch)
treef4bbef85c8303cbb63ae7feac44e721bdbf43cf8 /ansible/roles/wireguard2/tasks/absent.yml
parentb103e6d49aade658ebeabe8c21ef172b8bd72202 (diff)
downloadinfra-9158fc8ff671707c686fcd40e13b06310112eada.tar.gz
infra-9158fc8ff671707c686fcd40e13b06310112eada.tar.bz2
infra-9158fc8ff671707c686fcd40e13b06310112eada.tar.xz
infra-9158fc8ff671707c686fcd40e13b06310112eada.zip
wireguard2
Diffstat (limited to 'ansible/roles/wireguard2/tasks/absent.yml')
-rw-r--r--ansible/roles/wireguard2/tasks/absent.yml18
1 files changed, 18 insertions, 0 deletions
diff --git a/ansible/roles/wireguard2/tasks/absent.yml b/ansible/roles/wireguard2/tasks/absent.yml
new file mode 100644
index 0000000..82bfeb1
--- /dev/null
+++ b/ansible/roles/wireguard2/tasks/absent.yml
@@ -0,0 +1,18 @@
+- name: Clean old files
+ become: yes
+ file:
+ path: "{{ item }}"
+ state: absent
+ loop:
+ - "{{ netdev_path}}"
+ - "{{ network_path}}"
+ - "{{ private_key_path }}"
+ - "{{ public_key_path }}"
+ notify: systemctl restart systemd-networkd
+
+- name: remove interface
+ become: yes
+ shell: "ip l del dev {{ wireguard_if }}"
+ register: if_del
+ changed_when: if_del.rc == 0
+ failed_when: false