summaryrefslogtreecommitdiffstats
path: root/roles/kuryr/tasks/serviceaccount.yaml
blob: 088f130910c98cda785ad81f5a19a1e227e4bfba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
---
- name: Create Controller service account
  oc_serviceaccount:
    name: kuryr-controller
    namespace: "{{ kuryr_namespace }}"
  register: saout

- name: Create a role for the Kuryr
  oc_clusterrole: "{{ kuryr_clusterrole }}"

- name: Fetch the created Kuryr controller cluster role
  oc_clusterrole:
    name: kuryrctl
    state: list
  register: crout

- name: Grant Kuryr the privileged security context constraints
  oc_adm_policy_user:
    user: "system:serviceaccount:{{ kuryr_namespace }}:{{ saout.results.results.0.metadata.name }}"
    namespace: "{{ kuryr_namespace }}"
    resource_kind: scc
    resource_name: privileged
    state: present

- name: Assign role to Kuryr service account
  oc_adm_policy_user:
    user: "system:serviceaccount:{{ kuryr_namespace }}:{{ saout.results.results.0.metadata.name }}"
    namespace: "{{ kuryr_namespace }}"
    resource_kind: cluster-role
    resource_name: "{{ crout.results.results.metadata.name }}"
    state: present