container: isolate systemd tasks

This commit isolates the systemd unit files generation for containers into
separate yml files in order to be able importing each corresponding roles
without playing all tasks.
This is needed so we can run ceph-ansible to render systemd unit files
so they call podman instead of docker.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit bd64167469)
pull/4509/head
Guillaume Abrioux 2019-07-24 10:10:18 +02:00
parent 7bb835240e
commit df5337535d
16 changed files with 120 additions and 89 deletions

View File

@ -7,18 +7,8 @@
- rbd-target-api
- rbd-target-gw
- name: generate systemd unit files for tcmu-runner, rbd-target-api and rbd-target-gw
template:
src: "{{ role_path }}/templates/{{ item }}.service.j2"
dest: /etc/systemd/system/{{ item }}.service
owner: "root"
group: "root"
mode: "0644"
with_items:
- tcmu-runner
- rbd-target-gw
- rbd-target-api
notify: restart ceph {{ item }}
- name: include_tasks systemd.yml
include_tasks: systemd.yml
- name: systemd start tcmu-runner, rbd-target-api and rbd-target-gw containers
systemd:

View File

@ -0,0 +1,14 @@
---
- name: generate systemd unit files for tcmu-runner, rbd-target-api and rbd-target-gw
become: true
template:
src: "{{ role_path }}/templates/{{ item }}.service.j2"
dest: /etc/systemd/system/{{ item }}.service
owner: "root"
group: "root"
mode: "0644"
with_items:
- tcmu-runner
- rbd-target-gw
- rbd-target-api
notify: restart ceph {{ item }}

View File

@ -3,15 +3,8 @@
set_fact:
container_exec_cmd: "{{ container_binary }} exec ceph-mds-{{ ansible_hostname }}"
- name: generate systemd unit file
become: true
template:
src: "{{ role_path }}/templates/ceph-mds.service.j2"
dest: /etc/systemd/system/ceph-mds@.service
owner: "root"
group: "root"
mode: "0644"
notify: restart ceph mdss
- name: include_tasks systemd.yml
include_tasks: systemd.yml
- name: systemd start mds container
systemd:

View File

@ -0,0 +1,10 @@
---
- name: generate systemd unit file
become: true
template:
src: "{{ role_path }}/templates/ceph-mds.service.j2"
dest: /etc/systemd/system/ceph-mds@.service
owner: "root"
group: "root"
mode: "0644"
notify: restart ceph mdss

View File

@ -17,15 +17,9 @@
- ceph_mgr_systemd_overrides is defined
- ansible_service_mgr == 'systemd'
- name: generate systemd unit file
template:
src: "{{ role_path }}/templates/ceph-mgr.service.j2"
dest: /etc/systemd/system/ceph-mgr@.service
owner: "root"
group: "root"
mode: "0644"
- name: include_tasks systemd.yml
include_tasks: systemd.yml
when: containerized_deployment | bool
notify: restart ceph mgrs
- name: systemd start mgr
systemd:

View File

@ -0,0 +1,10 @@
---
- name: generate systemd unit file
become: true
template:
src: "{{ role_path }}/templates/ceph-mgr.service.j2"
dest: /etc/systemd/system/ceph-mgr@.service
owner: "root"
group: "root"
mode: "0644"
notify: restart ceph mgrs

View File

@ -19,14 +19,8 @@
- ceph_mon_systemd_overrides is defined
- ansible_service_mgr == 'systemd'
- name: generate systemd unit file for mon container
template:
src: "{{ role_path }}/templates/ceph-mon.service.j2"
dest: /etc/systemd/system/ceph-mon@.service
owner: "root"
group: "root"
mode: "0644"
notify: restart ceph mons
- name: include_tasks systemd.yml
include_tasks: systemd.yml
when: containerized_deployment | bool
- name: start the monitor service

View File

@ -0,0 +1,10 @@
---
- name: generate systemd unit file for mon container
become: true
template:
src: "{{ role_path }}/templates/ceph-mon.service.j2"
dest: /etc/systemd/system/ceph-mon@.service
owner: "root"
group: "root"
mode: "0644"
notify: restart ceph mons

View File

@ -60,15 +60,9 @@
mode: "0644"
when: ceph_nfs_dynamic_exports | bool
- name: generate systemd unit file
template:
src: "{{ role_path }}/templates/ceph-nfs.service.j2"
dest: /etc/systemd/system/ceph-nfs@.service
owner: "root"
group: "root"
mode: "0644"
- name: include_tasks systemd.yml
include_tasks: systemd.yml
when: containerized_deployment | bool
notify: restart ceph nfss
- name: systemd start nfs container
systemd:

View File

@ -0,0 +1,10 @@
---
- name: generate systemd unit file
become: true
template:
src: "{{ role_path }}/templates/ceph-nfs.service.j2"
dest: /etc/systemd/system/ceph-nfs@.service
owner: "root"
group: "root"
mode: "0644"
notify: restart ceph nfss

View File

@ -1,24 +1,13 @@
---
- name: container specific tasks
when: containerized_deployment | bool
block:
- name: umount ceph disk (if on openstack)
mount:
name: /mnt
src: /dev/vdb
fstype: ext3
state: unmounted
when: ceph_docker_on_openstack | bool
- name: generate ceph osd docker run script
template:
src: "{{ role_path }}/templates/ceph-osd-run.sh.j2"
dest: "{{ ceph_osd_docker_run_script_path }}/ceph-osd-run.sh"
owner: "root"
group: "root"
mode: "0744"
setype: "bin_t"
notify: restart ceph osds
- name: umount ceph disk (if on openstack)
mount:
name: /mnt
src: /dev/vdb
fstype: ext3
state: unmounted
when:
- ceph_docker_on_openstack | bool
- containerized_deployment | bool
# this is for ceph-disk, the ceph-disk command is gone so we have to list /var/lib/ceph
- name: get osd ids
@ -40,14 +29,8 @@
failed_when: false
register: ceph_osd_ids
- name: generate systemd unit file
template:
src: "{{ role_path }}/templates/ceph-osd.service.j2"
dest: /etc/systemd/system/ceph-osd@.service
owner: "root"
group: "root"
mode: "0644"
notify: restart ceph osds
- name: include_tasks systemd.yml
include_tasks: systemd.yml
when: containerized_deployment | bool
- name: systemd start osd

View File

@ -0,0 +1,21 @@
---
- name: generate ceph osd docker run script
become: true
template:
src: "{{ role_path }}/templates/ceph-osd-run.sh.j2"
dest: "{{ ceph_osd_docker_run_script_path }}/ceph-osd-run.sh"
owner: "root"
group: "root"
mode: "0744"
setype: "bin_t"
notify: restart ceph osds
- name: generate systemd unit file
become: true
template:
src: "{{ role_path }}/templates/ceph-osd.service.j2"
dest: /etc/systemd/system/ceph-osd@.service
owner: "root"
group: "root"
mode: "0644"
notify: restart ceph osds

View File

@ -1,13 +1,7 @@
---
# Use systemd to manage container on Atomic host
- name: generate systemd unit file
template:
src: "{{ role_path }}/templates/ceph-rbd-mirror.service.j2"
dest: /etc/systemd/system/ceph-rbd-mirror@.service
owner: "root"
group: "root"
mode: "0644"
notify: restart ceph rbdmirrors
- name: include_tasks systemd.yml
include_tasks: systemd.yml
- name: systemd start rbd mirror container
systemd:

View File

@ -0,0 +1,10 @@
---
- name: generate systemd unit file
become: true
template:
src: "{{ role_path }}/templates/ceph-rbd-mirror.service.j2"
dest: /etc/systemd/system/ceph-rbd-mirror@.service
owner: "root"
group: "root"
mode: "0644"
notify: restart ceph rbdmirrors

View File

@ -10,14 +10,8 @@
INST_PORT={{ item.radosgw_frontend_port }}
with_items: "{{ rgw_instances }}"
- name: generate systemd unit file
template:
src: "{{ role_path }}/templates/ceph-radosgw.service.j2"
dest: /etc/systemd/system/ceph-radosgw@.service
owner: "root"
group: "root"
mode: "0644"
notify: restart ceph rgws
- name: include_task systemd.yml
include_tasks: systemd.yml
- name: systemd start rgw container
systemd:

View File

@ -0,0 +1,10 @@
---
- name: generate systemd unit file
become: true
template:
src: "{{ role_path }}/templates/ceph-radosgw.service.j2"
dest: /etc/systemd/system/ceph-radosgw@.service
owner: "root"
group: "root"
mode: "0644"
notify: restart ceph rgws