From 313c531f27ec93d8d06bb37d356a907723122b15 Mon Sep 17 00:00:00 2001 From: Logan V Date: Wed, 9 Nov 2016 22:48:14 -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: I6f3d383444fd6c6193217d22b21511ec81d5a5ec --- tasks/main.yml | 13 ------------- tasks/sahara_init_common.yml | 6 ++++-- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index ac36e2c..96b5983 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -20,19 +20,6 @@ tags: - always -- name: Check init system - command: cat /proc/1/comm - register: _pid1_name - changed_when: false - tags: - - always - -- name: Set the name of pid1 - set_fact: - pid1_name: "{{ _pid1_name.stdout }}" - tags: - - always - - include: sahara_pre_install.yml tags: - sahara-install diff --git a/tasks/sahara_init_common.yml b/tasks/sahara_init_common.yml index 6263959..ebbc526 100644 --- a/tasks/sahara_init_common.yml +++ b/tasks/sahara_init_common.yml @@ -13,11 +13,13 @@ - include: sahara_init_upstart.yml static: no - when: pid1_name == "init" + when: + - ansible_service_mgr == 'upstart' - include: sahara_init_systemd.yml static: no - when: pid1_name == "systemd" + when: + - ansible_service_mgr == 'systemd' - name: Load service service: