mirror of https://github.com/ceph/ceph-ansible.git
containers: introduce target systemd unit
This adds ceph-*.target systemd unit files support for containerized
deployments.
This also fixes a regression introduced by PR #6719 (rgw and nfs systemd
units not getting purged)
Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1962748
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 09ef465f62
)
pull/6853/head
v4.0.64
parent
6ebbda8cef
commit
20583e83dd
|
@ -248,8 +248,11 @@
|
||||||
|
|
||||||
- name: remove ceph mds service
|
- name: remove ceph mds service
|
||||||
file:
|
file:
|
||||||
path: /etc/systemd/system/ceph-mds@.service
|
path: /etc/systemd/system/ceph-mds{{ item }}
|
||||||
state: absent
|
state: absent
|
||||||
|
loop:
|
||||||
|
- '@.service'
|
||||||
|
- '.target'
|
||||||
|
|
||||||
|
|
||||||
- name: purge ceph mgr cluster
|
- name: purge ceph mgr cluster
|
||||||
|
@ -267,9 +270,11 @@
|
||||||
|
|
||||||
- name: remove ceph mgr service
|
- name: remove ceph mgr service
|
||||||
file:
|
file:
|
||||||
path: /etc/systemd/system/ceph-mgr@.service
|
path: /etc/systemd/system/ceph-mgr{{ item }}
|
||||||
state: absent
|
state: absent
|
||||||
|
loop:
|
||||||
|
- '@.service'
|
||||||
|
- '.target'
|
||||||
|
|
||||||
- name: purge rgwloadbalancer cluster
|
- name: purge rgwloadbalancer cluster
|
||||||
hosts: rgwloadbalancers
|
hosts: rgwloadbalancers
|
||||||
|
@ -304,6 +309,14 @@
|
||||||
failed_when: false
|
failed_when: false
|
||||||
with_items: "{{ rgw_instances }}"
|
with_items: "{{ rgw_instances }}"
|
||||||
|
|
||||||
|
- name: remove ceph rgw service
|
||||||
|
file:
|
||||||
|
path: /etc/systemd/system/ceph-radosgw{{ item }}
|
||||||
|
state: absent
|
||||||
|
loop:
|
||||||
|
- '@.service'
|
||||||
|
- '.target'
|
||||||
|
|
||||||
|
|
||||||
- name: purge ceph rbd-mirror cluster
|
- name: purge ceph rbd-mirror cluster
|
||||||
hosts: rbdmirrors
|
hosts: rbdmirrors
|
||||||
|
@ -317,6 +330,14 @@
|
||||||
enabled: no
|
enabled: no
|
||||||
failed_when: false
|
failed_when: false
|
||||||
|
|
||||||
|
- name: remove ceph rbd-mirror service
|
||||||
|
file:
|
||||||
|
path: /etc/systemd/system/ceph-rbd-mirror{{ item }}
|
||||||
|
state: absent
|
||||||
|
loop:
|
||||||
|
- '@.service'
|
||||||
|
- '.target'
|
||||||
|
|
||||||
|
|
||||||
- name: purge ceph osd cluster
|
- name: purge ceph osd cluster
|
||||||
vars:
|
vars:
|
||||||
|
@ -599,9 +620,11 @@
|
||||||
|
|
||||||
- name: remove ceph osd service
|
- name: remove ceph osd service
|
||||||
file:
|
file:
|
||||||
path: /etc/systemd/system/ceph-osd@.service
|
path: /etc/systemd/system/ceph-osd{{ item }}
|
||||||
state: absent
|
state: absent
|
||||||
when: containerized_deployment | bool
|
loop:
|
||||||
|
- '@.service'
|
||||||
|
- '.target'
|
||||||
|
|
||||||
- name: purge ceph mon cluster
|
- name: purge ceph mon cluster
|
||||||
hosts: mons
|
hosts: mons
|
||||||
|
@ -633,11 +656,9 @@
|
||||||
|
|
||||||
- name: remove ceph mon and mgr service
|
- name: remove ceph mon and mgr service
|
||||||
file:
|
file:
|
||||||
path: "/etc/systemd/system/ceph-{{ item }}@.service"
|
path: "/etc/systemd/system/ceph-{{ item.0 }}{{ item.1 }}"
|
||||||
state: absent
|
state: absent
|
||||||
with_items:
|
loop: "{{ ['mon', 'mgr'] | product(['@.service', '.target']) | list }}"
|
||||||
- mon
|
|
||||||
- mgr
|
|
||||||
|
|
||||||
|
|
||||||
- name: purge ceph-crash daemons
|
- name: purge ceph-crash daemons
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
[Unit]
|
||||||
|
Description=ceph target allowing to start/stop all ceph*@.service instances at once
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -1,4 +1,15 @@
|
||||||
---
|
---
|
||||||
|
- name: generate systemd ceph-mon target file
|
||||||
|
copy:
|
||||||
|
src: ceph.target
|
||||||
|
dest: /etc/systemd/system/ceph.target
|
||||||
|
|
||||||
|
- name: enable ceph.target
|
||||||
|
service:
|
||||||
|
name: ceph.target
|
||||||
|
enabled: yes
|
||||||
|
daemon_reload: yes
|
||||||
|
|
||||||
- name: include prerequisites.yml
|
- name: include prerequisites.yml
|
||||||
include_tasks: prerequisites.yml
|
include_tasks: prerequisites.yml
|
||||||
|
|
||||||
|
|
|
@ -41,4 +41,4 @@ TimeoutStartSec=120
|
||||||
TimeoutStopSec=10
|
TimeoutStopSec=10
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=ceph.target
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
[Unit]
|
||||||
|
Description=ceph target allowing to start/stop all ceph-mds@.service instances at once
|
||||||
|
PartOf=ceph.target
|
||||||
|
After=ceph-mon.target
|
||||||
|
Before=ceph.target
|
||||||
|
Wants=ceph.target ceph-mon.target
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target ceph.target
|
|
@ -2,6 +2,13 @@
|
||||||
- name: include_tasks systemd.yml
|
- name: include_tasks systemd.yml
|
||||||
include_tasks: systemd.yml
|
include_tasks: systemd.yml
|
||||||
|
|
||||||
|
- name: enable ceph-mds.target
|
||||||
|
service:
|
||||||
|
name: ceph-mds.target
|
||||||
|
enabled: yes
|
||||||
|
daemon_reload: yes
|
||||||
|
when: containerized_deployment | bool
|
||||||
|
|
||||||
- name: systemd start mds container
|
- name: systemd start mds container
|
||||||
systemd:
|
systemd:
|
||||||
name: ceph-mds@{{ ansible_facts['hostname'] }}
|
name: ceph-mds@{{ ansible_facts['hostname'] }}
|
||||||
|
|
|
@ -7,3 +7,9 @@
|
||||||
group: "root"
|
group: "root"
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
notify: restart ceph mdss
|
notify: restart ceph mdss
|
||||||
|
|
||||||
|
- name: generate systemd ceph-mds target file
|
||||||
|
copy:
|
||||||
|
src: ceph-mds.target
|
||||||
|
dest: /etc/systemd/system/ceph-mds.target
|
||||||
|
when: containerized_deployment | bool
|
|
@ -1,5 +1,6 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Ceph MDS
|
Description=Ceph MDS
|
||||||
|
PartOf=ceph-mds.target
|
||||||
{% if container_binary == 'docker' %}
|
{% if container_binary == 'docker' %}
|
||||||
After=docker.service
|
After=docker.service
|
||||||
Requires=docker.service
|
Requires=docker.service
|
||||||
|
@ -53,4 +54,4 @@ PIDFile=/%t/%n-pid
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=ceph.target
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
[Unit]
|
||||||
|
Description=ceph target allowing to start/stop all ceph-mgr@.service instances at once
|
||||||
|
PartOf=ceph.target
|
||||||
|
After=ceph-mon.target
|
||||||
|
Before=ceph.target
|
||||||
|
Wants=ceph.target ceph-mon.target
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target ceph.target
|
|
@ -21,6 +21,13 @@
|
||||||
include_tasks: systemd.yml
|
include_tasks: systemd.yml
|
||||||
when: containerized_deployment | bool
|
when: containerized_deployment | bool
|
||||||
|
|
||||||
|
- name: enable ceph-mgr.target
|
||||||
|
service:
|
||||||
|
name: ceph-mgr.target
|
||||||
|
enabled: yes
|
||||||
|
daemon_reload: yes
|
||||||
|
when: containerized_deployment | bool
|
||||||
|
|
||||||
- name: systemd start mgr
|
- name: systemd start mgr
|
||||||
systemd:
|
systemd:
|
||||||
name: ceph-mgr@{{ ansible_facts['hostname'] }}
|
name: ceph-mgr@{{ ansible_facts['hostname'] }}
|
||||||
|
|
|
@ -7,3 +7,9 @@
|
||||||
group: "root"
|
group: "root"
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
notify: restart ceph mgrs
|
notify: restart ceph mgrs
|
||||||
|
|
||||||
|
- name: generate systemd ceph-mgr target file
|
||||||
|
copy:
|
||||||
|
src: ceph-mgr.target
|
||||||
|
dest: /etc/systemd/system/ceph-mgr.target
|
||||||
|
when: containerized_deployment | bool
|
|
@ -1,5 +1,6 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Ceph Manager
|
Description=Ceph Manager
|
||||||
|
PartOf=ceph-mgr.target
|
||||||
{% if container_binary == 'docker' %}
|
{% if container_binary == 'docker' %}
|
||||||
After=docker.service
|
After=docker.service
|
||||||
Requires=docker.service
|
Requires=docker.service
|
||||||
|
@ -52,4 +53,4 @@ PIDFile=/%t/%n-pid
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=ceph.target
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
[Unit]
|
||||||
|
Description=ceph target allowing to start/stop all ceph-mon@.service instances at once
|
||||||
|
PartOf=ceph.target
|
||||||
|
Before=ceph.target
|
||||||
|
Wants=ceph.target
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target ceph.target
|
|
@ -7,3 +7,16 @@
|
||||||
group: "root"
|
group: "root"
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
notify: restart ceph mons
|
notify: restart ceph mons
|
||||||
|
|
||||||
|
- name: generate systemd ceph-mon target file
|
||||||
|
copy:
|
||||||
|
src: ceph-mon.target
|
||||||
|
dest: /etc/systemd/system/ceph-mon.target
|
||||||
|
when: containerized_deployment | bool
|
||||||
|
|
||||||
|
- name: enable ceph-mon.target
|
||||||
|
service:
|
||||||
|
name: ceph-mon.target
|
||||||
|
enabled: yes
|
||||||
|
daemon_reload: yes
|
||||||
|
when: containerized_deployment | bool
|
|
@ -1,5 +1,6 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Ceph Monitor
|
Description=Ceph Monitor
|
||||||
|
PartOf=ceph-mon.target
|
||||||
{% if container_binary == 'docker' %}
|
{% if container_binary == 'docker' %}
|
||||||
After=docker.service
|
After=docker.service
|
||||||
Requires=docker.service
|
Requires=docker.service
|
||||||
|
@ -67,4 +68,4 @@ PIDFile=/%t/%n-pid
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=ceph.target
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
[Unit]
|
||||||
|
Description=ceph target allowing to start/stop all ceph-osd@.service instances at once
|
||||||
|
PartOf=ceph.target
|
||||||
|
After=ceph-mon.target
|
||||||
|
Before=ceph.target
|
||||||
|
Wants=ceph.target ceph-mon.target
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target ceph.target
|
|
@ -7,3 +7,16 @@
|
||||||
group: "root"
|
group: "root"
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
notify: restart ceph osds
|
notify: restart ceph osds
|
||||||
|
|
||||||
|
- name: generate systemd ceph-osd target file
|
||||||
|
copy:
|
||||||
|
src: ceph-osd.target
|
||||||
|
dest: /etc/systemd/system/ceph-osd.target
|
||||||
|
when: containerized_deployment | bool
|
||||||
|
|
||||||
|
- name: enable ceph-osd.target
|
||||||
|
service:
|
||||||
|
name: ceph-osd.target
|
||||||
|
enabled: yes
|
||||||
|
daemon_reload: yes
|
||||||
|
when: containerized_deployment | bool
|
|
@ -1,6 +1,7 @@
|
||||||
# {{ ansible_managed }}
|
# {{ ansible_managed }}
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Ceph OSD
|
Description=Ceph OSD
|
||||||
|
PartOf=ceph-osd.target
|
||||||
{% if container_binary == 'docker' %}
|
{% if container_binary == 'docker' %}
|
||||||
After=docker.service
|
After=docker.service
|
||||||
Requires=docker.service
|
Requires=docker.service
|
||||||
|
@ -79,4 +80,4 @@ PIDFile=/%t/%n-pid
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=ceph.target
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
[Unit]
|
||||||
|
Description=ceph target allowing to start/stop all ceph-rbd-mirror@.service instances at once
|
||||||
|
PartOf=ceph.target
|
||||||
|
Before=ceph.target
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target ceph.target
|
|
@ -7,3 +7,16 @@
|
||||||
group: "root"
|
group: "root"
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
notify: restart ceph rbdmirrors
|
notify: restart ceph rbdmirrors
|
||||||
|
|
||||||
|
- name: generate systemd ceph-rbd-mirror target file
|
||||||
|
copy:
|
||||||
|
src: ceph-rbd-mirror.target
|
||||||
|
dest: /etc/systemd/system/ceph-rbd-mirror.target
|
||||||
|
when: containerized_deployment | bool
|
||||||
|
|
||||||
|
- name: enable ceph-rbd-mirror.target
|
||||||
|
service:
|
||||||
|
name: ceph-rbd-mirror.target
|
||||||
|
enabled: yes
|
||||||
|
daemon_reload: yes
|
||||||
|
when: containerized_deployment | bool
|
|
@ -1,5 +1,6 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Ceph RBD mirror
|
Description=Ceph RBD mirror
|
||||||
|
PartOf=ceph-rbd-mirror.target
|
||||||
{% if container_binary == 'docker' %}
|
{% if container_binary == 'docker' %}
|
||||||
After=docker.service
|
After=docker.service
|
||||||
Requires=docker.service
|
Requires=docker.service
|
||||||
|
@ -52,4 +53,4 @@ PIDFile=/%t/%n-pid
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=ceph.target
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
[Unit]
|
||||||
|
Description=ceph target allowing to start/stop all ceph-radosgw@.service instances at once
|
||||||
|
PartOf=ceph.target
|
||||||
|
After=ceph-mon.target
|
||||||
|
Before=ceph.target
|
||||||
|
Wants=ceph.target ceph-mon.target
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target ceph.target
|
|
@ -6,4 +6,17 @@
|
||||||
owner: "root"
|
owner: "root"
|
||||||
group: "root"
|
group: "root"
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
notify: restart ceph rgws
|
notify: restart ceph rgws
|
||||||
|
|
||||||
|
- name: generate systemd ceph-radosgw target file
|
||||||
|
copy:
|
||||||
|
src: ceph-radosgw.target
|
||||||
|
dest: /etc/systemd/system/ceph-radosgw.target
|
||||||
|
when: containerized_deployment | bool
|
||||||
|
|
||||||
|
- name: enable ceph-radosgw.target
|
||||||
|
service:
|
||||||
|
name: ceph-radosgw.target
|
||||||
|
enabled: yes
|
||||||
|
daemon_reload: yes
|
||||||
|
when: containerized_deployment | bool
|
|
@ -1,5 +1,6 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Ceph RGW
|
Description=Ceph RGW
|
||||||
|
PartOf=ceph-radosgw.target
|
||||||
{% if container_binary == 'docker' %}
|
{% if container_binary == 'docker' %}
|
||||||
After=docker.service
|
After=docker.service
|
||||||
Requires=docker.service
|
Requires=docker.service
|
||||||
|
@ -66,4 +67,4 @@ PIDFile=/%t/%n-pid
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=ceph.target
|
||||||
|
|
Loading…
Reference in New Issue