main.yml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. ---
  2. - name: Ensure project exists
  3. oc_project:
  4. name: openshift-sdn
  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. when:
  19. - not ((item | basename == 'sdn-ovs.yaml') and openshift_use_external_openvswitch)
  20. - name: Update the image tag
  21. yedit:
  22. src: "{{ mktemp.stdout }}/sdn-images.yaml"
  23. key: 'tag.from.name'
  24. value: "{{ osn_image }}"
  25. - name: Ensure the service account can run privileged
  26. oc_adm_policy_user:
  27. namespace: "openshift-sdn"
  28. resource_kind: scc
  29. resource_name: privileged
  30. state: present
  31. user: "system:serviceaccount:openshift-sdn:sdn"
  32. # TODO: temporary until we fix apply for image stream tags
  33. - name: Remove the image stream tag
  34. shell: >
  35. {{ openshift_client_binary }} --config={{ openshift.common.config_base }}/master/admin.kubeconfig delete -n openshift-sdn istag node:v3.10 --ignore-not-found
  36. - name: Apply the config
  37. shell: >
  38. {{ openshift_client_binary }} --config={{ openshift.common.config_base }}/master/admin.kubeconfig apply -f "{{ mktemp.stdout }}"
  39. - name: Remove temp directory
  40. file:
  41. state: absent
  42. name: "{{ mktemp.stdout }}"
  43. changed_when: False