main.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. ---
  2. - name: add a sa
  3. oc_serviceaccount:
  4. name: "{{ openshift_daemonset_config_sa_name }}"
  5. namespace: "{{ openshift_daemonset_config_namespace }}"
  6. - name: add sa to privileged scc
  7. oc_adm_policy_user:
  8. namespace: "{{ openshift_daemonset_config_namespace }}"
  9. resource_kind: scc
  10. resource_name: privileged
  11. state: present
  12. user: "system:serviceaccount:{{ openshift_daemonset_config_namespace }}:{{ openshift_daemonset_config_sa_name }}"
  13. - name: copy template to disk
  14. template:
  15. dest: "/tmp/{{ item.name }}"
  16. src: "{{ item.name }}.j2"
  17. with_items:
  18. - name: daemonset.yml
  19. - name: copy files to disk
  20. copy:
  21. src: "{{ item.key }}"
  22. dest: "{{ item.value }}"
  23. with_dict: "{{ openshift_daemonset_config_configmap_files }}"
  24. - name: create the namespace
  25. oc_project:
  26. state: present
  27. name: "{{ openshift_daemonset_config_namespace }}"
  28. - name: lay down secrets
  29. oc_secret:
  30. state: present
  31. name: "{{ openshift_daemonset_config_secret_name }}"
  32. namespace: "{{ openshift_daemonset_config_namespace }}"
  33. delete_after: true
  34. contents: "{{ openshift_daemonset_config_secrets }}"
  35. when:
  36. - openshift_daemonset_config_secrets != {}
  37. - name: create the configmap
  38. oc_configmap:
  39. state: present
  40. name: "{{ openshift_daemonset_config_configmap_name }}"
  41. namespace: "{{ openshift_daemonset_config_namespace }}"
  42. from_literal: "{{ openshift_daemonset_config_configmap_literals }}"
  43. from_file: "{{ openshift_daemonset_config_configmap_files }}"
  44. - name: deploy daemonset
  45. oc_obj:
  46. state: present
  47. namespace: "{{ openshift_daemonset_config_namespace }}" # openshift-node??
  48. name: "{{ openshift_daemonset_config_daemonset_name }}"
  49. kind: daemonset
  50. files:
  51. - /tmp/daemonset.yml