restart-vpn.yml 614 B

1234567891011121314151617181920212223242526272829
  1. ---
  2. - hosts: gateway
  3. become: True
  4. gather_facts: False
  5. tasks:
  6. - name: Restart ProtonVPN
  7. systemd:
  8. name: 'openvpn-client@proton'
  9. state: restarted
  10. - name: Wait for VPN to reconnect
  11. wait_for:
  12. path: /proc/sys/net/ipv4/conf/tun0
  13. - name: Get new IP of VPN
  14. setup:
  15. - name: Update unbound.conf
  16. template:
  17. src: "{{ playbook_dir }}/../roles/name-resolution/templates/unbound/unbound.conf.j2"
  18. dest: /etc/unbound/unbound.conf
  19. owner: root
  20. group: unbound
  21. mode: '0644'
  22. - name: Restart unbound
  23. systemd:
  24. name: unbound
  25. state: restarted