oc_apply.yaml 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. ---
  2. - name: Checking generation of {{file_content.kind}} {{file_content.metadata.name}}
  3. command: >
  4. {{ openshift_client_binary }}
  5. --config={{ kubeconfig }}
  6. get {{file_content.kind}} {{file_content.metadata.name}}
  7. -o jsonpath='{.metadata.resourceVersion}'
  8. -n {{namespace}}
  9. register: generation_init
  10. failed_when: false
  11. changed_when: no
  12. - name: Applying {{file_name}}
  13. command: >
  14. {{ openshift_client_binary }} --config={{ kubeconfig }}
  15. apply -f {{ file_name }}
  16. -n {{namespace}}
  17. register: generation_apply
  18. failed_when: "'error' in generation_apply.stderr"
  19. changed_when: no
  20. - name: Determine change status of {{file_content.kind}} {{file_content.metadata.name}}
  21. command: >
  22. {{ openshift_client_binary }} --config={{ kubeconfig }}
  23. get {{file_content.kind}} {{file_content.metadata.name}}
  24. -o jsonpath='{.metadata.resourceVersion}'
  25. -n {{namespace}}
  26. register: version_changed
  27. vars:
  28. init_version: "{{ (generation_init is defined) | ternary(generation_init.stdout, '0') }}"
  29. failed_when: "'error' in version_changed.stderr"
  30. changed_when: version_changed.stdout | int > init_version | int