Use systemd module instead of command

This patch changes the use of systemctl via the command module
over to the Ansible systemd module.

One conditional check for systemd was removed since all supported
distributions deployed by OSA have systemd.

Change-Id: I926e94d185f4999e13b33f7d035b9dd5cf732f0b
(cherry picked from commit ad29910e6c)
This commit is contained in:
Major Hayden 2018-02-15 08:06:03 -06:00
parent 1e1423cc17
commit 3efb93302f
No known key found for this signature in database
GPG Key ID: 737051E0C1011FB1
3 changed files with 6 additions and 13 deletions

View File

@ -95,7 +95,8 @@
- rabbitmq-config
- name: Reload the systemd daemon
command: "systemctl daemon-reload"
systemd:
daemon_reload: yes
when:
- rabbitmq_server_service_added | changed
tags:

View File

@ -22,17 +22,15 @@
- rabbitmq_server-install
- name: Reload the systemd daemon
command: "systemctl daemon-reload"
systemd:
daemon_reload: yes
when:
- install_rabbitmq | changed
- ansible_service_mgr == 'systemd'
tags:
- rabbitmq-apt-packages
- rabbitmq-yum-packages
- rabbimtq-zypper-packages
- rabbitmq_server-install
# Avoid ANSIBLE0006 systemctl used in place of systemd module issue
- skip_ansible_lint
- name: Ensure there are no policy-rc files
file:

View File

@ -42,8 +42,6 @@
group: "root"
owner: "root"
mode: "0755"
when:
- ansible_service_mgr == 'systemd'
tags:
- rabbitmq-config
@ -64,8 +62,6 @@
src: "limits.conf.j2"
dest: "/etc/systemd/system/rabbitmq-server.service.d/limits.conf"
register: rabbit_resource_limit
when:
- ansible_service_mgr == 'systemd'
tags:
- rabbitmq-config
@ -74,15 +70,13 @@
src: systemd-restart-on-failure.conf.j2
dest: "/etc/systemd/system/rabbitmq-server.service.d/systemd-restart-on-failure.conf"
register: rabbit_restart_on_failure
when:
- ansible_service_mgr == 'systemd'
tags:
- rabbitmq-config
- name: Reload the systemd daemon
command: "systemctl daemon-reload"
systemd:
daemon_reload: yes
when:
- ansible_service_mgr == 'systemd'
- rabbit_resource_limit | changed
- rabbit_restart_on_failure | changed
tags: