From 466f6f35b7057746a6f1625d8b94adb958557d95 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Fri, 29 Sep 2017 14:54:00 +0200 Subject: [PATCH] Use systemd module instead of service. Using systemd module allows us to do in one task what we did in three tasks: - enable unit file, - issue a `daemon-reload`, - start the service Signed-off-by: Guillaume Abrioux --- roles/ceph-mds/tasks/docker/start_docker_mds.yml | 13 ++----------- roles/ceph-mgr/tasks/docker/start_docker_mgr.yml | 13 ++----------- .../ceph-mon/tasks/docker/start_docker_monitor.yml | 13 ++----------- roles/ceph-osd/tasks/docker/start_docker_osd.yml | 12 ++---------- .../tasks/docker/start_docker_rbd_mirror.yml | 13 ++----------- 5 files changed, 10 insertions(+), 54 deletions(-) diff --git a/roles/ceph-mds/tasks/docker/start_docker_mds.yml b/roles/ceph-mds/tasks/docker/start_docker_mds.yml index b6643aa1c..3f69c8cb2 100644 --- a/roles/ceph-mds/tasks/docker/start_docker_mds.yml +++ b/roles/ceph-mds/tasks/docker/start_docker_mds.yml @@ -8,19 +8,10 @@ group: "root" mode: "0644" -- name: enable systemd unit file for mds instance - shell: systemctl enable ceph-mds@{{ ansible_hostname }}.service - failed_when: false - changed_when: false - -- name: reload systemd unit files - shell: systemctl daemon-reload - changed_when: false - failed_when: false - - name: systemd start mds container - service: + systemd: name: ceph-mds@{{ ansible_hostname }} state: started enabled: yes + daemon_reload: yes changed_when: false diff --git a/roles/ceph-mgr/tasks/docker/start_docker_mgr.yml b/roles/ceph-mgr/tasks/docker/start_docker_mgr.yml index 254de9f46..d7e2af10c 100644 --- a/roles/ceph-mgr/tasks/docker/start_docker_mgr.yml +++ b/roles/ceph-mgr/tasks/docker/start_docker_mgr.yml @@ -8,19 +8,10 @@ group: "root" mode: "0644" -- name: enable systemd unit file for mgr instance - shell: systemctl enable ceph-mgr@{{ ansible_hostname }}.service - failed_when: false - changed_when: false - -- name: reload systemd unit files - shell: systemctl daemon-reload - changed_when: false - failed_when: false - - name: systemd start mgr container - service: + systemd: name: ceph-mgr@{{ ansible_hostname }} state: started enabled: yes + daemon_reload: yes changed_when: false diff --git a/roles/ceph-mon/tasks/docker/start_docker_monitor.yml b/roles/ceph-mon/tasks/docker/start_docker_monitor.yml index 5a7d770ce..851f4207f 100644 --- a/roles/ceph-mon/tasks/docker/start_docker_monitor.yml +++ b/roles/ceph-mon/tasks/docker/start_docker_monitor.yml @@ -49,19 +49,10 @@ group: "root" mode: "0644" -- name: enable systemd unit file for mon instance - shell: systemctl enable ceph-mon@{{ ansible_hostname }}.service - failed_when: false - changed_when: false - -- name: reload systemd unit files - shell: systemctl daemon-reload - changed_when: false - failed_when: false - - name: systemd start mon container - service: + systemd: name: ceph-mon@{{ ansible_hostname }} state: started enabled: yes + daemon_reload: yes changed_when: false diff --git a/roles/ceph-osd/tasks/docker/start_docker_osd.yml b/roles/ceph-osd/tasks/docker/start_docker_osd.yml index bab4e7ce9..ecafcd926 100644 --- a/roles/ceph-osd/tasks/docker/start_docker_osd.yml +++ b/roles/ceph-osd/tasks/docker/start_docker_osd.yml @@ -28,19 +28,11 @@ group: "root" mode: "0644" -- name: enable systemd unit file for osd instance - shell: systemctl enable ceph-osd@{{ item | basename }}.service - changed_when: false - with_items: "{{ devices }}" - -- name: reload systemd unit files - shell: systemctl daemon-reload - changed_when: false - - name: systemd start osd container - service: + systemd: name: ceph-osd@{{ item | basename }} state: started enabled: yes + daemon_reload: yes changed_when: false with_items: "{{ devices }}" diff --git a/roles/ceph-rbd-mirror/tasks/docker/start_docker_rbd_mirror.yml b/roles/ceph-rbd-mirror/tasks/docker/start_docker_rbd_mirror.yml index c86c84c18..7f3eac0d9 100644 --- a/roles/ceph-rbd-mirror/tasks/docker/start_docker_rbd_mirror.yml +++ b/roles/ceph-rbd-mirror/tasks/docker/start_docker_rbd_mirror.yml @@ -9,19 +9,10 @@ group: "root" mode: "0644" -- name: enable systemd unit file for rbd mirror instance - command: systemctl enable ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }}.service - failed_when: false - changed_when: false - -- name: reload systemd unit files - command: systemctl daemon-reload - changed_when: false - failed_when: false - - name: systemd start rbd mirror container - service: + systemd: name: ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }} state: started enabled: yes + daemon_reload: yes changed_when: false