From 57e6edff98ab02b734c260ec8489fd7b5202b758 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Wed, 1 Feb 2017 17:12:46 +0100 Subject: [PATCH] docker: use systemd to manage container MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since we now only support systemd has an init system we can finally treat containers as processes using systemd and this for all the distros. Signed-off-by: Sébastien Han --- roles/ceph-mds/tasks/docker/start_docker_mds.yml | 4 ---- roles/ceph-mon/tasks/docker/start_docker_monitor.yml | 4 ---- roles/ceph-nfs/tasks/docker/start_docker_nfs.yml | 12 ------------ roles/ceph-osd/tasks/docker/start_docker_osd.yml | 4 ---- .../tasks/docker/start_docker_rbd_mirror.yml | 3 --- roles/ceph-rgw/tasks/docker/start_docker_rgw.yml | 4 ---- 6 files changed, 31 deletions(-) diff --git a/roles/ceph-mds/tasks/docker/start_docker_mds.yml b/roles/ceph-mds/tasks/docker/start_docker_mds.yml index cb76e9777..d49e56e67 100644 --- a/roles/ceph-mds/tasks/docker/start_docker_mds.yml +++ b/roles/ceph-mds/tasks/docker/start_docker_mds.yml @@ -8,26 +8,22 @@ owner: "root" group: "root" mode: "0644" - when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: link systemd unit file for mds instance file: src: /var/lib/ceph/ceph-mds@.service dest: /etc/systemd/system/multi-user.target.wants/ceph-mds@{{ ansible_hostname }}.service state: link - when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: enable systemd unit file for mds instance command: systemctl enable /etc/systemd/system/multi-user.target.wants/ceph-mds@{{ ansible_hostname }}.service failed_when: false changed_when: false - when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: reload systemd unit files command: systemctl daemon-reload changed_when: false failed_when: false - when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: systemd start mds container service: diff --git a/roles/ceph-mon/tasks/docker/start_docker_monitor.yml b/roles/ceph-mon/tasks/docker/start_docker_monitor.yml index a2071936c..50dc8f37d 100644 --- a/roles/ceph-mon/tasks/docker/start_docker_monitor.yml +++ b/roles/ceph-mon/tasks/docker/start_docker_monitor.yml @@ -40,7 +40,6 @@ image: "{{ ceph_mon_docker_username }}/{{ ceph_mon_docker_imagename }}:{{ ceph_mon_docker_image_tag }}" when: mon_containerized_deployment_with_kv -# Use systemd to manage container on Atomic host and CoreOS - name: generate systemd unit file become: true template: @@ -49,19 +48,16 @@ owner: "root" group: "root" mode: "0644" - when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: enable systemd unit file for mon instance shell: systemctl enable ceph-mon@{{ ansible_hostname }}.service failed_when: false changed_when: false - when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: reload systemd unit files shell: systemctl daemon-reload changed_when: false failed_when: false - when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: systemd start mon container service: diff --git a/roles/ceph-nfs/tasks/docker/start_docker_nfs.yml b/roles/ceph-nfs/tasks/docker/start_docker_nfs.yml index 3b297d544..b4685a6b7 100644 --- a/roles/ceph-nfs/tasks/docker/start_docker_nfs.yml +++ b/roles/ceph-nfs/tasks/docker/start_docker_nfs.yml @@ -8,34 +8,22 @@ owner: "root" group: "root" mode: "0644" - when: - is_atomic or - ansible_os_family == 'CoreOS' - name: link systemd unit file for NFS instance file: src: /var/lib/nfs/ganesha/ceph-nfs@.service dest: /etc/systemd/system/multi-user.target.wants/ceph-nfs@{{ ansible_hostname }}.service state: link - when: - is_atomic or - ansible_os_family == 'CoreOS' - name: enable systemd unit file for NFS instance shell: systemctl enable /etc/systemd/system/multi-user.target.wants/ceph-nfs@{{ ansible_hostname }}.service failed_when: false changed_when: false - when: - is_atomic or - ansible_os_family == 'CoreOS' - name: reload systemd unit files shell: systemctl daemon-reload changed_when: false failed_when: false - when: - is_atomic or - ansible_os_family == 'CoreOS' - name: systemd start NFS container service: diff --git a/roles/ceph-osd/tasks/docker/start_docker_osd.yml b/roles/ceph-osd/tasks/docker/start_docker_osd.yml index 5c830804f..196725b31 100644 --- a/roles/ceph-osd/tasks/docker/start_docker_osd.yml +++ b/roles/ceph-osd/tasks/docker/start_docker_osd.yml @@ -67,7 +67,6 @@ - ceph_osd_docker_prepare_env is defined - osd_containerized_deployment_with_kv -# Use systemd to manage container on appropriate host - name: generate systemd unit file become: true template: @@ -77,20 +76,17 @@ group: "root" mode: "0644" failed_when: false - when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: enable systemd unit file for osd instance shell: systemctl enable ceph-osd@{{ item | basename }}.service failed_when: false changed_when: false with_items: "{{ ceph_osd_docker_devices }}" - when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: reload systemd unit files shell: systemctl daemon-reload changed_when: false failed_when: false - when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: systemd start osd container service: 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 b3d127ce3..afaffafe2 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 @@ -8,19 +8,16 @@ owner: "root" group: "root" mode: "0644" - when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: enable systemd unit file for rbd mirror instance command: systemctl enable ceph-rbd-mirror@{{ ansible_hostname }}.service failed_when: false changed_when: false - when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: reload systemd unit files command: systemctl daemon-reload changed_when: false failed_when: false - when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: systemd start rbd mirror container service: diff --git a/roles/ceph-rgw/tasks/docker/start_docker_rgw.yml b/roles/ceph-rgw/tasks/docker/start_docker_rgw.yml index 072615eca..d86a062c9 100644 --- a/roles/ceph-rgw/tasks/docker/start_docker_rgw.yml +++ b/roles/ceph-rgw/tasks/docker/start_docker_rgw.yml @@ -8,26 +8,22 @@ owner: "root" group: "root" mode: "0644" - when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: link systemd unit file for rgw instance file: src: /var/lib/ceph/ceph-rgw@.service dest: /etc/systemd/system/multi-user.target.wants/ceph-rgw@{{ ansible_hostname }}.service state: link - when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: enable systemd unit file for rgw instance shell: systemctl enable /etc/systemd/system/multi-user.target.wants/ceph-rgw@{{ ansible_hostname }}.service failed_when: false changed_when: false - when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: reload systemd unit files shell: systemctl daemon-reload changed_when: false failed_when: false - when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - name: systemd start rgw container service: