serviceaccount.yaml 979 B

12345678910111213141516171819202122232425262728293031
  1. ---
  2. - name: Create Controller service account
  3. oc_serviceaccount:
  4. name: kuryr-controller
  5. namespace: "{{ kuryr_namespace }}"
  6. register: saout
  7. - name: Create a role for the Kuryr
  8. oc_clusterrole: "{{ kuryr_clusterrole }}"
  9. - name: Fetch the created Kuryr controller cluster role
  10. oc_clusterrole:
  11. name: kuryrctl
  12. state: list
  13. register: crout
  14. - name: Grant Kuryr the privileged security context constraints
  15. oc_adm_policy_user:
  16. user: "system:serviceaccount:{{ kuryr_namespace }}:{{ saout.results.results.0.metadata.name }}"
  17. namespace: "{{ kuryr_namespace }}"
  18. resource_kind: scc
  19. resource_name: privileged
  20. state: present
  21. - name: Assign role to Kuryr service account
  22. oc_adm_policy_user:
  23. user: "system:serviceaccount:{{ kuryr_namespace }}:{{ saout.results.results.0.metadata.name }}"
  24. namespace: "{{ kuryr_namespace }}"
  25. resource_kind: cluster-role
  26. resource_name: "{{ crout.results.results.metadata.name }}"
  27. state: present