Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add playbook to migrate systemd unit to podman #4319

Merged
merged 6 commits into from
Oct 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions infrastructure-playbooks/docker-to-podman.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
- hosts:
- mons
- osds
- mdss
- rgws
- nfss
- rbdmirrors
- clients
- iscsigws
- mgrs
- grafana-server

gather_facts: false
become: True
any_errors_fatal: true

vars:
delegate_facts_host: True

pre_tasks:
- import_tasks: "{{ playbook_dir }}/../raw_install_python.yml"

tasks:
# pre-tasks for following import -
- name: gather facts
setup:
when: not delegate_facts_host | bool

- name: gather and delegate facts
setup:
delegate_to: "{{ item }}"
delegate_facts: True
with_items: "{{ groups['all'] }}"
run_once: true
when: delegate_facts_host | bool

- hosts:
- "{{ mon_group_name | default('mons') }}"
- "{{ osd_group_name | default('osds') }}"
- "{{ mds_group_name | default('mdss') }}"
- "{{ rgw_group_name | default('rgws') }}"
- "{{ nfs_group_name | default('nfss') }}"
- "{{ mgr_group_name | default('mgrs') }}"
- "{{ iscsi_gw_group_name | default('iscsigws') }}"
- "{{ rbdmirror_group_name | default('rbdmirrors') }}"
become: true
vars:
docker2podman: True
container_binary: podman
container_binding_name: podman
container_service_name: podman
container_package_name: podman
pre_tasks:
- import_role:
name: ceph-defaults
- import_role:
name: ceph-facts

- name: get docker version
command: docker --version
changed_when: false
check_mode: no
register: ceph_docker_version

- name: set_fact ceph_docker_version ceph_docker_version.stdout.split
set_fact:
ceph_docker_version: "{{ ceph_docker_version.stdout.split(' ')[2] }}"


tasks:
- import_role:
name: ceph-mon
tasks_from: systemd.yml
when: inventory_hostname in groups.get(mon_group_name, [])

- import_role:
name: ceph-iscsi-gw
tasks_from: systemd.yml
when: inventory_hostname in groups.get(iscsi_gw_group_name, [])

- import_role:
name: ceph-mds
tasks_from: systemd.yml
when: inventory_hostname in groups.get(mds_group_name, [])

- import_role:
name: ceph-mgr
tasks_from: systemd.yml
when: inventory_hostname in groups.get(mgr_group_name, [])

- import_role:
name: ceph-nfs
tasks_from: systemd.yml
when: inventory_hostname in groups.get(nfs_group_name, [])

- import_role:
name: ceph-osd
tasks_from: systemd.yml
when: inventory_hostname in groups.get(osd_group_name, [])

- import_role:
name: ceph-rbd-mirror
tasks_from: systemd.yml
when: inventory_hostname in groups.get(rbdmirror_group_name, [])

- import_role:
name: ceph-rgw
tasks_from: systemd.yml
when: inventory_hostname in groups.get(rgw_group_name, [])
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion roles/ceph-iscsi-gw/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
- not use_new_ceph_iscsi | bool

- name: include containerized.yml
include_tasks: container/containerized.yml
include_tasks: containerized.yml
when: containerized_deployment | bool
14 changes: 14 additions & 0 deletions roles/ceph-iscsi-gw/tasks/systemd.yml
Original file line number Diff line number Diff line change
@@ -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 }}
11 changes: 2 additions & 9 deletions roles/ceph-mds/tasks/containerized.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 10 additions & 0 deletions roles/ceph-mds/tasks/systemd.yml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 2 additions & 8 deletions roles/ceph-mgr/tasks/start_mgr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 10 additions & 0 deletions roles/ceph-mgr/tasks/systemd.yml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 2 additions & 8 deletions roles/ceph-mon/tasks/start_monitor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions roles/ceph-mon/tasks/systemd.yml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 2 additions & 8 deletions roles/ceph-nfs/tasks/start_nfs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 10 additions & 0 deletions roles/ceph-nfs/tasks/systemd.yml
Original file line number Diff line number Diff line change
@@ -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
39 changes: 11 additions & 28 deletions roles/ceph-osd/tasks/start_osds.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
21 changes: 21 additions & 0 deletions roles/ceph-osd/tasks/systemd.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 0 additions & 3 deletions roles/ceph-rbd-mirror/tasks/container/main.yml

This file was deleted.

4 changes: 2 additions & 2 deletions roles/ceph-rbd-mirror/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
set_fact:
container_exec_cmd: "{{ container_binary }} exec ceph-rbd-mirror-{{ ansible_hostname }}"

- name: include container/main.yml
include_tasks: container/main.yml
- name: include start_container_rbd_mirror.yml
include_tasks: start_container_rbd_mirror.yml

- name: include configure_mirroring.yml
include_tasks: configure_mirroring.yml
Expand Down
12 changes: 12 additions & 0 deletions roles/ceph-rbd-mirror/tasks/start_container_rbd_mirror.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
# Use systemd to manage container on Atomic host
- name: include_tasks systemd.yml
include_tasks: systemd.yml

- name: systemd start rbd mirror container
systemd:
name: ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }}
state: started
enabled: yes
masked: no
daemon_reload: yes
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
---
# Use systemd to manage container on Atomic host
- 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

- name: systemd start rbd mirror container
systemd:
name: ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }}
state: started
enabled: yes
masked: no
daemon_reload: yes
3 changes: 0 additions & 3 deletions roles/ceph-rgw/tasks/container/main.yml

This file was deleted.

Loading