From eb81692a6ff469357af430e478b5ad0f38167029 Mon Sep 17 00:00:00 2001 From: Mathieu Bultel Date: Thu, 14 Nov 2019 15:02:37 +0100 Subject: [PATCH] Check if snmpd is enabled for upgrade_tasks This check should prevent some error when the upgrade tasks checks if the snmpd is stopped in step 1 Related-Bug: #1896248 Change-Id: Ifa03f397567d58660a6554bced9cc7191b5b369d (cherry picked from commit 709a6b78bbe3ed181ab53b6055964c8b4332946d) --- puppet/services/snmp.yaml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/puppet/services/snmp.yaml b/puppet/services/snmp.yaml index f8a8b9829b..33e1aa2962 100644 --- a/puppet/services/snmp.yaml +++ b/puppet/services/snmp.yaml @@ -83,6 +83,17 @@ outputs: step_config: | include ::tripleo::profile::base::snmp upgrade_tasks: + - when: step|int == 0 + block: + - name: Check if snmpd is enabled + command: systemctl is-enabled --quiet snmpd + ignore_errors: True + register: snmpd_enabled_result + - name: Set fact snmpd_enabled + set_fact: + snmpd_enabled: "{{ snmpd_enabled_result.rc == 0 }}" - name: Stop snmp service - when: step|int == 1 + when: + - step|int == 1 + - snmpd_enabled|bool service: name=snmpd state=stopped