From 8bfcc4c15d1d7f637bf2a565b3e86655b8b9c5fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Mass=C3=A9?= Date: Thu, 7 Dec 2017 17:25:38 +0100 Subject: [PATCH] clean up unwanted image streams and import the rhel image streams --- ...sion-global-templates-and-imagestreams.yml | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/playbooks/provision-global-templates-and-imagestreams.yml b/playbooks/provision-global-templates-and-imagestreams.yml index 1739225..cee2db1 100644 --- a/playbooks/provision-global-templates-and-imagestreams.yml +++ b/playbooks/provision-global-templates-and-imagestreams.yml @@ -66,6 +66,30 @@ when: item|regex_search('-ephemeral$') with_items: '{{ oc_get_templates.stdout_lines }}' + - name: Get a list of currently installed image streams + command: oc get is -n openshift -o name + register: oc_get_is + + - name: Delete unwanted image streams + command: oc delete {{ item }} -n openshift + when: item|regex_search('(datagrid|datavirt|decisionserver|eap64|processserver|tomcat7)') + with_items: '{{ oc_get_is.stdout_lines }}' + + - name: Get a list of the remaining image streams + command: oc get is -n openshift -o name + register: oc_get_is + + - name: Update each image stream + command: oc import-image {{ item }} --confirm --scheduled --all -n openshift + with_items: '{{ oc_get_is.stdout_lines }}' + + - name: Import additional Red Hat image streams + command: oc import-image -n openshift {{ item.key }} --from {{ item.value }} --confirm --scheduled --all + with_dict: + rhel-atomic: rhel-atomic + rhel: rhel7.4 + when: '(''imagestreams/'' ~ item.key) not in oc_get_is.stdout_lines' + - name: Delete the temporary directory file: path: '{{ tempfile.path }}'