diff --git a/infrastructure-playbooks/docker-to-podman.yml b/infrastructure-playbooks/docker-to-podman.yml new file mode 100644 index 0000000000..861d957045 --- /dev/null +++ b/infrastructure-playbooks/docker-to-podman.yml @@ -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, []) diff --git a/roles/ceph-iscsi-gw/tasks/container/containerized.yml b/roles/ceph-iscsi-gw/tasks/containerized.yml similarity index 53% rename from roles/ceph-iscsi-gw/tasks/container/containerized.yml rename to roles/ceph-iscsi-gw/tasks/containerized.yml index 014edba72c..b5dc4e95d9 100644 --- a/roles/ceph-iscsi-gw/tasks/container/containerized.yml +++ b/roles/ceph-iscsi-gw/tasks/containerized.yml @@ -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: diff --git a/roles/ceph-iscsi-gw/tasks/main.yml b/roles/ceph-iscsi-gw/tasks/main.yml index 3d8bee8544..05732a0dac 100644 --- a/roles/ceph-iscsi-gw/tasks/main.yml +++ b/roles/ceph-iscsi-gw/tasks/main.yml @@ -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 diff --git a/roles/ceph-iscsi-gw/tasks/systemd.yml b/roles/ceph-iscsi-gw/tasks/systemd.yml new file mode 100644 index 0000000000..6768716b05 --- /dev/null +++ b/roles/ceph-iscsi-gw/tasks/systemd.yml @@ -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 }} diff --git a/roles/ceph-mds/tasks/containerized.yml b/roles/ceph-mds/tasks/containerized.yml index c4e64402fc..e10725a46d 100644 --- a/roles/ceph-mds/tasks/containerized.yml +++ b/roles/ceph-mds/tasks/containerized.yml @@ -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: diff --git a/roles/ceph-mds/tasks/systemd.yml b/roles/ceph-mds/tasks/systemd.yml new file mode 100644 index 0000000000..74f4d35f88 --- /dev/null +++ b/roles/ceph-mds/tasks/systemd.yml @@ -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 diff --git a/roles/ceph-mgr/tasks/start_mgr.yml b/roles/ceph-mgr/tasks/start_mgr.yml index 3712152077..348a718dde 100644 --- a/roles/ceph-mgr/tasks/start_mgr.yml +++ b/roles/ceph-mgr/tasks/start_mgr.yml @@ -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: diff --git a/roles/ceph-mgr/tasks/systemd.yml b/roles/ceph-mgr/tasks/systemd.yml new file mode 100644 index 0000000000..dad9d74de2 --- /dev/null +++ b/roles/ceph-mgr/tasks/systemd.yml @@ -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 diff --git a/roles/ceph-mon/tasks/start_monitor.yml b/roles/ceph-mon/tasks/start_monitor.yml index 56ef730cf0..c6a4e74ea1 100644 --- a/roles/ceph-mon/tasks/start_monitor.yml +++ b/roles/ceph-mon/tasks/start_monitor.yml @@ -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 diff --git a/roles/ceph-mon/tasks/systemd.yml b/roles/ceph-mon/tasks/systemd.yml new file mode 100644 index 0000000000..e099ef29f8 --- /dev/null +++ b/roles/ceph-mon/tasks/systemd.yml @@ -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 diff --git a/roles/ceph-nfs/tasks/start_nfs.yml b/roles/ceph-nfs/tasks/start_nfs.yml index bf888f070f..331c993e8d 100644 --- a/roles/ceph-nfs/tasks/start_nfs.yml +++ b/roles/ceph-nfs/tasks/start_nfs.yml @@ -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: diff --git a/roles/ceph-nfs/tasks/systemd.yml b/roles/ceph-nfs/tasks/systemd.yml new file mode 100644 index 0000000000..0a31857378 --- /dev/null +++ b/roles/ceph-nfs/tasks/systemd.yml @@ -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 \ No newline at end of file diff --git a/roles/ceph-osd/tasks/start_osds.yml b/roles/ceph-osd/tasks/start_osds.yml index b38b7071e0..46e83d6910 100644 --- a/roles/ceph-osd/tasks/start_osds.yml +++ b/roles/ceph-osd/tasks/start_osds.yml @@ -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 diff --git a/roles/ceph-osd/tasks/systemd.yml b/roles/ceph-osd/tasks/systemd.yml new file mode 100644 index 0000000000..4992e5ee47 --- /dev/null +++ b/roles/ceph-osd/tasks/systemd.yml @@ -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 diff --git a/roles/ceph-rbd-mirror/tasks/container/main.yml b/roles/ceph-rbd-mirror/tasks/container/main.yml deleted file mode 100644 index 8c2e8a866e..0000000000 --- a/roles/ceph-rbd-mirror/tasks/container/main.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- name: include start_docker_rbd_mirror.yml - include_tasks: start_docker_rbd_mirror.yml diff --git a/roles/ceph-rbd-mirror/tasks/main.yml b/roles/ceph-rbd-mirror/tasks/main.yml index c7764cd8d5..1544c17b70 100644 --- a/roles/ceph-rbd-mirror/tasks/main.yml +++ b/roles/ceph-rbd-mirror/tasks/main.yml @@ -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 diff --git a/roles/ceph-rbd-mirror/tasks/start_container_rbd_mirror.yml b/roles/ceph-rbd-mirror/tasks/start_container_rbd_mirror.yml new file mode 100644 index 0000000000..cebeccff42 --- /dev/null +++ b/roles/ceph-rbd-mirror/tasks/start_container_rbd_mirror.yml @@ -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 diff --git a/roles/ceph-rbd-mirror/tasks/container/start_docker_rbd_mirror.yml b/roles/ceph-rbd-mirror/tasks/systemd.yml similarity index 51% rename from roles/ceph-rbd-mirror/tasks/container/start_docker_rbd_mirror.yml rename to roles/ceph-rbd-mirror/tasks/systemd.yml index 36ded05cab..723c467de4 100644 --- a/roles/ceph-rbd-mirror/tasks/container/start_docker_rbd_mirror.yml +++ b/roles/ceph-rbd-mirror/tasks/systemd.yml @@ -1,6 +1,6 @@ --- -# 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 @@ -8,11 +8,3 @@ 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 diff --git a/roles/ceph-rgw/tasks/container/main.yml b/roles/ceph-rgw/tasks/container/main.yml deleted file mode 100644 index 539c42303e..0000000000 --- a/roles/ceph-rgw/tasks/container/main.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- name: include start_docker_rgw.yml - include_tasks: start_docker_rgw.yml diff --git a/roles/ceph-rgw/tasks/main.yml b/roles/ceph-rgw/tasks/main.yml index df0e8bc3ee..dad3c55042 100644 --- a/roles/ceph-rgw/tasks/main.yml +++ b/roles/ceph-rgw/tasks/main.yml @@ -14,8 +14,8 @@ include_tasks: start_radosgw.yml when: not containerized_deployment | bool -- name: include_tasks container/main.yml - include_tasks: container/main.yml +- name: include start_docker_rgw.yml + include_tasks: start_docker_rgw.yml when: containerized_deployment | bool - name: include_tasks multisite/main.yml diff --git a/roles/ceph-rgw/tasks/container/start_docker_rgw.yml b/roles/ceph-rgw/tasks/start_docker_rgw.yml similarity index 70% rename from roles/ceph-rgw/tasks/container/start_docker_rgw.yml rename to roles/ceph-rgw/tasks/start_docker_rgw.yml index 0346b96876..7cb3702144 100644 --- a/roles/ceph-rgw/tasks/container/start_docker_rgw.yml +++ b/roles/ceph-rgw/tasks/start_docker_rgw.yml @@ -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: diff --git a/roles/ceph-rgw/tasks/systemd.yml b/roles/ceph-rgw/tasks/systemd.yml new file mode 100644 index 0000000000..1a088792b4 --- /dev/null +++ b/roles/ceph-rgw/tasks/systemd.yml @@ -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 \ No newline at end of file