main.yml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. ---
  2. - include_tasks: certs.yml
  3. - name: Calico Master | oc adm policy add-scc-to-user privileged system:serviceaccount:kube-system:calico-node
  4. oc_adm_policy_user:
  5. user: system:serviceaccount:kube-system:calico-node
  6. resource_kind: scc
  7. resource_name: privileged
  8. state: present
  9. - name: Calico Master | oc adm policy add-scc-to-user privileged system:serviceaccount:kube-system:calico-kube-controllers
  10. oc_adm_policy_user:
  11. user: system:serviceaccount:kube-system:calico-kube-controllers
  12. resource_kind: scc
  13. resource_name: privileged
  14. state: present
  15. - name: Calico Master | Create temp directory
  16. command: mktemp -d /tmp/openshift-ansible-XXXXXXX
  17. register: mktemp
  18. changed_when: False
  19. - name: Calico Master | Write Calico
  20. template:
  21. dest: "{{ mktemp.stdout }}/calico.yml"
  22. src: calico.yml.j2
  23. - name: Calico Master | Launch Calico
  24. command: >
  25. {{ openshift_client_binary }} create
  26. -f {{ mktemp.stdout }}/calico.yml
  27. --config={{ openshift.common.config_base }}/master/admin.kubeconfig
  28. register: calico_create_output
  29. failed_when: "('already exists' not in calico_create_output.stderr) and ('created' not in calico_create_output.stdout) and calico_create_output.rc != 0"
  30. changed_when: ('created' in calico_create_output.stdout)
  31. - name: Calico Master | Delete temp directory
  32. file:
  33. name: "{{ mktemp.stdout }}"
  34. state: absent
  35. changed_when: False