Skip to content

Commit

Permalink
Use ansible_service_mgr fact
Browse files Browse the repository at this point in the history
This patch removes some extra tasks for detecting systemd and uses
the `ansible_service_mgr` fact instead.

Partial-Bug: #1640125
Change-Id: I1a30b79a759057afb74f24f2239f474b60c1db35
  • Loading branch information
logan2211 committed Nov 12, 2016
1 parent 909fe09 commit 714b846
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
2 changes: 1 addition & 1 deletion handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
- name: Reload the systemd daemon
command: "systemctl daemon-reload"
when:
- pid1_name == "systemd"
- ansible_service_mgr == 'systemd'

- name: Restart mysql
service:
Expand Down
6 changes: 3 additions & 3 deletions tasks/galera_post_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
src: "upstart.limits.conf.j2"
dest: "/etc/security/limits.conf"
when:
- pid1_name != "systemd"
- ansible_service_mgr == 'systemd'
notify:
- Restart mysql
tags:
Expand All @@ -102,15 +102,15 @@
owner: "root"
mode: "0755"
when:
- pid1_name == "systemd"
- ansible_service_mgr == 'systemd'

- name: Apply resource limits (systemd)
template:
src: "systemd.limits.conf.j2"
dest: "/etc/systemd/system/mariadb.service.d/limits.conf"
mode: "0644"
when:
- pid1_name == "systemd"
- ansible_service_mgr == 'systemd'
notify:
- Reload the systemd daemon
- Restart mysql
Expand Down
13 changes: 0 additions & 13 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,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: galera_upgrade_check.yml
- include: galera_cluster_state.yml
- include: galera_pre_install.yml
Expand Down

0 comments on commit 714b846

Please sign in to comment.