From 7a05132ccc6794ce2708b55ef8837a65805a7bbc Mon Sep 17 00:00:00 2001 From: Logan V Date: Wed, 9 Nov 2016 22:46:03 -0600 Subject: [PATCH] Use ansible_service_mgr fact This patch removes some extra tasks for detecting systemd and uses the fact instead. Partial-Bug: #1640125 Change-Id: Ic7ca1603681bf7837e7bf5945c8859b2830bbe74 --- tasks/main.yml | 13 ------------- tasks/neutron_init_common.yml | 6 ++++-- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 78eb6a9f..dfc9f537 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -24,19 +24,6 @@ tags: - always -- name: Check init system - command: cat /proc/1/comm - changed_when: false - register: _pid1_name - tags: - - always - -- name: Set the name of pid1 - set_fact: - pid1_name: "{{ _pid1_name.stdout }}" - tags: - - always - - name: Get CPU info content and store as var command: cat /proc/cpuinfo register: cpuinfo_contents diff --git a/tasks/neutron_init_common.yml b/tasks/neutron_init_common.yml index b1e676fc..1f03b126 100644 --- a/tasks/neutron_init_common.yml +++ b/tasks/neutron_init_common.yml @@ -14,10 +14,12 @@ # limitations under the License. - include: neutron_init_upstart.yml - when: pid1_name == "init" + when: + - ansible_service_mgr == 'upstart' - include: neutron_init_systemd.yml - when: pid1_name == "systemd" + when: + - ansible_service_mgr == 'systemd' - name: Load service service: