Explorar el Código

update restartvpn outputs

Blaine Story hace 2 días
padre
commit
7a719be65a
Se han modificado 1 ficheros con 14 adiciones y 4 borrados
  1. 14 4
      plays/restart-vpn.yml

+ 14 - 4
plays/restart-vpn.yml

@@ -14,18 +14,28 @@
 
 
   tasks:
+  - name: Query Nord Endpoint Info (Pre-Change)
+    ansible.builtin.shell:
+      cmd: "nordvpn status | grep Hostname | awk '{print $2}'"
+    changed_when: false
+    register: nord_status_pre
+
+
   - name: Change Nord Endpoint
     ansible.builtin.shell:
       cmd: nordvpn connect
 
-  - name: Query Nord Endpoint Info
+
+  - name: Query Nord Endpoint Info (Post-Change)
     ansible.builtin.shell:
       cmd: "nordvpn status | grep Hostname | awk '{print $2}'"
-    register: nord_status
+    changed_when: false
+    register: nord_status_post
+
 
-  - name: "NordVPN Endpoint"
+  - name: "Display VPN Endpoint Change"
     debug:
-      msg: "{{ nord_status.stdout }}"
+      msg: "{{ nord_status_pre.stdout }} -> {{ nord_status_post.stdout }}"
 
 #  - name: Select random NordVPN Endpoint
 #    ansible.builtin.set_fact: