Browse Source

rewrite restart-vpn playbook

Blaine Story 1 year ago
parent
commit
8ec1f6b1c8
1 changed files with 6 additions and 44 deletions
  1. 6 44
      plays/restart-vpn.yml

+ 6 - 44
plays/restart-vpn.yml

@@ -1,48 +1,10 @@
 ---
-- hosts: dhcp
-  become: True
-  gather_facts: False
-  vars:
-    wg_allowed_ips: '0.0.0.0/0,::0/0'
+- hosts: 10.0.0.2
+  become: true
+  gather_facts: false
 
   tasks:
-    - name: Load potential endpoints
-      include_vars:
-        file: ../vars/vault.yaml
-
-    - name: Select a random endpoint
-      set_fact:
-        wg_info: "{{ vaulted_wg_info | shuffle | first }}"
-
-    - name: Update settings to connect to {{ wg_info.name }}
-      set_fact:
-        wg_private_key: "{{ wg_info.private_key }}"
-        wg_address: "{{ wg_info.address }}"
-        wg_public_key: "{{ wg_info.pubkey }}"
-        wg_endpoint: "{{ wg_info.endpoint }}"
-
-
-    - name: Update wireguard config
-      template:
-        src: ../roles/wg-gateway/templates/wg.conf.j2
-        dest: /etc/wireguard/wg0.conf
-        owner: root
-        group: root
-        mode: '0644'
-
-    - name: Restart wireguard interface
-      systemd:
-        name: wg-quick@wg0
-        state: restarted
-
-    - name: Edit /etc/motd
-      lineinfile:
-        path: /etc/motd
-        regex: "^VPN Traffic tunneled through server: "
-        line: "VPN Traffic tunneled through server: {{ wg_info.name }}"
-      delegate_to: 10.0.0.4
-
-    - name: Restart unbound
-      systemd:
-        name: unbound
+    - name: Restart VPN
+      ansible.builtin.systemd_service:
+        name: openvpn@proton
         state: restarted