Parcourir la source

add restart-vpn.yml

Blaine Story il y a 3 ans
Parent
commit
c4b8e30202
1 fichiers modifiés avec 29 ajouts et 0 suppressions
  1. 29 0
      plays/restart-vpn.yml

+ 29 - 0
plays/restart-vpn.yml

@@ -0,0 +1,29 @@
+---
+- hosts: gateway
+  become: True
+  gather_facts: False
+  tasks:
+  - name: Restart ProtonVPN
+    systemd:
+      name: 'openvpn-client@proton'
+      state: restarted
+
+  - name: Wait for VPN to reconnect
+    wait_for:
+      path: /proc/sys/net/ipv4/conf/tun0
+
+  - name: Get new IP of VPN
+    setup:
+
+  - name: Update unbound.conf
+    template:
+      src: "{{ playbook_dir }}/../roles/name-resolution/templates/unbound/unbound.conf.j2"
+      dest: /etc/unbound/unbound.conf
+      owner: root
+      group: unbound
+      mode: '0644'
+
+  - name: Restart unbound
+    systemd:
+      name: unbound
+      state: restarted