forked from infra/ansible
feat: add handler in openshift/clustr for applying changes
Signed-off-by: Vít Smolík <me@smoliicek.cz>
This commit is contained in:
parent
4392472669
commit
08928917e6
2 changed files with 10 additions and 32 deletions
7
roles/openshift/cluster/main.yaml
Normal file
7
roles/openshift/cluster/main.yaml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
- name: Apply changes to openshift
|
||||
ansible.builtin.command: "oc apply --validate=strict -f {{ cluster_filepath }}/{{ item }}"
|
||||
loop: "{{ base_templates + (stg_templates if env == 'staging' else []) }}"
|
||||
changed_when: true
|
||||
tags:
|
||||
- create-resources
|
||||
|
|
@ -23,42 +23,13 @@
|
|||
- sysadmin-openshift-readonly-group.yml
|
||||
|
||||
# generate the templates for project to be created
|
||||
- name: Copy tempaltes to production
|
||||
- name: Copy templates
|
||||
ansible.builtin.template:
|
||||
src: "{{ item }}.j2"
|
||||
dest: "{{ cluster_filepath }}/{{ item }}"
|
||||
mode: "0640"
|
||||
with_items:
|
||||
- sysadmin-openshift-group.yml
|
||||
- sysadmin-openshift-rolebinding.yml
|
||||
- webhooks-clusterrolebinding.yml
|
||||
- forward-logs-to-log01.yml
|
||||
with_items: "{{ base_templates + (stg_templates if env == 'staging' else []) }}"
|
||||
register: cluster_template_result
|
||||
when: env == 'production'
|
||||
|
||||
|
||||
- name: Copy templates to staging
|
||||
ansible.builtin.template:
|
||||
src: "{{ item }}.j2"
|
||||
dest: "{{ cluster_filepath }}/{{ item }}"
|
||||
mode: "0640"
|
||||
with_items:
|
||||
- sysadmin-openshift-group.yml
|
||||
- sysadmin-openshift-rolebinding.yml
|
||||
- webhooks-clusterrolebinding.yml
|
||||
- forward-logs-to-log01.yml
|
||||
- sysadmin-readonly-group.yml
|
||||
- sysadmin-readonly-rolebinding.yml
|
||||
- sysadmin-readonly-role.yml
|
||||
register: cluster_template_result
|
||||
when: env == 'staging'
|
||||
|
||||
|
||||
# apply created openshift resources
|
||||
- name: Oc apply resources
|
||||
ansible.builtin.command: "oc apply --validate=strict -f {{ item.dest }}"
|
||||
with_items: "{{ cluster_template_result.results }}"
|
||||
when: item.changed
|
||||
changed_when: true
|
||||
notify: Apply changes to openshift
|
||||
tags:
|
||||
- create-resources
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue