docker: use systemd to manage container

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 <seb@redhat.com>
pull/1278/head
Sébastien Han 2017-02-01 17:12:46 +01:00
parent 88a2b2de8c
commit 57e6edff98
6 changed files with 0 additions and 31 deletions

View File

@ -8,26 +8,22 @@
owner: "root" owner: "root"
group: "root" group: "root"
mode: "0644" mode: "0644"
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: link systemd unit file for mds instance - name: link systemd unit file for mds instance
file: file:
src: /var/lib/ceph/ceph-mds@.service src: /var/lib/ceph/ceph-mds@.service
dest: /etc/systemd/system/multi-user.target.wants/ceph-mds@{{ ansible_hostname }}.service dest: /etc/systemd/system/multi-user.target.wants/ceph-mds@{{ ansible_hostname }}.service
state: link state: link
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: enable systemd unit file for mds instance - name: enable systemd unit file for mds instance
command: systemctl enable /etc/systemd/system/multi-user.target.wants/ceph-mds@{{ ansible_hostname }}.service command: systemctl enable /etc/systemd/system/multi-user.target.wants/ceph-mds@{{ ansible_hostname }}.service
failed_when: false failed_when: false
changed_when: false changed_when: false
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: reload systemd unit files - name: reload systemd unit files
command: systemctl daemon-reload command: systemctl daemon-reload
changed_when: false changed_when: false
failed_when: false failed_when: false
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: systemd start mds container - name: systemd start mds container
service: service:

View File

@ -40,7 +40,6 @@
image: "{{ ceph_mon_docker_username }}/{{ ceph_mon_docker_imagename }}:{{ ceph_mon_docker_image_tag }}" image: "{{ ceph_mon_docker_username }}/{{ ceph_mon_docker_imagename }}:{{ ceph_mon_docker_image_tag }}"
when: mon_containerized_deployment_with_kv when: mon_containerized_deployment_with_kv
# Use systemd to manage container on Atomic host and CoreOS
- name: generate systemd unit file - name: generate systemd unit file
become: true become: true
template: template:
@ -49,19 +48,16 @@
owner: "root" owner: "root"
group: "root" group: "root"
mode: "0644" mode: "0644"
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: enable systemd unit file for mon instance - name: enable systemd unit file for mon instance
shell: systemctl enable ceph-mon@{{ ansible_hostname }}.service shell: systemctl enable ceph-mon@{{ ansible_hostname }}.service
failed_when: false failed_when: false
changed_when: false changed_when: false
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: reload systemd unit files - name: reload systemd unit files
shell: systemctl daemon-reload shell: systemctl daemon-reload
changed_when: false changed_when: false
failed_when: false failed_when: false
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: systemd start mon container - name: systemd start mon container
service: service:

View File

@ -8,34 +8,22 @@
owner: "root" owner: "root"
group: "root" group: "root"
mode: "0644" mode: "0644"
when:
is_atomic or
ansible_os_family == 'CoreOS'
- name: link systemd unit file for NFS instance - name: link systemd unit file for NFS instance
file: file:
src: /var/lib/nfs/ganesha/ceph-nfs@.service src: /var/lib/nfs/ganesha/ceph-nfs@.service
dest: /etc/systemd/system/multi-user.target.wants/ceph-nfs@{{ ansible_hostname }}.service dest: /etc/systemd/system/multi-user.target.wants/ceph-nfs@{{ ansible_hostname }}.service
state: link state: link
when:
is_atomic or
ansible_os_family == 'CoreOS'
- name: enable systemd unit file for NFS instance - name: enable systemd unit file for NFS instance
shell: systemctl enable /etc/systemd/system/multi-user.target.wants/ceph-nfs@{{ ansible_hostname }}.service shell: systemctl enable /etc/systemd/system/multi-user.target.wants/ceph-nfs@{{ ansible_hostname }}.service
failed_when: false failed_when: false
changed_when: false changed_when: false
when:
is_atomic or
ansible_os_family == 'CoreOS'
- name: reload systemd unit files - name: reload systemd unit files
shell: systemctl daemon-reload shell: systemctl daemon-reload
changed_when: false changed_when: false
failed_when: false failed_when: false
when:
is_atomic or
ansible_os_family == 'CoreOS'
- name: systemd start NFS container - name: systemd start NFS container
service: service:

View File

@ -67,7 +67,6 @@
- ceph_osd_docker_prepare_env is defined - ceph_osd_docker_prepare_env is defined
- osd_containerized_deployment_with_kv - osd_containerized_deployment_with_kv
# Use systemd to manage container on appropriate host
- name: generate systemd unit file - name: generate systemd unit file
become: true become: true
template: template:
@ -77,20 +76,17 @@
group: "root" group: "root"
mode: "0644" mode: "0644"
failed_when: false failed_when: false
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: enable systemd unit file for osd instance - name: enable systemd unit file for osd instance
shell: systemctl enable ceph-osd@{{ item | basename }}.service shell: systemctl enable ceph-osd@{{ item | basename }}.service
failed_when: false failed_when: false
changed_when: false changed_when: false
with_items: "{{ ceph_osd_docker_devices }}" with_items: "{{ ceph_osd_docker_devices }}"
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: reload systemd unit files - name: reload systemd unit files
shell: systemctl daemon-reload shell: systemctl daemon-reload
changed_when: false changed_when: false
failed_when: false failed_when: false
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: systemd start osd container - name: systemd start osd container
service: service:

View File

@ -8,19 +8,16 @@
owner: "root" owner: "root"
group: "root" group: "root"
mode: "0644" mode: "0644"
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: enable systemd unit file for rbd mirror instance - name: enable systemd unit file for rbd mirror instance
command: systemctl enable ceph-rbd-mirror@{{ ansible_hostname }}.service command: systemctl enable ceph-rbd-mirror@{{ ansible_hostname }}.service
failed_when: false failed_when: false
changed_when: false changed_when: false
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: reload systemd unit files - name: reload systemd unit files
command: systemctl daemon-reload command: systemctl daemon-reload
changed_when: false changed_when: false
failed_when: false failed_when: false
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: systemd start rbd mirror container - name: systemd start rbd mirror container
service: service:

View File

@ -8,26 +8,22 @@
owner: "root" owner: "root"
group: "root" group: "root"
mode: "0644" mode: "0644"
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: link systemd unit file for rgw instance - name: link systemd unit file for rgw instance
file: file:
src: /var/lib/ceph/ceph-rgw@.service src: /var/lib/ceph/ceph-rgw@.service
dest: /etc/systemd/system/multi-user.target.wants/ceph-rgw@{{ ansible_hostname }}.service dest: /etc/systemd/system/multi-user.target.wants/ceph-rgw@{{ ansible_hostname }}.service
state: link state: link
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: enable systemd unit file for rgw instance - name: enable systemd unit file for rgw instance
shell: systemctl enable /etc/systemd/system/multi-user.target.wants/ceph-rgw@{{ ansible_hostname }}.service shell: systemctl enable /etc/systemd/system/multi-user.target.wants/ceph-rgw@{{ ansible_hostname }}.service
failed_when: false failed_when: false
changed_when: false changed_when: false
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: reload systemd unit files - name: reload systemd unit files
shell: systemctl daemon-reload shell: systemctl daemon-reload
changed_when: false changed_when: false
failed_when: false failed_when: false
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
- name: systemd start rgw container - name: systemd start rgw container
service: service: