Explorar el Código

properly checking conditions

Grega Bremec hace 3 años
padre
commit
039b921b3c
Se han modificado 1 ficheros con 6 adiciones y 2 borrados
  1. 6 2
      roles/fix-policies/tasks/main.yml

+ 6 - 2
roles/fix-policies/tasks/main.yml

@@ -76,13 +76,17 @@
   file:
     path: "{{ ansible_facts['user_dir'] }}/roxctl-token"
     state: absent
-  when: symlink_token is defined
+  when:
+    - symlink_token is defined
+    - not symlink_token.skipped
 
 - name: Clean up policy symlink
   file:
     path: "{{ ansible_facts['user_dir'] }}/policyexport"
     state: absent
-  when: symlink_policies is defined
+  when:
+    - symlink_policies is defined
+    - not symlink_policies.skipped
 
 # Get a list of policies:
 # curl -ks -H "Authorization: Bearer $(cat roxctl-token)" -XGET https://central-rhacs.apps.ocp4.example.com/v1/policies | jq -r '[ .policies[].id ]'