communishift: Added task for creating Openshift Role, RoleBindings

Signed-off-by: David Kirwan <dkirwan@redhat.com>
Signed-off-by: Lenka Segura <lsegura@redhat.com>
Signed-off-by: Patrik Polakovic <ppolakov@redhat.com>
This commit is contained in:
David Kirwan 2022-08-22 12:06:36 +01:00
parent d66d362cb0
commit ccafc89498
3 changed files with 61 additions and 0 deletions

View file

@ -0,0 +1,40 @@
---
- name: Create a k8s RoleBinding for group namespace permissions
community.okd.k8s:
api_key: "{{ communishift_ocp_api_token }}"
host: "{{ communishift_ocp_api_host }}"
state: present
definition:
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: "{{ communishift_project_name }}-group-rolebinding"
namespace: "{{ communishift_project_name }}"
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: admin
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: Group
name: "{{ communishift_project_name }}-admins"
- name: Create a k8s RoleBinding for storage permissions
community.okd.k8s:
api_key: "{{ communishift_ocp_api_token }}"
host: "{{ communishift_ocp_api_host }}"
state: present
definition:
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: "{{ communishift_project_name }}-efs-rolebinding"
namespace: "{{ communishift_project_name }}"
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: "{{ communishift_project_name }}-efs-role"
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: Group
name: "{{ communishift_project_name }}-admins"

View file

@ -0,0 +1,19 @@
---
- name: Create a k8s Role
community.okd.k8s:
api_key: "{{ communishift_ocp_api_token }}"
host: "{{ communishift_ocp_api_host }}"
state: present
definition:
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: "{{ communishift_project_name }}-efs-role"
namespace: "{{ communishift_project_name }}"
rules:
- apiGroups:
- aws-efs.managed.openshift.io
resources:
- '*'
verbs:
- '*'

View file

@ -9,3 +9,5 @@
- include_tasks: create-group.yml
- include_tasks: create-efs.yml
- include_tasks: create-efs-secret.yml
- include_tasks: create-role.yml
- include_tasks: create-role-binding.yml