sync.yml 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. ---
  2. - name: Ensure project exists
  3. oc_project:
  4. name: openshift-node
  5. state: present
  6. node_selector:
  7. - ""
  8. - name: Make temp directory for templates
  9. command: mktemp -d /tmp/ansible-XXXXXX
  10. register: mktemp
  11. changed_when: False
  12. - name: Copy templates to temp directory
  13. copy:
  14. src: "{{ item }}"
  15. dest: "{{ mktemp.stdout }}/{{ item | basename }}"
  16. with_fileglob:
  17. - "files/*.yaml"
  18. - name: Update the image tag
  19. yedit:
  20. src: "{{ mktemp.stdout }}/sync-images.yaml"
  21. key: 'tag.from.name'
  22. value: "{{ osn_image }}"
  23. - name: Ensure the service account can run privileged
  24. oc_adm_policy_user:
  25. namespace: "openshift-node"
  26. resource_kind: scc
  27. resource_name: privileged
  28. state: present
  29. user: "system:serviceaccount:openshift-node:sync"
  30. # TODO: temporary until we fix apply for image stream tags
  31. - name: Remove the image stream tag
  32. shell: >
  33. {{ openshift_client_binary }} delete -n openshift-node istag node:v3.10 --ignore-not-found
  34. - name: Apply the config
  35. shell: >
  36. {{ openshift_client_binary }} apply -f {{ mktemp.stdout }}
  37. - name: Remove temp directory
  38. file:
  39. state: absent
  40. name: "{{ mktemp.stdout }}"
  41. changed_when: False