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-api
- rbd-target-gw - rbd-target-gw
- name: generate systemd unit files for tcmu-runner, rbd-target-api and rbd-target-gw - name: include_tasks systemd.yml
template: include_tasks: systemd.yml
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: systemd start tcmu-runner, rbd-target-api and rbd-target-gw containers - name: systemd start tcmu-runner, rbd-target-api and rbd-target-gw containers
systemd: 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: set_fact:
container_exec_cmd: "{{ container_binary }} exec ceph-mds-{{ ansible_hostname }}" container_exec_cmd: "{{ container_binary }} exec ceph-mds-{{ ansible_hostname }}"
- name: generate systemd unit file - name: include_tasks systemd.yml
become: true include_tasks: systemd.yml
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: systemd start mds container - name: systemd start mds container
systemd: 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 - ceph_mgr_systemd_overrides is defined
- ansible_service_mgr == 'systemd' - ansible_service_mgr == 'systemd'
- name: generate systemd unit file - name: include_tasks systemd.yml
template: include_tasks: systemd.yml
src: "{{ role_path }}/templates/ceph-mgr.service.j2"
dest: /etc/systemd/system/ceph-mgr@.service
owner: "root"
group: "root"
mode: "0644"
when: containerized_deployment | bool when: containerized_deployment | bool
notify: restart ceph mgrs
- name: systemd start mgr - name: systemd start mgr
systemd: 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 - ceph_mon_systemd_overrides is defined
- ansible_service_mgr == 'systemd' - ansible_service_mgr == 'systemd'
- name: generate systemd unit file for mon container - name: include_tasks systemd.yml
template: include_tasks: systemd.yml
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
when: containerized_deployment | bool when: containerized_deployment | bool
- name: start the monitor service - 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" mode: "0644"
when: ceph_nfs_dynamic_exports | bool when: ceph_nfs_dynamic_exports | bool
- name: generate systemd unit file - name: include_tasks systemd.yml
template: include_tasks: systemd.yml
src: "{{ role_path }}/templates/ceph-nfs.service.j2"
dest: /etc/systemd/system/ceph-nfs@.service
owner: "root"
group: "root"
mode: "0644"
when: containerized_deployment | bool when: containerized_deployment | bool
notify: restart ceph nfss
- name: systemd start nfs container - name: systemd start nfs container
systemd: 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 - name: umount ceph disk (if on openstack)
when: containerized_deployment | bool mount:
block: name: /mnt
- name: umount ceph disk (if on openstack) src: /dev/vdb
mount: fstype: ext3
name: /mnt state: unmounted
src: /dev/vdb when:
fstype: ext3 - ceph_docker_on_openstack | bool
state: unmounted - containerized_deployment | bool
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
# this is for ceph-disk, the ceph-disk command is gone so we have to list /var/lib/ceph # this is for ceph-disk, the ceph-disk command is gone so we have to list /var/lib/ceph
- name: get osd ids - name: get osd ids
@ -40,14 +29,8 @@
failed_when: false failed_when: false
register: ceph_osd_ids register: ceph_osd_ids
- name: generate systemd unit file - name: include_tasks systemd.yml
template: include_tasks: systemd.yml
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
when: containerized_deployment | bool when: containerized_deployment | bool
- name: systemd start osd - 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 # Use systemd to manage container on Atomic host
- name: generate systemd unit file - name: include_tasks systemd.yml
template: include_tasks: systemd.yml
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: systemd start rbd mirror container - name: systemd start rbd mirror container
systemd: 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 }} INST_PORT={{ item.radosgw_frontend_port }}
with_items: "{{ rgw_instances }}" with_items: "{{ rgw_instances }}"
- name: generate systemd unit file - name: include_task systemd.yml
template: include_tasks: systemd.yml
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: systemd start rgw container - name: systemd start rgw container
systemd: 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