From 68e8cc68544d08988b01193e1049ea415b6e5c1c Mon Sep 17 00:00:00 2001 From: Logan V Date: Wed, 9 Nov 2016 22:52:25 -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: I213b38b166de724990958a316e577478d7e4823c --- tasks/main.yml | 13 ------------- tasks/repo_post_install.yml | 4 ++-- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 144b814..0efd934 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 - - include: repo_pre_install.yml - include: repo_install.yml - include: repo_post_install.yml diff --git a/tasks/repo_post_install.yml b/tasks/repo_post_install.yml index a188978..a3ff76b 100644 --- a/tasks/repo_post_install.yml +++ b/tasks/repo_post_install.yml @@ -151,7 +151,7 @@ owner: "root" group: "root" when: - - pid1_name == "init" + - ansible_service_mgr == 'upstart' - ansible_distribution == "Ubuntu" notify: - Init reload @@ -170,7 +170,7 @@ - { src: "git.service.j2", dest: "/lib/systemd/system/git@.service" } - { src: "git.socket.j2", dest: "/lib/systemd/system/git.socket" } when: - - pid1_name == "systemd" + - ansible_service_mgr == 'systemd' notify: - reload git socket tags: