diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2017-01-18 14:01:26 +0100 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2017-02-10 10:53:44 +0100 |
commit | daa54ed6ced6aac872f9712c17eb0be97b3fe59b (patch) | |
tree | e7a73b221e4482db8cd2d62e4a8d999888e5195e /roles | |
parent | 595f0f307aeb78de499891f21b99057a6e6b17f0 (diff) | |
download | openshift-daa54ed6ced6aac872f9712c17eb0be97b3fe59b.tar.gz openshift-daa54ed6ced6aac872f9712c17eb0be97b3fe59b.tar.bz2 openshift-daa54ed6ced6aac872f9712c17eb0be97b3fe59b.tar.xz openshift-daa54ed6ced6aac872f9712c17eb0be97b3fe59b.zip |
system-containers: implement idempotent update
Upstream version has "atomic containers update ..." but the RHEL
version is still using "atomic update --container" so stick with this
for now.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'roles')
-rw-r--r-- | roles/openshift_master/tasks/system_container.yml | 23 | ||||
-rw-r--r-- | roles/openshift_node/tasks/node_system_container.yml | 19 | ||||
-rw-r--r-- | roles/openshift_node/tasks/openvswitch_system_container.yml | 23 |
3 files changed, 58 insertions, 7 deletions
diff --git a/roles/openshift_master/tasks/system_container.yml b/roles/openshift_master/tasks/system_container.yml index 25c179e71..e3e3d7948 100644 --- a/roles/openshift_master/tasks/system_container.yml +++ b/roles/openshift_master/tasks/system_container.yml @@ -5,13 +5,32 @@ register: pull_result changed_when: "'Pulling layer' in pull_result.stdout" +- name: Check Master system container package + command: > + atomic containers list --no-trunc -a -f container={{ openshift.common.service_type }}-master + register: result + +- name: Update Master system container package + command: > + atomic containers update {{ openshift.common.service_type }}-master + register: update_result + changed_when: "'Extracting' in update_result.stdout" + when: + - ("master" in result.stdout) + - (openshift.common.version is defined) and (openshift.common.version == openshift_version) | bool + - name: Uninstall Master system container package command: > atomic uninstall {{ openshift.common.service_type }}-master failed_when: False - when: openshift.common.version != openshift_version + when: + - ("master" in result.stdout) + - (openshift.common.version is not defined) or (openshift.common.version != openshift_version) | bool - name: Install Master system container package command: > atomic install --system --name={{ openshift.common.service_type }}-master {{ openshift.common.system_images_registry }}/{{ openshift.master.master_system_image }}:{{ openshift_image_tag }} - when: openshift.common.version != openshift_version + when: + - (openshift.common.version is not defined) or (openshift.common.version != openshift_version) or ("master" not in result.stdout) | bool + notify: + - restart master diff --git a/roles/openshift_node/tasks/node_system_container.yml b/roles/openshift_node/tasks/node_system_container.yml index 759792b8b..01e2d33c7 100644 --- a/roles/openshift_node/tasks/node_system_container.yml +++ b/roles/openshift_node/tasks/node_system_container.yml @@ -5,15 +5,30 @@ register: pull_result changed_when: "'Pulling layer' in pull_result.stdout" +- name: Check Node system container package + command: > + atomic containers list --no-trunc -a -f container={{ openshift.common.service_type }}-node + register: result + +- name: Update Node system container package + command: > + atomic containers update {{ openshift.common.service_type }}-node + register: update_result + changed_when: "'Extracting' in update_result.stdout" + when: + - (openshift.common.version is defined) and (openshift.common.version == openshift_version) and ("node" in result.stdout) | bool + - name: Uninstall Node system container package command: > atomic uninstall {{ openshift.common.service_type }}-node failed_when: False - when: openshift.common.version != openshift_version | bool + when: + - (openshift.common.version is not defined) or (openshift.common.version != openshift_version) and ("node" in result.stdout) | bool - name: Install Node system container package command: > atomic install --system --name={{ openshift.common.service_type }}-node {{ openshift.common.system_images_registry }}/{{ openshift.node.node_system_image }}:{{ openshift_image_tag }} register: install_node_result changed_when: "'Extracting' in pull_result.stdout" - when: openshift.common.version != openshift_version | bool + when: + - (openshift.common.version is not defined) or (openshift.common.version != openshift_version) or ("node" not in result.stdout) | bool diff --git a/roles/openshift_node/tasks/openvswitch_system_container.yml b/roles/openshift_node/tasks/openvswitch_system_container.yml index 12d62be69..47fac99eb 100644 --- a/roles/openshift_node/tasks/openvswitch_system_container.yml +++ b/roles/openshift_node/tasks/openvswitch_system_container.yml @@ -5,15 +5,32 @@ register: pull_result changed_when: "'Pulling layer' in pull_result.stdout" +- name: Check OpenvSwitch system container package + command: > + atomic containers list --no-trunc -a -f container=openvswitch + register: result + when: + - openshift.common.is_openvswitch_system_container | bool + +- name: Update OpenvSwitch system container package + command: > + atomic containers update openvswitch + register: update_result + changed_when: "'Extracting' in update_result.stdout" + when: + - (openshift.common.version is defined) and (openshift.common.version == openshift_version) and ("openvswitch" in result.stdout) | bool + - name: Uninstall OpenvSwitch system container package command: > atomic uninstall openvswitch failed_when: False - when: openshift.common.version != openshift_version | bool + when: + - (openshift.common.version is not defined) or (openshift.common.version != openshift_version) and ("openvswitch" in result.stdout) | bool - name: Install OpenvSwitch system container package command: > atomic install --system --name=openvswitch {{ openshift.common.system_images_registry }}/{{ openshift.node.ovs_system_image }}:{{ openshift_image_tag }} - when: openshift.common.version != openshift_version | bool + when: + - (openshift.common.version is not defined) or (openshift.common.version != openshift_version) or ("openvswitch" not in result.stdout) | bool notify: - - restart docker + - restart docker |