Use ansible_service_mgr fact

This patch removes some extra tasks for detecting systemd and uses
the `ansible_service_mgr` fact instead.

Partial-Bug: #1640125
Change-Id: I82e3284b1d46d32ec28502ac4fe1a322316ca019
(cherry picked from commit bfce0b8a60)
This commit is contained in:
Logan V 2016-11-09 22:31:18 -06:00 committed by Jesse Pretorius
parent 75fd7d7f80
commit 79dfd96a4c
3 changed files with 4 additions and 16 deletions

View File

@ -16,7 +16,7 @@
- name: Reload the systemd daemon
command: "systemctl daemon-reload"
when:
- pid1_name == "systemd"
- ansible_service_mgr == 'systemd'
- name: Restart memcached
service:

View File

@ -24,18 +24,6 @@
tags:
- always
- name: Check init system
command: cat /proc/1/comm
register: _pid1_name
tags:
- always
- name: Set the name of pid1
set_fact:
pid1_name: "{{ _pid1_name.stdout }}"
tags:
- always
- include: memcached_install.yml
tags:
- memcached-install

View File

@ -48,7 +48,7 @@
owner: "root"
mode: "0755"
when:
- pid1_name == "systemd"
- ansible_service_mgr == 'systemd'
- name: Apply resource limits (upstart)
template:
@ -59,7 +59,7 @@
mode: "0644"
when:
- ansible_pkg_mgr == 'apt'
- pid1_name != "systemd"
- ansible_service_mgr != 'systemd'
- memcached_connections > 1024
notify: Restart memcached
@ -71,7 +71,7 @@
group: "root"
mode: "0644"
when:
- pid1_name == "systemd"
- ansible_service_mgr == 'systemd'
- memcached_connections > 1024
notify:
- Reload the systemd daemon