From 48d0a43a6f7957913607443ca622ba359b9b4db3 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 30 May 2016 14:29:50 -0300 Subject: Fix error with stopping services that may not exist. Causes a hard failure due to missing etcd/atomic-openshift-master services. Instead, check that the services exist before ensuring they're stopped/disabled. --- roles/etcd/tasks/main.yml | 12 ++++++------ roles/openshift_master/tasks/main.yml | 9 +++++++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/roles/etcd/tasks/main.yml b/roles/etcd/tasks/main.yml index a798dc973..71735dc25 100644 --- a/roles/etcd/tasks/main.yml +++ b/roles/etcd/tasks/main.yml @@ -28,18 +28,18 @@ state: directory mode: 0700 +- name: Check for etcd service presence + command: systemctl show etcd.service + register: etcd_show + changed_when: false + - name: Disable system etcd when containerized - when: etcd_is_containerized | bool + when: etcd_is_containerized | bool and 'LoadState=not-found' not in etcd_show.stdout service: name: etcd state: stopped enabled: no -- name: Check for etcd service presence - command: systemctl show etcd.service - register: etcd_show - changed_when: false - - name: Mask system etcd when containerized when: etcd_is_containerized | bool and 'LoadState=not-found' not in etcd_show.stdout command: systemctl mask etcd diff --git a/roles/openshift_master/tasks/main.yml b/roles/openshift_master/tasks/main.yml index 63a54a0d9..f70eaf144 100644 --- a/roles/openshift_master/tasks/main.yml +++ b/roles/openshift_master/tasks/main.yml @@ -164,9 +164,14 @@ register: start_result notify: Verify API Server -- name: Stop and disable non HA master when running HA +- name: Check for non-HA master service presence + command: systemctl show {{ openshift.common.service_type }}-master.service + register: master_svc_show + changed_when: false + +- name: Stop and disable non-HA master when running HA service: name={{ openshift.common.service_type }}-master enabled=no state=stopped - when: openshift_master_ha | bool + when: openshift_master_ha | bool and 'LoadState=not-found' not in master_svc_show.stdout - set_fact: master_service_status_changed: "{{ start_result | changed }}" -- cgit v1.2.3