diff --git a/handlers/main.yml b/handlers/main.yml index 68cc747..0279006 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -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: diff --git a/tasks/main.yml b/tasks/main.yml index ac32372..a384b97 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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 diff --git a/tasks/memcached_config.yml b/tasks/memcached_config.yml index 67f489a..cebad26 100644 --- a/tasks/memcached_config.yml +++ b/tasks/memcached_config.yml @@ -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