]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
infra: introduce docker to podman playbook
authorGuillaume Abrioux <gabrioux@redhat.com>
Mon, 6 Jul 2020 07:27:38 +0000 (09:27 +0200)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Tue, 7 Jul 2020 16:11:09 +0000 (12:11 -0400)
This isn't backported from master because there are too many changes
between stable-3.2 and other newer branches.

NOTE:
This playbook  *doesn't* add podman support in stable-3.2 at all.
This is a tripleO dedicated playbook which is intended to be run
early during FFU workflow in order to prepare the OS upgrade.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1853457
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
64 files changed:
group_vars/all.yml.sample
group_vars/rhcs.yml.sample
infrastructure-playbooks/docker-to-podman.yml [new file with mode: 0644]
roles/ceph-defaults/defaults/main.yml
roles/ceph-docker-common/tasks/ceph_docker_version.yml [new file with mode: 0644]
roles/ceph-docker-common/tasks/main.yml
roles/ceph-handler/handlers/main.yml
roles/ceph-iscsi-gw/tasks/container/containerized.yml
roles/ceph-iscsi-gw/tasks/container/systemd.yml [new file with mode: 0644]
roles/ceph-iscsi-gw/tasks/docker2podman.yml [new symlink]
roles/ceph-iscsi-gw/templates/rbd-target-api.service.j2
roles/ceph-iscsi-gw/templates/rbd-target-gw.service.j2
roles/ceph-iscsi-gw/templates/tcmu-runner.service.j2
roles/ceph-mds/tasks/containerized.yml
roles/ceph-mds/tasks/systemd.yml [new file with mode: 0644]
roles/ceph-mds/templates/ceph-mds.service.j2
roles/ceph-mgr/tasks/docker/start_docker_mgr.yml
roles/ceph-mgr/tasks/docker/systemd.yml [new file with mode: 0644]
roles/ceph-mgr/tasks/docker2podman.yml [new symlink]
roles/ceph-mgr/templates/ceph-mgr.service.j2
roles/ceph-mon/tasks/docker/start_docker_monitor.yml
roles/ceph-mon/tasks/docker/systemd.yml [new file with mode: 0644]
roles/ceph-mon/tasks/docker2podman.yml [new symlink]
roles/ceph-mon/templates/ceph-mon.service.j2
roles/ceph-nfs/tasks/start_nfs.yml
roles/ceph-nfs/tasks/systemd.yml [new file with mode: 0644]
roles/ceph-nfs/templates/ceph-nfs.service.j2
roles/ceph-osd/tasks/start_osds.yml
roles/ceph-osd/tasks/systemd.yml [new file with mode: 0644]
roles/ceph-osd/templates/ceph-osd-run.sh.j2
roles/ceph-osd/templates/ceph-osd.service.j2
roles/ceph-rbd-mirror/tasks/docker/start_docker_rbd_mirror.yml
roles/ceph-rbd-mirror/tasks/docker/systemd.yml [new file with mode: 0644]
roles/ceph-rbd-mirror/tasks/docker2podman.yml [new symlink]
roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2
roles/ceph-rgw/tasks/docker/start_docker_rgw.yml
roles/ceph-rgw/tasks/docker/systemd.yml [new file with mode: 0644]
roles/ceph-rgw/tasks/docker2podman.yml [new symlink]
roles/ceph-rgw/templates/ceph-radosgw.service.j2
tests/conftest.py
tests/functional/docker2podman.yml [new file with mode: 0644]
tests/functional/docker2podman/Vagrantfile [new symlink]
tests/functional/docker2podman/ceph-override.json [new file with mode: 0644]
tests/functional/docker2podman/group_vars/all [new file with mode: 0644]
tests/functional/docker2podman/group_vars/clients [new file with mode: 0644]
tests/functional/docker2podman/group_vars/iscsigws [new file with mode: 0644]
tests/functional/docker2podman/group_vars/mons [new file with mode: 0644]
tests/functional/docker2podman/group_vars/osds [new file with mode: 0644]
tests/functional/docker2podman/group_vars/rgws [new file with mode: 0644]
tests/functional/docker2podman/hosts [new file with mode: 0644]
tests/functional/docker2podman/vagrant_variables.yml [new file with mode: 0644]
tests/functional/tests/mds/test_mds.py
tests/functional/tests/mgr/test_mgr.py
tests/functional/tests/mon/test_mons.py
tests/functional/tests/nfs/test_nfs_ganesha.py
tests/functional/tests/osd/test_osds.py
tests/functional/tests/rbd-mirror/test_rbd_mirror.py
tests/functional/tests/rgw/test_rgw.py
tests/functional/tests/rgw/test_rgw_tuning.py
tests/functional/tests/test_install.py
tests/requirements.txt
tox-docker2podman.ini [new file with mode: 0644]
tox-update.ini
tox.ini

index e5efa6bec145ea186db4e0e7282e3dd851324a86..923f20043fc10f89d6e21cc8c516db13346b0efe 100644 (file)
@@ -555,6 +555,7 @@ dummy:
 ##########
 # DOCKER #
 ##########
+#container_binary: docker
 #docker_exec_cmd:
 #docker: false
 #ceph_docker_image: "ceph/daemon"
index 91f72f7e9eba320db48ee3cd4641f4629a008c3c..f42f3db39e5d75e1d611ef1991c494bdae412560 100644 (file)
@@ -555,6 +555,7 @@ ceph_rhcs_version: 3
 ##########
 # DOCKER #
 ##########
+#container_binary: docker
 #docker_exec_cmd:
 #docker: false
 ceph_docker_image: "rhceph/rhceph-3-rhel7"
diff --git a/infrastructure-playbooks/docker-to-podman.yml b/infrastructure-playbooks/docker-to-podman.yml
new file mode 100644 (file)
index 0000000..cdac741
--- /dev/null
@@ -0,0 +1,127 @@
+# This playbook  *doesn't* add podman support in stable-3.2 at all.
+# This is a tripleO dedicated playbook which is intended to be run
+# early during FFU workflow in order to prepare the OS upgrade.
+
+- hosts:
+  - mons
+  - osds
+  - mdss
+  - rgws
+  - nfss
+  - rbdmirrors
+  - clients
+  - iscsigws
+  - iscsi-gws # for backward compatibility only!
+  - mgrs
+
+  gather_facts: false
+  become: True
+  any_errors_fatal: true
+
+  vars:
+    delegate_facts_host: True
+
+  roles:
+    - ceph-defaults
+
+  post_tasks:
+    - name: gather facts
+      setup:
+        gather_subset:
+          - 'all'
+          - '!facter'
+          - '!ohai'
+      when: not delegate_facts_host | bool or inventory_hostname in groups.get(client_group_name, [])
+
+    - name: gather and delegate facts
+      setup:
+        gather_subset:
+          - 'all'
+          - '!facter'
+          - '!ohai'
+      delegate_to: "{{ item }}"
+      delegate_facts: True
+      with_items: "{{ groups['all'] | difference(groups.get(client_group_name | default('clients'), [])) }}"
+      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') }}"
+  gather_facts: false
+  become: true
+  roles:
+    - ceph-defaults
+  post_tasks:
+    - import_role:
+        name: ceph-facts
+    - import_role:
+        name: ceph-handler
+    - import_role:
+        name: ceph-docker-common
+        tasks_from: ceph_docker_version.yml
+
+    - name: set_fact docker2podman and container_binary
+      set_fact:
+        docker2podman: True
+        container_binary: podman
+
+    - import_role:
+        name: ceph-mon
+        tasks_from: docker2podman.yml
+      when: inventory_hostname in groups.get(mon_group_name, [])
+
+    - import_role:
+        name: ceph-iscsi-gw
+        tasks_from: docker2podman.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: docker2podman.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: docker2podman.yml
+      when: inventory_hostname in groups.get(rbdmirror_group_name, [])
+
+    - import_role:
+        name: ceph-rgw
+        tasks_from: docker2podman.yml
+      when: inventory_hostname in groups.get(rgw_group_name, [])
+
+    # This is needed, otherwise containers won't come back after the reboot
+    # because this file is added later by the call of rolling_update playbook.
+    - name: add /etc/tmpfiles.d/ceph-common.conf
+      copy:
+        content: "d /run/ceph 0770 root root -"
+        dest: /etc/tmpfiles.d/ceph-common.conf
+        owner: root
+        group: root
+        mode: 0644
+
+    - name: reload systemd daemon
+      systemd:
+        daemon_reload: yes
\ No newline at end of file
index b2d51b2aa1cf7c162e0bb7d713f0f6d71f2af680..0833421e040325b151c1f349a19a3ee7e565153e 100644 (file)
@@ -547,6 +547,7 @@ ceph_tcmalloc_max_total_thread_cache: 0
 ##########
 # DOCKER #
 ##########
+container_binary: docker
 docker_exec_cmd:
 docker: false
 ceph_docker_image: "ceph/daemon"
diff --git a/roles/ceph-docker-common/tasks/ceph_docker_version.yml b/roles/ceph-docker-common/tasks/ceph_docker_version.yml
new file mode 100644 (file)
index 0000000..3126cdf
--- /dev/null
@@ -0,0 +1,10 @@
+---
+- 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] }}"
\ No newline at end of file
index 2a740f93a2d05292bc1740de706f17d44ebe334f..e5b2e6af7c1c8809df1be4f417e767573f0ce478 100644 (file)
   when:
     - mon_use_fqdn
 
-- 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] }}"
+- name: include ceph_docker_version.yml
+  include_tasks: ceph_docker_version.yml
 
 # Only include 'checks.yml' when :
 # we are deploying containers without kv AND host is either a mon OR a nfs OR an osd,
index 3e2fd037f9e356b9957db9e10d405c14524be41a..b1e2eb1f56b9f9fe7acd4d59e7db9da0bcce3652 100644 (file)
 ---
-- name: update apt cache
-  apt:
-    update-cache: yes
+- name: handlers
   when:
-    - ansible_os_family == 'Debian'
-
-- name: unset noup flag
-  command: "{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd unset noup"
-  delegate_to: "{{ groups[mon_group_name][0] }}"
-  changed_when: False
-
-# We only want to restart on hosts that have called the handler.
-# This var is set when he handler is called, and unset after the
-# restart to ensure only the correct hosts are restarted.
-- name: set _mon_handler_called before restart
-  set_fact:
-     _mon_handler_called: True
-  listen: "restart ceph mons"
-
-- name: copy mon restart script
-  template:
-    src: restart_mon_daemon.sh.j2
-    dest: /tmp/restart_mon_daemon.sh
-    owner: root
-    group: root
-    mode: 0750
-  listen: "restart ceph mons"
-  when:
-    - mon_group_name in group_names
-
-- name: restart ceph mon daemon(s) - non container
-  command: /usr/bin/env bash /tmp/restart_mon_daemon.sh
-  listen: "restart ceph mons"
-  when:
-    # We do not want to run these checks on initial deployment (`socket.rc == 0`)
-    - mon_group_name in group_names
-    - not containerized_deployment
-    - hostvars[item]['_mon_handler_called'] | default(False)
-    - mon_socket_stat.rc == 0
-  with_items: "{{ groups[mon_group_name] }}"
-  delegate_to: "{{ item }}"
-  run_once: True
-
-- name: restart ceph mon daemon(s) - container
-  command: /usr/bin/env bash /tmp/restart_mon_daemon.sh
-  listen: "restart ceph mons"
-  when:
-    # We do not want to run these checks on initial deployment (`socket.rc == 0`)
-    - mon_group_name in group_names
-    - containerized_deployment
-    - ceph_mon_container_stat.get('rc') == 0
-    - hostvars[item]['_mon_handler_called'] | default(False)
-    - ceph_mon_container_stat.get('stdout_lines', [])|length != 0
-  with_items: "{{ groups[mon_group_name] }}"
-  delegate_to: "{{ item }}"
-  run_once: True
-
-- name: set _mon_handler_called after restart
-  set_fact:
-     _mon_handler_called: False
-  listen: "restart ceph mons"
-
-- name: set _osd_handler_called before restart
-  set_fact:
-     _osd_handler_called: True
-  listen: "restart ceph osds"
-
-# This does not just restart OSDs but everything else too. Unfortunately
-# at this time the ansible role does not have an OSD id list to use
-# for restarting them specifically.
-# This does not need to run during a rolling update as the playbook will
-# restart all OSDs using the tasks "start ceph osd" or
-# "restart containerized ceph osd"
-- name: copy osd restart script
-  template:
-    src: restart_osd_daemon.sh.j2
-    dest: /tmp/restart_osd_daemon.sh
-    owner: root
-    group: root
-    mode: 0750
-  listen: "restart ceph osds"
-  when:
-    - osd_group_name in group_names
-    - not rolling_update
-
-- name: restart ceph osds daemon(s) - non container
-  command: /usr/bin/env bash /tmp/restart_osd_daemon.sh
-  listen: "restart ceph osds"
-  when:
-    - osd_group_name in group_names
-    - not containerized_deployment
-    - not rolling_update
-    # We do not want to run these checks on initial deployment (`socket_osd_container.results[n].rc == 0`)
-    # except when a crush location is specified. ceph-disk will start the osds before the osd crush location is specified
-    - osd_socket_stat.rc == 0
-    - ceph_current_status.fsid is defined
-    - handler_health_osd_check
-    - hostvars[item]['_osd_handler_called'] | default(False)
-  with_items: "{{ groups[osd_group_name] | intersect(ansible_play_batch) }}"
-  delegate_to: "{{ item }}"
-  run_once: True
-
-- name: restart ceph osds daemon(s) - container
-  command: /usr/bin/env bash /tmp/restart_osd_daemon.sh
-  listen: "restart ceph osds"
-  when:
-    # We do not want to run these checks on initial deployment (`socket_osd_container_stat.results[n].rc == 0`)
-    # except when a crush location is specified. ceph-disk will start the osds before the osd crush location is specified
-    - osd_group_name in group_names
-    - containerized_deployment
-    - not rolling_update
-    - ceph_osd_container_stat.get('rc') == 0
-    - ceph_osd_container_stat.get('stdout_lines', [])|length != 0
-    - handler_health_osd_check
-    - hostvars[item]['_osd_handler_called'] | default(False)
-  with_items: "{{ groups[osd_group_name] | intersect(ansible_play_batch) }}"
-  delegate_to: "{{ item }}"
-  run_once: True
-
-- name: set _osd_handler_called after restart
-  set_fact:
-     _osd_handler_called: False
-  listen: "restart ceph osds"
-
-- name: set _mds_handler_called before restart
-  set_fact:
-     _mds_handler_called: True
-  listen: "restart ceph mdss"
-
-- name: copy mds restart script
-  template:
-    src: restart_mds_daemon.sh.j2
-    dest: /tmp/restart_mds_daemon.sh
-    owner: root
-    group: root
-    mode: 0750
-  listen: "restart ceph mdss"
-  when:
-    - mds_group_name in group_names
-
-- name: restart ceph mds daemon(s) - non container
-  command: /usr/bin/env bash /tmp/restart_mds_daemon.sh
-  listen: "restart ceph mdss"
-  when:
-    # We do not want to run these checks on initial deployment (`socket.rc == 0`)
-    - mds_group_name in group_names
-    - not containerized_deployment
-    - hostvars[item]['_mds_handler_called'] | default(False)
-    - mds_socket_stat.rc == 0
-  with_items: "{{ groups[mds_group_name] }}"
-  delegate_to: "{{ item }}"
-  run_once: True
-
-- name: restart ceph mds daemon(s) - container
-  command: /usr/bin/env bash /tmp/restart_mds_daemon.sh
-  listen: "restart ceph mdss"
-  when:
-    # We do not want to run these checks on initial deployment (`socket.rc == 0`)
-    - mds_group_name in group_names
-    - containerized_deployment
-    - ceph_mds_container_stat.get('rc') == 0
-    - hostvars[item]['_mds_handler_called'] | default(False)
-    - ceph_mds_container_stat.get('stdout_lines', [])|length != 0
-  with_items: "{{ groups[mds_group_name] }}"
-  delegate_to: "{{ item }}"
-  run_once: True
-
-- name: set _mds_handler_called after restart
-  set_fact:
-     _mds_handler_called: False
-  listen: "restart ceph mdss"
-
-- name: set _rgw_handler_called before restart
-  set_fact:
-     _rgw_handler_called: True
-  listen: "restart ceph rgws"
-
-- name: copy rgw restart script
-  template:
-    src: restart_rgw_daemon.sh.j2
-    dest: /tmp/restart_rgw_daemon.sh
-    owner: root
-    group: root
-    mode: 0750
-  listen: "restart ceph rgws"
-  when:
-    - rgw_group_name in group_names
-
-- name: restart ceph rgw daemon(s) - non container
-  command: /usr/bin/env bash /tmp/restart_rgw_daemon.sh
-  listen: "restart ceph rgws"
-  when:
-    # We do not want to run these checks on initial deployment (`socket.rc == 0`)
-    - rgw_group_name in group_names
-    - not containerized_deployment
-    - hostvars[item]['_rgw_handler_called'] | default(False)
-    - rgw_socket_stat.rc == 0
-  with_items: "{{ groups[rgw_group_name] }}"
-  delegate_to: "{{ item }}"
-  run_once: True
-
-- name: restart ceph rgw daemon(s) - container
-  command: /usr/bin/env bash /tmp/restart_rgw_daemon.sh
-  listen: "restart ceph rgws"
-  when:
-    # We do not want to run these checks on initial deployment (`socket.rc == 0`)
-    - rgw_group_name in group_names
-    - containerized_deployment
-    - ceph_rgw_container_stat.get('rc') == 0
-    - hostvars[item]['_rgw_handler_called'] | default(False)
-    - ceph_rgw_container_stat.get('stdout_lines', [])|length != 0
-  with_items: "{{ groups[rgw_group_name] }}"
-  delegate_to: "{{ item }}"
-  run_once: True
-
-- name: set _rgw_handler_called after restart
-  set_fact:
-     _rgw_handler_called: False
-  listen: "restart ceph rgws"
-
-- name: set _nfs_handler_called before restart
-  set_fact:
-     _nfs_handler_called: True
-  listen: "restart ceph nfss"
-
-- name: copy nfs restart script
-  template:
-    src: restart_nfs_daemon.sh.j2
-    dest: /tmp/restart_nfs_daemon.sh
-    owner: root
-    group: root
-    mode: 0750
-  listen: "restart ceph nfss"
-  when:
-    - nfs_group_name in group_names
-
-- name: restart ceph nfs daemon(s) - non container
-  command: /usr/bin/env bash /tmp/restart_nfs_daemon.sh
-  listen: "restart ceph nfss"
-  when:
-    # We do not want to run these checks on initial deployment (`socket.rc == 0`)
-    - nfs_group_name in group_names
-    - not containerized_deployment
-    - hostvars[item]['_nfs_handler_called'] | default(False)
-    - nfs_socket_stat.rc == 0
-  with_items: "{{ groups[nfs_group_name] }}"
-  delegate_to: "{{ item }}"
-  run_once: True
-
-- name: restart ceph nfs daemon(s) - container
-  command: /usr/bin/env bash /tmp/restart_nfs_daemon.sh
-  listen: "restart ceph nfss"
-  when:
-    # We do not want to run these checks on initial deployment (`socket.rc == 0`)
-    - nfs_group_name in group_names
-    - containerized_deployment
-    - ceph_nfs_container_stat.get('rc') == 0
-    - hostvars[item]['_nfs_handler_called'] | default(False)
-    - ceph_nfs_container_stat.get('stdout_lines', [])|length != 0
-  with_items: "{{ groups[nfs_group_name] }}"
-  delegate_to: "{{ item }}"
-  run_once: True
-
-- name: set _nfs_handler_called after restart
-  set_fact:
-     _nfs_handler_called: False
-  listen: "restart ceph nfss"
-
-- name: set _rbdmirror_handler_called before restart
-  set_fact:
-     _rbdmirror_handler_called: True
-  listen: "restart ceph rbdmirrors"
-
-- name: copy rbd mirror restart script
-  template:
-    src: restart_rbd_mirror_daemon.sh.j2
-    dest: /tmp/restart_rbd_mirror_daemon.sh
-    owner: root
-    group: root
-    mode: 0750
-  listen: "restart ceph rbdmirrors"
-  when:
-    - rbdmirror_group_name in group_names
-
-- name: restart ceph rbd mirror daemon(s) - non container
-  command: /usr/bin/env bash /tmp/restart_rbd_mirror_daemon.sh
-  listen: "restart ceph rbdmirrors"
-  when:
-    # We do not want to run these checks on initial deployment (`socket.rc == 0`)
-    - rbdmirror_group_name in group_names
-    - not containerized_deployment
-    - hostvars[item]['_rbdmirror_handler_called'] | default(False)
-    - rbd_mirror_socket_stat.rc == 0
-  with_items: "{{ groups[rbdmirror_group_name] }}"
-  delegate_to: "{{ item }}"
-  run_once: True
-
-- name: restart ceph rbd mirror daemon(s) - container
-  command: /usr/bin/env bash /tmp/restart_rbd_mirror_daemon.sh
-  listen: "restart ceph rbdmirrors"
-  when:
-    # We do not want to run these checks on initial deployment (`socket.rc == 0`)
-    - rbdmirror_group_name in group_names
-    - containerized_deployment
-    - ceph_rbd_mirror_container_stat.get('rc') == 0
-    - hostvars[item]['_rbdmirror_handler_called'] | default(False)
-    - ceph_rbd_mirror_container_stat.get('stdout_lines', [])|length != 0
-  with_items: "{{ groups[rbdmirror_group_name] }}"
-  delegate_to: "{{ item }}"
-  run_once: True
-
-- name: set _rbdmirror_handler_called after restart
-  set_fact:
-     _rbdmirror_handler_called: False
-  listen: "restart ceph rbdmirrors"
-
-- name: set _mgr_handler_called before restart
-  set_fact:
-     _mgr_handler_called: True
-  listen: "restart ceph mgrs"
-
-- name: copy mgr restart script
-  template:
-    src: restart_mgr_daemon.sh.j2
-    dest: /tmp/restart_mgr_daemon.sh
-    owner: root
-    group: root
-    mode: 0750
-  listen: "restart ceph mgrs"
-  when:
-    - mgr_group_name in group_names
-
-- name: restart ceph mgr daemon(s) - non container
-  command: /usr/bin/env bash /tmp/restart_mgr_daemon.sh
-  listen: "restart ceph mgrs"
-  when:
-    # We do not want to run these checks on initial deployment (`socket.rc == 0`)
-    - mgr_group_name in group_names
-    - not containerized_deployment
-    - hostvars[item]['_mgr_handler_called'] | default(False)
-    - mgr_socket_stat.rc == 0
-  with_items: "{{ groups[mgr_group_name] }}"
-  delegate_to: "{{ item }}"
-  run_once: True
-
-- name: restart ceph mgr daemon(s) - container
-  command: /usr/bin/env bash /tmp/restart_mgr_daemon.sh
-  listen: "restart ceph mgrs"
-  when:
-    # We do not want to run these checks on initial deployment (`socket.rc == 0`)
-    - mgr_group_name in group_names
-    - containerized_deployment
-    - ceph_mgr_container_stat.get('rc') == 0
-    - hostvars[item]['_mgr_handler_called'] | default(False)
-    - ceph_mgr_container_stat.get('stdout_lines', [])|length != 0
-  with_items: "{{ groups[mgr_group_name] }}"
-  delegate_to: "{{ item }}"
-  run_once: True
-
-- name: set _mgr_handler_called after restart
-  set_fact:
-     _mgr_handler_called: False
-  listen: "restart ceph mgrs"
-
-- name: set _tcmu_runner_handler_called before restart
-  set_fact:
-     _tcmu_runner_handler_called: True
-  listen: "restart ceph tcmu-runner"
-
-- name: copy tcmu-runner restart script
-  template:
-    src: restart_tcmu_runner.sh.j2
-    dest: /tmp/restart_tcmu_runner.sh
-    owner: root
-    group: root
-    mode: 0750
-  listen: "restart ceph tcmu-runner"
-  when:
-    - iscsi_gw_group_name in group_names
-
-- name: restart tcmu-runner
-  command: /usr/bin/env bash /tmp/restart_tcmu_runner.sh
-  listen: "restart ceph tcmu-runner"
-  when:
-    - iscsi_gw_group_name in group_names
-    - ceph_tcmu_runner_stat.get('rc') == 0
-    - hostvars[item]['_tcmu_runner_handler_called'] | default(False)
-    - ceph_tcmu_runner_stat.get('stdout_lines', [])|length != 0
-  with_items: "{{ groups[iscsi_gw_group_name] }}"
-  delegate_to: "{{ item }}"
-  run_once: True
-
-- name: set _tcmu_runner_handler_called after restart
-  set_fact:
-     _tcmu_runner_handler_called: False
-  listen: "restart ceph tcmu-runner"
-
-- name: set _rbd_target_gw_handler_called before restart
-  set_fact:
-     _rbd_target_gw_handler_called: True
-  listen: "restart ceph rbd-target-gw"
-
-- name: copy rbd-target-gw restart script
-  template:
-    src: restart_rbd_target_gw.sh.j2
-    dest: /tmp/restart_rbd_target_gw.sh
-    owner: root
-    group: root
-    mode: 0750
-  listen: "restart ceph rbd-target-gw"
-  when:
-    - iscsi_gw_group_name in group_names
-
-- name: restart rbd-target-gw
-  command: /usr/bin/env bash /tmp/restart_rbd_target_gw.sh
-  listen: "restart ceph rbd-target-gw"
-  when:
-    - iscsi_gw_group_name in group_names
-    - ceph_rbd_target_gw_stat.get('rc') == 0
-    - hostvars[item]['_rbd_target_gw_handler_called'] | default(False)
-    - ceph_rbd_target_gw_stat.get('stdout_lines', [])|length != 0
-  with_items: "{{ groups[iscsi_gw_group_name] }}"
-  delegate_to: "{{ item }}"
-  run_once: True
-
-- name: set _rbd_target_gw_handler_called after restart
-  set_fact:
-     _rbd_target_gw_handler_called: False
-  listen: "restart ceph rbd-target-gw"
-
-- name: set _rbd_target_api_handler_called before restart
-  set_fact:
-     _rbd_target_api_handler_called: True
-  listen: "restart ceph rbd-target-api"
-
-- name: copy rbd-target-api restart script
-  template:
-    src: restart_rbd_target_api.sh.j2
-    dest: /tmp/restart_rbd_target_api.sh
-    owner: root
-    group: root
-    mode: 0750
-  listen: "restart ceph rbd-target-api"
-  when:
-    - iscsi_gw_group_name in group_names
-
-- name: restart rbd-target-api
-  command: /usr/bin/env bash /tmp/restart_rbd_target_api.sh
-  listen: "restart ceph rbd-target-api"
-  when:
-    - iscsi_gw_group_name in group_names
-    - ceph_rbd_target_api_stat.get('rc') == 0
-    - hostvars[item]['_rbd_target_api_handler_called'] | default(False)
-    - ceph_rbd_target_api_stat.get('stdout_lines', [])|length != 0
-  with_items: "{{ groups[iscsi_gw_group_name] }}"
-  delegate_to: "{{ item }}"
-  run_once: True
-
-- name: set _rbd_target_api_handler_called after restart
-  set_fact:
-     _rbd_target_api_handler_called: False
-  listen: "restart ceph rbd-target-api"
+     - not docker2podman | default(False) | bool
+  block:
+    - name: update apt cache
+      apt:
+        update-cache: yes
+      when:
+        - ansible_os_family == 'Debian'
+
+    - name: unset noup flag
+      command: "{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd unset noup"
+      delegate_to: "{{ groups[mon_group_name][0] }}"
+      changed_when: False
+
+    # We only want to restart on hosts that have called the handler.
+    # This var is set when he handler is called, and unset after the
+    # restart to ensure only the correct hosts are restarted.
+    - name: set _mon_handler_called before restart
+      set_fact:
+        _mon_handler_called: True
+      listen: "restart ceph mons"
+
+    - name: copy mon restart script
+      template:
+        src: restart_mon_daemon.sh.j2
+        dest: /tmp/restart_mon_daemon.sh
+        owner: root
+        group: root
+        mode: 0750
+      listen: "restart ceph mons"
+      when:
+        - mon_group_name in group_names
+
+    - name: restart ceph mon daemon(s) - non container
+      command: /usr/bin/env bash /tmp/restart_mon_daemon.sh
+      listen: "restart ceph mons"
+      when:
+        # We do not want to run these checks on initial deployment (`socket.rc == 0`)
+        - mon_group_name in group_names
+        - not containerized_deployment
+        - hostvars[item]['_mon_handler_called'] | default(False)
+        - mon_socket_stat.rc == 0
+      with_items: "{{ groups[mon_group_name] }}"
+      delegate_to: "{{ item }}"
+      run_once: True
+
+    - name: restart ceph mon daemon(s) - container
+      command: /usr/bin/env bash /tmp/restart_mon_daemon.sh
+      listen: "restart ceph mons"
+      when:
+        # We do not want to run these checks on initial deployment (`socket.rc == 0`)
+        - mon_group_name in group_names
+        - containerized_deployment
+        - ceph_mon_container_stat.get('rc') == 0
+        - hostvars[item]['_mon_handler_called'] | default(False)
+        - ceph_mon_container_stat.get('stdout_lines', [])|length != 0
+      with_items: "{{ groups[mon_group_name] }}"
+      delegate_to: "{{ item }}"
+      run_once: True
+
+    - name: set _mon_handler_called after restart
+      set_fact:
+        _mon_handler_called: False
+      listen: "restart ceph mons"
+
+    - name: set _osd_handler_called before restart
+      set_fact:
+        _osd_handler_called: True
+      listen: "restart ceph osds"
+
+    # This does not just restart OSDs but everything else too. Unfortunately
+    # at this time the ansible role does not have an OSD id list to use
+    # for restarting them specifically.
+    # This does not need to run during a rolling update as the playbook will
+    # restart all OSDs using the tasks "start ceph osd" or
+    # "restart containerized ceph osd"
+    - name: copy osd restart script
+      template:
+        src: restart_osd_daemon.sh.j2
+        dest: /tmp/restart_osd_daemon.sh
+        owner: root
+        group: root
+        mode: 0750
+      listen: "restart ceph osds"
+      when:
+        - osd_group_name in group_names
+        - not rolling_update
+
+    - name: restart ceph osds daemon(s) - non container
+      command: /usr/bin/env bash /tmp/restart_osd_daemon.sh
+      listen: "restart ceph osds"
+      when:
+        - osd_group_name in group_names
+        - not containerized_deployment
+        - not rolling_update
+        # We do not want to run these checks on initial deployment (`socket_osd_container.results[n].rc == 0`)
+        # except when a crush location is specified. ceph-disk will start the osds before the osd crush location is specified
+        - osd_socket_stat.rc == 0
+        - ceph_current_status.fsid is defined
+        - handler_health_osd_check
+        - hostvars[item]['_osd_handler_called'] | default(False)
+      with_items: "{{ groups[osd_group_name] | intersect(ansible_play_batch) }}"
+      delegate_to: "{{ item }}"
+      run_once: True
+
+    - name: restart ceph osds daemon(s) - container
+      command: /usr/bin/env bash /tmp/restart_osd_daemon.sh
+      listen: "restart ceph osds"
+      when:
+        # We do not want to run these checks on initial deployment (`socket_osd_container_stat.results[n].rc == 0`)
+        # except when a crush location is specified. ceph-disk will start the osds before the osd crush location is specified
+        - osd_group_name in group_names
+        - containerized_deployment
+        - not rolling_update
+        - ceph_osd_container_stat.get('rc') == 0
+        - ceph_osd_container_stat.get('stdout_lines', [])|length != 0
+        - handler_health_osd_check
+        - hostvars[item]['_osd_handler_called'] | default(False)
+      with_items: "{{ groups[osd_group_name] | intersect(ansible_play_batch) }}"
+      delegate_to: "{{ item }}"
+      run_once: True
+
+    - name: set _osd_handler_called after restart
+      set_fact:
+        _osd_handler_called: False
+      listen: "restart ceph osds"
+
+    - name: set _mds_handler_called before restart
+      set_fact:
+        _mds_handler_called: True
+      listen: "restart ceph mdss"
+
+    - name: copy mds restart script
+      template:
+        src: restart_mds_daemon.sh.j2
+        dest: /tmp/restart_mds_daemon.sh
+        owner: root
+        group: root
+        mode: 0750
+      listen: "restart ceph mdss"
+      when:
+        - mds_group_name in group_names
+
+    - name: restart ceph mds daemon(s) - non container
+      command: /usr/bin/env bash /tmp/restart_mds_daemon.sh
+      listen: "restart ceph mdss"
+      when:
+        # We do not want to run these checks on initial deployment (`socket.rc == 0`)
+        - mds_group_name in group_names
+        - not containerized_deployment
+        - hostvars[item]['_mds_handler_called'] | default(False)
+        - mds_socket_stat.rc == 0
+      with_items: "{{ groups[mds_group_name] }}"
+      delegate_to: "{{ item }}"
+      run_once: True
+
+    - name: restart ceph mds daemon(s) - container
+      command: /usr/bin/env bash /tmp/restart_mds_daemon.sh
+      listen: "restart ceph mdss"
+      when:
+        # We do not want to run these checks on initial deployment (`socket.rc == 0`)
+        - mds_group_name in group_names
+        - containerized_deployment
+        - ceph_mds_container_stat.get('rc') == 0
+        - hostvars[item]['_mds_handler_called'] | default(False)
+        - ceph_mds_container_stat.get('stdout_lines', [])|length != 0
+      with_items: "{{ groups[mds_group_name] }}"
+      delegate_to: "{{ item }}"
+      run_once: True
+
+    - name: set _mds_handler_called after restart
+      set_fact:
+        _mds_handler_called: False
+      listen: "restart ceph mdss"
+
+    - name: set _rgw_handler_called before restart
+      set_fact:
+        _rgw_handler_called: True
+      listen: "restart ceph rgws"
+
+    - name: copy rgw restart script
+      template:
+        src: restart_rgw_daemon.sh.j2
+        dest: /tmp/restart_rgw_daemon.sh
+        owner: root
+        group: root
+        mode: 0750
+      listen: "restart ceph rgws"
+      when:
+        - rgw_group_name in group_names
+
+    - name: restart ceph rgw daemon(s) - non container
+      command: /usr/bin/env bash /tmp/restart_rgw_daemon.sh
+      listen: "restart ceph rgws"
+      when:
+        # We do not want to run these checks on initial deployment (`socket.rc == 0`)
+        - rgw_group_name in group_names
+        - not containerized_deployment
+        - hostvars[item]['_rgw_handler_called'] | default(False)
+        - rgw_socket_stat.rc == 0
+      with_items: "{{ groups[rgw_group_name] }}"
+      delegate_to: "{{ item }}"
+      run_once: True
+
+    - name: restart ceph rgw daemon(s) - container
+      command: /usr/bin/env bash /tmp/restart_rgw_daemon.sh
+      listen: "restart ceph rgws"
+      when:
+        # We do not want to run these checks on initial deployment (`socket.rc == 0`)
+        - rgw_group_name in group_names
+        - containerized_deployment
+        - ceph_rgw_container_stat.get('rc') == 0
+        - hostvars[item]['_rgw_handler_called'] | default(False)
+        - ceph_rgw_container_stat.get('stdout_lines', [])|length != 0
+      with_items: "{{ groups[rgw_group_name] }}"
+      delegate_to: "{{ item }}"
+      run_once: True
+
+    - name: set _rgw_handler_called after restart
+      set_fact:
+        _rgw_handler_called: False
+      listen: "restart ceph rgws"
+
+    - name: set _nfs_handler_called before restart
+      set_fact:
+        _nfs_handler_called: True
+      listen: "restart ceph nfss"
+
+    - name: copy nfs restart script
+      template:
+        src: restart_nfs_daemon.sh.j2
+        dest: /tmp/restart_nfs_daemon.sh
+        owner: root
+        group: root
+        mode: 0750
+      listen: "restart ceph nfss"
+      when:
+        - nfs_group_name in group_names
+
+    - name: restart ceph nfs daemon(s) - non container
+      command: /usr/bin/env bash /tmp/restart_nfs_daemon.sh
+      listen: "restart ceph nfss"
+      when:
+        # We do not want to run these checks on initial deployment (`socket.rc == 0`)
+        - nfs_group_name in group_names
+        - not containerized_deployment
+        - hostvars[item]['_nfs_handler_called'] | default(False)
+        - nfs_socket_stat.rc == 0
+      with_items: "{{ groups[nfs_group_name] }}"
+      delegate_to: "{{ item }}"
+      run_once: True
+
+    - name: restart ceph nfs daemon(s) - container
+      command: /usr/bin/env bash /tmp/restart_nfs_daemon.sh
+      listen: "restart ceph nfss"
+      when:
+        # We do not want to run these checks on initial deployment (`socket.rc == 0`)
+        - nfs_group_name in group_names
+        - containerized_deployment
+        - ceph_nfs_container_stat.get('rc') == 0
+        - hostvars[item]['_nfs_handler_called'] | default(False)
+        - ceph_nfs_container_stat.get('stdout_lines', [])|length != 0
+      with_items: "{{ groups[nfs_group_name] }}"
+      delegate_to: "{{ item }}"
+      run_once: True
+
+    - name: set _nfs_handler_called after restart
+      set_fact:
+        _nfs_handler_called: False
+      listen: "restart ceph nfss"
+
+    - name: set _rbdmirror_handler_called before restart
+      set_fact:
+        _rbdmirror_handler_called: True
+      listen: "restart ceph rbdmirrors"
+
+    - name: copy rbd mirror restart script
+      template:
+        src: restart_rbd_mirror_daemon.sh.j2
+        dest: /tmp/restart_rbd_mirror_daemon.sh
+        owner: root
+        group: root
+        mode: 0750
+      listen: "restart ceph rbdmirrors"
+      when:
+        - rbdmirror_group_name in group_names
+
+    - name: restart ceph rbd mirror daemon(s) - non container
+      command: /usr/bin/env bash /tmp/restart_rbd_mirror_daemon.sh
+      listen: "restart ceph rbdmirrors"
+      when:
+        # We do not want to run these checks on initial deployment (`socket.rc == 0`)
+        - rbdmirror_group_name in group_names
+        - not containerized_deployment
+        - hostvars[item]['_rbdmirror_handler_called'] | default(False)
+        - rbd_mirror_socket_stat.rc == 0
+      with_items: "{{ groups[rbdmirror_group_name] }}"
+      delegate_to: "{{ item }}"
+      run_once: True
+
+    - name: restart ceph rbd mirror daemon(s) - container
+      command: /usr/bin/env bash /tmp/restart_rbd_mirror_daemon.sh
+      listen: "restart ceph rbdmirrors"
+      when:
+        # We do not want to run these checks on initial deployment (`socket.rc == 0`)
+        - rbdmirror_group_name in group_names
+        - containerized_deployment
+        - ceph_rbd_mirror_container_stat.get('rc') == 0
+        - hostvars[item]['_rbdmirror_handler_called'] | default(False)
+        - ceph_rbd_mirror_container_stat.get('stdout_lines', [])|length != 0
+      with_items: "{{ groups[rbdmirror_group_name] }}"
+      delegate_to: "{{ item }}"
+      run_once: True
+
+    - name: set _rbdmirror_handler_called after restart
+      set_fact:
+        _rbdmirror_handler_called: False
+      listen: "restart ceph rbdmirrors"
+
+    - name: set _mgr_handler_called before restart
+      set_fact:
+        _mgr_handler_called: True
+      listen: "restart ceph mgrs"
+
+    - name: copy mgr restart script
+      template:
+        src: restart_mgr_daemon.sh.j2
+        dest: /tmp/restart_mgr_daemon.sh
+        owner: root
+        group: root
+        mode: 0750
+      listen: "restart ceph mgrs"
+      when:
+        - mgr_group_name in group_names
+
+    - name: restart ceph mgr daemon(s) - non container
+      command: /usr/bin/env bash /tmp/restart_mgr_daemon.sh
+      listen: "restart ceph mgrs"
+      when:
+        # We do not want to run these checks on initial deployment (`socket.rc == 0`)
+        - mgr_group_name in group_names
+        - not containerized_deployment
+        - hostvars[item]['_mgr_handler_called'] | default(False)
+        - mgr_socket_stat.rc == 0
+      with_items: "{{ groups[mgr_group_name] }}"
+      delegate_to: "{{ item }}"
+      run_once: True
+
+    - name: restart ceph mgr daemon(s) - container
+      command: /usr/bin/env bash /tmp/restart_mgr_daemon.sh
+      listen: "restart ceph mgrs"
+      when:
+        # We do not want to run these checks on initial deployment (`socket.rc == 0`)
+        - mgr_group_name in group_names
+        - containerized_deployment
+        - ceph_mgr_container_stat.get('rc') == 0
+        - hostvars[item]['_mgr_handler_called'] | default(False)
+        - ceph_mgr_container_stat.get('stdout_lines', [])|length != 0
+      with_items: "{{ groups[mgr_group_name] }}"
+      delegate_to: "{{ item }}"
+      run_once: True
+
+    - name: set _mgr_handler_called after restart
+      set_fact:
+        _mgr_handler_called: False
+      listen: "restart ceph mgrs"
+
+    - name: set _tcmu_runner_handler_called before restart
+      set_fact:
+        _tcmu_runner_handler_called: True
+      listen: "restart ceph tcmu-runner"
+
+    - name: copy tcmu-runner restart script
+      template:
+        src: restart_tcmu_runner.sh.j2
+        dest: /tmp/restart_tcmu_runner.sh
+        owner: root
+        group: root
+        mode: 0750
+      listen: "restart ceph tcmu-runner"
+      when:
+        - iscsi_gw_group_name in group_names
+
+    - name: restart tcmu-runner
+      command: /usr/bin/env bash /tmp/restart_tcmu_runner.sh
+      listen: "restart ceph tcmu-runner"
+      when:
+        - iscsi_gw_group_name in group_names
+        - ceph_tcmu_runner_stat.get('rc') == 0
+        - hostvars[item]['_tcmu_runner_handler_called'] | default(False)
+        - ceph_tcmu_runner_stat.get('stdout_lines', [])|length != 0
+      with_items: "{{ groups[iscsi_gw_group_name] }}"
+      delegate_to: "{{ item }}"
+      run_once: True
+
+    - name: set _tcmu_runner_handler_called after restart
+      set_fact:
+        _tcmu_runner_handler_called: False
+      listen: "restart ceph tcmu-runner"
+
+    - name: set _rbd_target_gw_handler_called before restart
+      set_fact:
+        _rbd_target_gw_handler_called: True
+      listen: "restart ceph rbd-target-gw"
+
+    - name: copy rbd-target-gw restart script
+      template:
+        src: restart_rbd_target_gw.sh.j2
+        dest: /tmp/restart_rbd_target_gw.sh
+        owner: root
+        group: root
+        mode: 0750
+      listen: "restart ceph rbd-target-gw"
+      when:
+        - iscsi_gw_group_name in group_names
+
+    - name: restart rbd-target-gw
+      command: /usr/bin/env bash /tmp/restart_rbd_target_gw.sh
+      listen: "restart ceph rbd-target-gw"
+      when:
+        - iscsi_gw_group_name in group_names
+        - ceph_rbd_target_gw_stat.get('rc') == 0
+        - hostvars[item]['_rbd_target_gw_handler_called'] | default(False)
+        - ceph_rbd_target_gw_stat.get('stdout_lines', [])|length != 0
+      with_items: "{{ groups[iscsi_gw_group_name] }}"
+      delegate_to: "{{ item }}"
+      run_once: True
+
+    - name: set _rbd_target_gw_handler_called after restart
+      set_fact:
+        _rbd_target_gw_handler_called: False
+      listen: "restart ceph rbd-target-gw"
+
+    - name: set _rbd_target_api_handler_called before restart
+      set_fact:
+        _rbd_target_api_handler_called: True
+      listen: "restart ceph rbd-target-api"
+
+    - name: copy rbd-target-api restart script
+      template:
+        src: restart_rbd_target_api.sh.j2
+        dest: /tmp/restart_rbd_target_api.sh
+        owner: root
+        group: root
+        mode: 0750
+      listen: "restart ceph rbd-target-api"
+      when:
+        - iscsi_gw_group_name in group_names
+
+    - name: restart rbd-target-api
+      command: /usr/bin/env bash /tmp/restart_rbd_target_api.sh
+      listen: "restart ceph rbd-target-api"
+      when:
+        - iscsi_gw_group_name in group_names
+        - ceph_rbd_target_api_stat.get('rc') == 0
+        - hostvars[item]['_rbd_target_api_handler_called'] | default(False)
+        - ceph_rbd_target_api_stat.get('stdout_lines', [])|length != 0
+      with_items: "{{ groups[iscsi_gw_group_name] }}"
+      delegate_to: "{{ item }}"
+      run_once: True
+
+    - name: set _rbd_target_api_handler_called after restart
+      set_fact:
+        _rbd_target_api_handler_called: False
+      listen: "restart ceph rbd-target-api"
index a7316c475bab790c2136fc81c7d9503f9dd95089..31047c94266d34d26ddbd8e064ffc28d890cd27f 100644 (file)
@@ -1,18 +1,6 @@
 ---
-- 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 }}
+- name: include 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/container/systemd.yml b/roles/ceph-iscsi-gw/tasks/container/systemd.yml
new file mode 100644 (file)
index 0000000..4c6fdf7
--- /dev/null
@@ -0,0 +1,15 @@
+---
+- 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 }}
\ No newline at end of file
diff --git a/roles/ceph-iscsi-gw/tasks/docker2podman.yml b/roles/ceph-iscsi-gw/tasks/docker2podman.yml
new file mode 120000 (symlink)
index 0000000..d6386d3
--- /dev/null
@@ -0,0 +1 @@
+container/systemd.yml
\ No newline at end of file
index e3753c76ace4e4ff1827ec1124f6c43f62e64268..89812e931d581280f0b40ed6fb0636acf86d8562 100644 (file)
@@ -1,15 +1,19 @@
 [Unit]
 Description=RBD Target API Service
+{% if container_binary == 'docker' %}
 After=docker.service
 Requires=docker.service
+{% else %}
+After=network.target
+{% endif %}
 
 [Service]
 EnvironmentFile=-/etc/environment
-ExecStartPre=-/usr/bin/docker stop rbd-target-api
-ExecStartPre=-/usr/bin/docker rm rbd-target-api
-ExecStart=/usr/bin/docker run --rm \
+ExecStartPre=-/usr/bin/{{ container_binary }} stop rbd-target-api
+ExecStartPre=-/usr/bin/{{ container_binary }} rm rbd-target-api
+ExecStart=/usr/bin/{{ container_binary }} run --rm \
   --memory={{ ceph_rbd_target_api_docker_memory_limit }} \
-  {% if ceph_docker_version.split('.')[0] is version_compare('13', '>=') -%}
+  {% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version_compare('13', '>=')) or container_binary == 'podman' -%}
   --cpus={{ ceph_rbd_target_api_docker_cpu_limit }} \
   {% else -%}
   --cpu-quota={{ ceph_rbd_target_api_docker_cpu_limit * 100000 }} \
@@ -25,7 +29,7 @@ ExecStart=/usr/bin/docker run --rm \
   -e CEPH_DAEMON=RBD_TARGET_API \
   --name=rbd-target-api \
   {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
-ExecStopPost=-/usr/bin/docker stop rbd-target-api
+ExecStopPost=-/usr/bin/{{ container_binary }} stop rbd-target-api
 Restart=always
 RestartSec=10s
 TimeoutStartSec=120
index a9ba58859d26fd03f90a297719e234881fab7b7e..416cb5fd28bf18d0ab11769c5e9e69aaa63388dd 100644 (file)
@@ -1,15 +1,19 @@
 [Unit]
 Description=RBD Target Gateway Service
+{% if container_binary == 'docker' %}
 After=docker.service
 Requires=docker.service
+{% else %}
+After=network.target
+{% endif %}
 
 [Service]
 EnvironmentFile=-/etc/environment
-ExecStartPre=-/usr/bin/docker stop rbd-target-gw
-ExecStartPre=-/usr/bin/docker rm rbd-target-gw
-ExecStart=/usr/bin/docker run --rm \
+ExecStartPre=-/usr/bin/{{ container_binary }} stop rbd-target-gw
+ExecStartPre=-/usr/bin/{{ container_binary }} rm rbd-target-gw
+ExecStart=/usr/bin/{{ container_binary }} run --rm \
   --memory={{ ceph_rbd_target_gw_docker_memory_limit }} \
-  {% if ceph_docker_version.split('.')[0] is version_compare('13', '>=') -%}
+  {% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version_compare('13', '>=')) or container_binary == 'podman' -%}
   --cpus={{ ceph_rbd_target_gw_docker_cpu_limit }} \
   {% else -%}
   --cpu-quota={{ ceph_rbd_target_gw_docker_cpu_limit * 100000 }} \
@@ -25,7 +29,8 @@ ExecStart=/usr/bin/docker run --rm \
   -e CEPH_DAEMON=RBD_TARGET_GW \
   --name=rbd-target-gw \
   {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
-ExecStopPost=-/usr/bin/docker stop rbd-target-gw
+ExecStopPost=-/usr/bin/{{ container_binary }} stop rbd-target-gw
+KillMode=none
 Restart=always
 RestartSec=10s
 TimeoutStartSec=120
index 56b0a21b7af2c62f653253f4728ed67d9c4c426c..7d4bc8d1af3b3a0ec18c395c6557f999b58fcb70 100644 (file)
@@ -1,15 +1,19 @@
 [Unit]
 Description=TCMU Runner
+{% if container_binary == 'docker' %}
 After=docker.service
 Requires=docker.service
+{% else %}
+After=network.target
+{% endif %}
 
 [Service]
 EnvironmentFile=-/etc/environment
-ExecStartPre=-/usr/bin/docker stop tcmu-runner
-ExecStartPre=-/usr/bin/docker rm tcmu-runner
-ExecStart=/usr/bin/docker run --rm \
+ExecStartPre=-/usr/bin/{{ container_binary }} stop tcmu-runner
+ExecStartPre=-/usr/bin/{{ container_binary }} rm tcmu-runner
+ExecStart=/usr/bin/{{ container_binary }} run --rm \
   --memory={{ ceph_tcmu_runner_docker_memory_limit }} \
-  {% if ceph_docker_version.split('.')[0] is version_compare('13', '>=') -%}
+  {% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version_compare('13', '>=')) or container_binary == 'podman' -%}
   --cpus={{ ceph_tcmu_runner_docker_cpu_limit }} \
   {% else -%}
   --cpu-quota={{ ceph_tcmu_runner_docker_cpu_limit * 100000 }} \
@@ -25,7 +29,7 @@ ExecStart=/usr/bin/docker run --rm \
   -e CEPH_DAEMON=TCMU_RUNNER \
   --name=tcmu-runner \
   {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
-ExecStopPost=-/usr/bin/docker stop tcmu-runner
+ExecStopPost=-/usr/bin/{{ container_binary }} stop tcmu-runner
 Restart=always
 RestartSec=10s
 TimeoutStartSec=120
index 7c6bebdb692a26c881a3f221c663f3c82eba6782..27d86c57b046fec2a85b2c927be85b5559d11c3d 100644 (file)
     - "{{ statconfig.results }}"
   when: item.1.stat.exists == true
 
-- 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 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 (file)
index 0000000..f41a76a
--- /dev/null
@@ -0,0 +1,11 @@
+---
+- 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
index 5eee48cdebe0688ebef66404ed0af3ac27ff075b..26cbd0f7bcb93cd0eff46d4837ea4dd5c1af622e 100644 (file)
@@ -1,16 +1,20 @@
 [Unit]
 Description=Ceph MDS
+{% if container_binary == 'docker' %}
 After=docker.service
 Requires=docker.service
+{% else %}
+After=network.target
+{% endif %}
 {% set cpu_limit = ansible_processor_vcpus|int if ceph_mds_docker_cpu_limit|int > ansible_processor_vcpus|int else ceph_mds_docker_cpu_limit|int %}
 
 [Service]
 EnvironmentFile=-/etc/environment
-ExecStartPre=-/usr/bin/docker stop ceph-mds-{{ ansible_hostname }}
-ExecStartPre=-/usr/bin/docker rm ceph-mds-{{ ansible_hostname }}
-ExecStart=/usr/bin/docker run --rm --net=host \
+ExecStartPre=-/usr/bin/{{ container_binary }} stop ceph-mds-{{ ansible_hostname }}
+ExecStartPre=-/usr/bin/{{ container_binary }} rm ceph-mds-{{ ansible_hostname }}
+ExecStart=/usr/bin/{{ container_binary }} run --rm --net=host \
   --memory={{ ceph_mds_docker_memory_limit }} \
-  {% if ceph_docker_version.split('.')[0] is version_compare('13', '>=') -%}
+  {% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version_compare('13', '>=')) or container_binary == 'podman' -%}
   --cpus={{ cpu_limit }} \
   {% else -%}
   --cpu-quota={{ cpu_limit * 100000 }} \
@@ -30,7 +34,7 @@ ExecStart=/usr/bin/docker run --rm --net=host \
   {{ ceph_mds_docker_extra_env }} \
   --name=ceph-mds-{{ ansible_hostname }} \
   {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
-ExecStopPost=-/usr/bin/docker stop ceph-mds-{{ ansible_hostname }}
+ExecStopPost=-/usr/bin/{{ container_binary }} stop ceph-mds-{{ ansible_hostname }}
 Restart=always
 RestartSec=10s
 TimeoutStartSec=120
index 40e623bf899579c35e7a4d4fc070cd31d9d82dcc..8e00ccf445355a28a21ba6a5b7ae2e572f970ce4 100644 (file)
@@ -1,14 +1,6 @@
 ---
-- 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
+- name: include systemd.yml
+  include_tasks: systemd.yml
 
 - name: systemd start mgr container
   systemd:
diff --git a/roles/ceph-mgr/tasks/docker/systemd.yml b/roles/ceph-mgr/tasks/docker/systemd.yml
new file mode 100644 (file)
index 0000000..7e147d2
--- /dev/null
@@ -0,0 +1,11 @@
+---
+- 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-mgr/tasks/docker2podman.yml b/roles/ceph-mgr/tasks/docker2podman.yml
new file mode 120000 (symlink)
index 0000000..4b74804
--- /dev/null
@@ -0,0 +1 @@
+docker/systemd.yml
\ No newline at end of file
index bb950953755b7ff09114589adfc9717118c94f72..c0a4ad68b50d399654cd16b4810a00c6a1106e78 100644 (file)
@@ -1,15 +1,19 @@
 [Unit]
 Description=Ceph Manager
+{% if container_binary == 'docker' %}
 After=docker.service
 Requires=docker.service
+{% else %}
+After=network.target
+{% endif %}
 
 [Service]
 EnvironmentFile=-/etc/environment
-ExecStartPre=-/usr/bin/docker stop ceph-mgr-{{ ansible_hostname }}
-ExecStartPre=-/usr/bin/docker rm ceph-mgr-{{ ansible_hostname }}
-ExecStart=/usr/bin/docker run --rm --net=host \
+ExecStartPre=-/usr/bin/{{ container_binary }} stop ceph-mgr-{{ ansible_hostname }}
+ExecStartPre=-/usr/bin/{{ container_binary }} rm ceph-mgr-{{ ansible_hostname }}
+ExecStart=/usr/bin/{{ container_binary }} run --rm --net=host \
   --memory={{ ceph_mgr_docker_memory_limit }} \
-  {% if ceph_docker_version.split('.')[0] is version_compare('13', '>=') -%}
+  {% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version_compare('13', '>=')) or container_binary == 'podman' -%}
   --cpus={{ ceph_mgr_docker_cpu_limit }} \
   {% else -%}
   --cpu-quota={{ ceph_mgr_docker_cpu_limit * 100000 }} \
@@ -29,7 +33,7 @@ ExecStart=/usr/bin/docker run --rm --net=host \
   {{ ceph_mgr_docker_extra_env }} \
   --name=ceph-mgr-{{ ansible_hostname }} \
   {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
-ExecStopPost=-/usr/bin/docker stop ceph-mgr-{{ ansible_hostname }}
+ExecStopPost=-/usr/bin/{{ container_binary }} stop ceph-mgr-{{ ansible_hostname }}
 Restart=always
 RestartSec=10s
 TimeoutStartSec=120
index 4fc450532476ad73887a6bfb753fc47541d72e6a..4f7a148488636f72d79054464ad3d783e58ebbf2 100644 (file)
     image: "{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
   when: containerized_deployment_with_kv
 
-- name: generate systemd unit file
-  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
+- name: include systemd.yml
+  include_tasks: systemd.yml
 
 - name: systemd start mon container
   systemd:
diff --git a/roles/ceph-mon/tasks/docker/systemd.yml b/roles/ceph-mon/tasks/docker/systemd.yml
new file mode 100644 (file)
index 0000000..8ffeef0
--- /dev/null
@@ -0,0 +1,11 @@
+---
+- name: generate systemd unit file
+  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
\ No newline at end of file
diff --git a/roles/ceph-mon/tasks/docker2podman.yml b/roles/ceph-mon/tasks/docker2podman.yml
new file mode 120000 (symlink)
index 0000000..4b74804
--- /dev/null
@@ -0,0 +1 @@
+docker/systemd.yml
\ No newline at end of file
index d8a0c675f1945ff0196262ca3d0b66ff17a2bdad..f9fa5f7447daabaef6de4fd12772411dc32f742d 100644 (file)
@@ -1,15 +1,19 @@
 [Unit]
 Description=Ceph Monitor
+{% if container_binary == 'docker' %}
 After=docker.service
 Requires=docker.service
+{% else %}
+After=network.target
+{% endif %}
 
 [Service]
 EnvironmentFile=-/etc/environment
-ExecStartPre=-/usr/bin/docker rm ceph-mon-%i
+ExecStartPre=-/usr/bin/{{ container_binary }} rm ceph-mon-%i
 ExecStartPre=/bin/sh -c '"$(command -v mkdir)" -p /etc/ceph /var/lib/ceph/mon'
-ExecStart=/usr/bin/docker run --rm --name ceph-mon-%i \
+ExecStart=/usr/bin/{{ container_binary }} run --rm --name ceph-mon-%i \
   --memory={{ ceph_mon_docker_memory_limit }} \
-{% if ceph_docker_version.split('.')[0] is version_compare('13', '>=') -%}
+{% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version_compare('13', '>=')) or container_binary == 'podman' -%}
   --cpus={{ ceph_mon_docker_cpu_limit }} \
 {% else -%}
   --cpu-quota={{ ceph_mon_docker_cpu_limit * 100000 }} \
@@ -64,7 +68,7 @@ ExecStart=/usr/bin/docker run --rm --name ceph-mon-%i \
   -e CEPH_DAEMON=MON \
   {{ ceph_mon_docker_extra_env }} \
   {{ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
-ExecStop=-/usr/bin/docker stop ceph-mon-%i
+ExecStop=-/usr/bin/{{ container_binary }} stop ceph-mon-%i
 ExecStopPost=-/bin/rm -f /var/run/ceph/{{ cluster }}-mon.{{ monitor_name }}.asok
 Restart=always
 RestartSec=10s
index e73cb98cae7bd2f5843ffd3ff2c0c4da4a896853..3da24cd9722216684892a1c9dc8d687ffc4ea176 100644 (file)
   when:
     - ceph_nfs_dynamic_exports
 
-- 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"
-  when:
-    - containerized_deployment
-  notify:
-    - restart ceph nfss
+- name: include systemd.yml
+  include_tasks: systemd.yml
 
 - 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 (file)
index 0000000..eb486e4
--- /dev/null
@@ -0,0 +1,13 @@
+---
+- 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"
+  when:
+    - containerized_deployment
+  notify:
+    - restart ceph nfss
\ No newline at end of file
index faae3cde652f3dda98379296c9fc734628b9ca7e..03e162fb628e658e35eaea8c41f9be88b4383c96 100644 (file)
@@ -1,14 +1,18 @@
 [Unit]
 Description=NFS-Ganesha file server
 Documentation=http://github.com/nfs-ganesha/nfs-ganesha/wiki
+{% if container_binary == 'docker' %}
 After=docker.service
 Requires=docker.service
+{% else %}
+After=network.target
+{% endif %}
 
 [Service]
 EnvironmentFile=-/etc/environment
-ExecStartPre=-/usr/bin/docker rm ceph-nfs-%i
+ExecStartPre=-/usr/bin/{{ container_binary }} rm ceph-nfs-%i
 ExecStartPre=/usr/bin/mkdir -p /etc/ceph /etc/ganesha /var/lib/nfs/ganesha
-ExecStart=/usr/bin/docker run --rm --net=host \
+ExecStart=/usr/bin/{{ container_binary }} run --rm --net=host \
   {% if not containerized_deployment_with_kv -%}
   -v /var/lib/ceph:/var/lib/ceph:z \
   -v /etc/ceph:/etc/ceph:z \
@@ -30,7 +34,7 @@ ExecStart=/usr/bin/docker run --rm --net=host \
   {{ ceph_nfs_docker_extra_env }} \
   --name=ceph-nfs-{{ ceph_nfs_service_suffix | default(ansible_hostname) }} \
   {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
-ExecStopPost=-/usr/bin/docker stop ceph-nfs-%i
+ExecStopPost=-/usr/bin/{{ container_binary }} stop ceph-nfs-%i
 Restart=always
 RestartSec=10s
 TimeoutStartSec=120
index e91f3723c2717bfafd282d81dc6e490776336eff..ccb23e28121901209737535240b968ec09a222ec 100644 (file)
           - devices is defined
           - devices | length > activated_osds.stdout_lines | length
 
-  - 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"
-    notify:
-      - restart ceph osds
+  - name: include systemd.yml
+    include_tasks: systemd.yml
   when:
     - containerized_deployment
 
diff --git a/roles/ceph-osd/tasks/systemd.yml b/roles/ceph-osd/tasks/systemd.yml
new file mode 100644 (file)
index 0000000..0b93298
--- /dev/null
@@ -0,0 +1,11 @@
+---
+- 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"
+  notify:
+    - restart ceph osds
\ No newline at end of file
index e92a0a27c8e0a2746cf212826c45bda9f750001f..77325926387edf297075c08d03557a273760296b 100644 (file)
@@ -14,7 +14,7 @@ DOCKER_ENV=""
 #############
 function id_to_device () {
 {% if dmcrypt | bool %}
 docker run --rm --net=host --ulimit nofile=1024:4096 --ipc=host --pid=host --privileged=true -v /etc/ceph:/etc/ceph:z -v /var/lib/ceph/:/var/lib/ceph/:z -v /dev:/dev -v /etc/localtime:/etc/localtime:ro -e DEBUG=verbose -e CLUSTER={{ cluster }} {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} osd_ceph_disk_dmcrypt_data_map
{{ container_binary }} run --rm --net=host --ulimit nofile=1024:4096 --ipc=host --pid=host --privileged=true -v /etc/ceph:/etc/ceph:z -v /var/lib/ceph/:/var/lib/ceph/:z -v /dev:/dev -v /etc/localtime:/etc/localtime:ro -e DEBUG=verbose -e CLUSTER={{ cluster }} {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} osd_ceph_disk_dmcrypt_data_map
 {% endif %}
   DATA_PART=$(docker run --rm --ulimit nofile=1024:4096 --privileged=true -v /dev/:/dev/ -v /etc/ceph:/etc/ceph:z --entrypoint ceph-disk {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} list | grep ", osd\.${1}," | awk '{ print $1 }')
   if [[ "${DATA_PART}" =~ ^/dev/(cciss|nvme|loop) ]]; then
@@ -32,14 +32,14 @@ function expose_partitions () {
 # Jewel images prior to https://github.com/ceph/ceph-docker/pull/797
 REGEX="[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
 function expose_partitions {
-  if docker ps -a | grep -sq ceph-osd-prepare-{{ ansible_hostname }}-devdev${1}; then
+  if {{ container_binary }} ps -a | grep -sq ceph-osd-prepare-{{ ansible_hostname }}-devdev${1}; then
     if [[ ! -f {{ ceph_osd_docker_run_script_path }}/ceph-osd-prepare-{{ ansible_hostname }}-devdev${1}.log ]]; then
-      docker logs ceph-osd-prepare-{{ ansible_hostname }}-devdev${1} &> {{ ceph_osd_docker_run_script_path }}/ceph-osd-prepare-{{ ansible_hostname }}-devdev${1}.log
+     {{ container_binary }} logs ceph-osd-prepare-{{ ansible_hostname }}-devdev${1} &> {{ ceph_osd_docker_run_script_path }}/ceph-osd-prepare-{{ ansible_hostname }}-devdev${1}.log
     fi
   fi
-  if docker ps -a | grep -sq ceph-osd-prepare-{{ ansible_hostname }}-${1}; then
+  if {{ container_binary }} ps -a | grep -sq ceph-osd-prepare-{{ ansible_hostname }}-${1}; then
     if [[ ! -f {{ ceph_osd_docker_run_script_path }}/ceph-osd-prepare-{{ ansible_hostname }}-${1}.log ]]; then
-      docker logs ceph-osd-prepare-{{ ansible_hostname }}-${1} &> {{ ceph_osd_docker_run_script_path }}/ceph-osd-prepare-{{ ansible_hostname }}-${1}.log
+     {{ container_binary }} logs ceph-osd-prepare-{{ ansible_hostname }}-${1} &> {{ ceph_osd_docker_run_script_path }}/ceph-osd-prepare-{{ ansible_hostname }}-${1}.log
     fi
   fi
   if [[ -f {{ ceph_osd_docker_run_script_path }}/ceph-osd-prepare-{{ ansible_hostname }}-devdev${1}.log ]]; then
@@ -88,7 +88,7 @@ fi
 numactl \
 {{ ceph_osd_numactl_opts }} \
 {% endif %}
-/usr/bin/docker run \
+/usr/bin/{{ container_binary }} run \
   --rm \
   --net=host \
   --privileged=true \
@@ -97,7 +97,7 @@ numactl \
   {% if osd_objectstore == 'filestore' -%}
   --memory={{ ceph_osd_docker_memory_limit }} \
   {% endif -%}
-  {% if ceph_docker_version.split('.')[0] is version_compare('13', '>=') -%}
+  {% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version_compare('13', '>=')) or container_binary == 'podman' -%}
   --cpus={{ cpu_limit }} \
   {% else -%}
   --cpu-quota={{ cpu_limit * 100000 }} \
index a1df06c1891a213fab78c7b874c3a977a5f67c9a..0e1b72f3e915c1034ebc869d6fa2416930fb98a1 100644 (file)
@@ -1,15 +1,19 @@
 # {{ ansible_managed }}
 [Unit]
 Description=Ceph OSD
+{% if container_binary == 'docker' %}
 After=docker.service
 Requires=docker.service
+{% else %}
+After=network.target
+{% endif %}
 
 [Service]
 EnvironmentFile=-/etc/environment
-ExecStartPre=-/usr/bin/docker stop ceph-osd-%i
-ExecStartPre=-/usr/bin/docker rm -f ceph-osd-%i
+ExecStartPre=-/usr/bin/{{ container_binary }} stop ceph-osd-%i
+ExecStartPre=-/usr/bin/{{ container_binary }} rm -f ceph-osd-%i
 ExecStart={{ ceph_osd_docker_run_script_path }}/ceph-osd-run.sh %i
-ExecStop=-/usr/bin/docker stop ceph-osd-%i
+ExecStop=-/usr/bin/{{ container_binary }} stop ceph-osd-%i
 Restart=always
 RestartSec=10s
 TimeoutStartSec=120
index 6bb2844f621330272275208323852d4077f7b3bc..349a09a677038ff0e33742fb9c6d01781c63e313 100644 (file)
@@ -1,15 +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
-    owner: "root"
-    group: "root"
-    mode: "0644"
-  notify:
-    - restart ceph rbdmirrors
+- name: include systemd.yml
+  include_tasks: systemd.yml
 
 - name: systemd start rbd mirror container
   systemd:
diff --git a/roles/ceph-rbd-mirror/tasks/docker/systemd.yml b/roles/ceph-rbd-mirror/tasks/docker/systemd.yml
new file mode 100644 (file)
index 0000000..2533126
--- /dev/null
@@ -0,0 +1,12 @@
+---
+# 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
diff --git a/roles/ceph-rbd-mirror/tasks/docker2podman.yml b/roles/ceph-rbd-mirror/tasks/docker2podman.yml
new file mode 120000 (symlink)
index 0000000..4b74804
--- /dev/null
@@ -0,0 +1 @@
+docker/systemd.yml
\ No newline at end of file
index d76ac06014b2127a668feb426b46864b83939c4e..0465f66f5e06e983f32dcbd8b78fba806ed910e2 100644 (file)
@@ -1,15 +1,19 @@
 [Unit]
 Description=Ceph RBD mirror
+{% if container_binary == 'docker' %}
 After=docker.service
 Requires=docker.service
+{% else %}
+After=network.target
+{% endif %}
 
 [Service]
 EnvironmentFile=-/etc/environment
-ExecStartPre=-/usr/bin/docker stop ceph-rbd-mirror-{{ ansible_hostname }}
-ExecStartPre=-/usr/bin/docker rm ceph-rbd-mirror-{{ ansible_hostname }}
-ExecStart=/usr/bin/docker run --rm --net=host \
+ExecStartPre=-/usr/bin/{{ container_binary }} stop ceph-rbd-mirror-{{ ansible_hostname }}
+ExecStartPre=-/usr/bin/{{ container_binary }} rm ceph-rbd-mirror-{{ ansible_hostname }}
+ExecStart=/usr/bin/{{ container_binary }} run --rm --net=host \
   --memory={{ ceph_rbd_mirror_docker_memory_limit }} \
-  {% if ceph_docker_version.split('.')[0] is version_compare('13', '>=') -%}
+  {% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version_compare('13', '>=')) or container_binary == 'podman' -%}
   --cpus={{ ceph_rbd_mirror_docker_cpu_limit }} \
   {% else -%}
   --cpu-quota={{ ceph_rbd_mirror_docker_cpu_limit * 100000 }} \
@@ -29,7 +33,7 @@ ExecStart=/usr/bin/docker run --rm --net=host \
   --name=ceph-rbd-mirror-{{ ansible_hostname }} \
   {{ ceph_rbd_mirror_docker_extra_env }} \
   {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
-ExecStopPost=-/usr/bin/docker stop ceph-rbd-mirror-{{ ansible_hostname }}
+ExecStopPost=-/usr/bin/{{ container_binary }} stop ceph-rbd-mirror-{{ ansible_hostname }}
 Restart=always
 RestartSec=10s
 TimeoutStartSec=120
index 83c270d7549a18094568d9d20cdc201313d0e8ab..def5c9fc1425bb5226c54778aef9b1c814f795dc 100644 (file)
@@ -1,28 +1,6 @@
 ---
-- 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
-
-# For backward compatibility
-- name: disable old systemd unit ('ceph-rgw@'|'ceph-radosgw@radosgw.'|'ceph-radosgw@') if present
-  systemd:
-    name: "{{ item }}"
-    state: stopped
-    enabled: no
-    daemon_reload: yes
-  with_items:
-    - "ceph-rgw@{{ ansible_hostname }}"
-    - "ceph-radosgw@{{ ansible_hostname }}.service"
-    - "ceph-radosgw@radosgw.{{ ansible_hostname }}.service"
-    - ceph-radosgw@radosgw.gateway.service
-  ignore_errors: true
+- name: include systemd.yml
+  include_tasks: systemd.yml
 
 - name: systemd start rgw container
   systemd:
diff --git a/roles/ceph-rgw/tasks/docker/systemd.yml b/roles/ceph-rgw/tasks/docker/systemd.yml
new file mode 100644 (file)
index 0000000..bcbf255
--- /dev/null
@@ -0,0 +1,25 @@
+---
+- 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
+
+# For backward compatibility
+- name: disable old systemd unit ('ceph-rgw@'|'ceph-radosgw@radosgw.'|'ceph-radosgw@') if present
+  systemd:
+    name: "{{ item }}"
+    state: stopped
+    enabled: no
+    daemon_reload: yes
+  with_items:
+    - "ceph-rgw@{{ ansible_hostname }}"
+    - "ceph-radosgw@{{ ansible_hostname }}.service"
+    - "ceph-radosgw@radosgw.{{ ansible_hostname }}.service"
+    - ceph-radosgw@radosgw.gateway.service
+  ignore_errors: true
\ No newline at end of file
diff --git a/roles/ceph-rgw/tasks/docker2podman.yml b/roles/ceph-rgw/tasks/docker2podman.yml
new file mode 120000 (symlink)
index 0000000..4b74804
--- /dev/null
@@ -0,0 +1 @@
+docker/systemd.yml
\ No newline at end of file
index dc0776912ee5558ae6d0e796dfb727d760aa2dd9..bae0119982f7d31d5bdfe316cf171f8ae3f4d685 100644 (file)
@@ -1,16 +1,20 @@
 [Unit]
 Description=Ceph RGW
+{% if container_binary == 'docker' %}
 After=docker.service
 Requires=docker.service
+{% else %}
+After=network.target
+{% endif %}
 {% set cpu_limit = ansible_processor_vcpus|int if ceph_rgw_docker_cpu_limit|int > ansible_processor_vcpus|int else ceph_rgw_docker_cpu_limit|int %}
 
 [Service]
 EnvironmentFile=-/etc/environment
-ExecStartPre=-/usr/bin/docker stop ceph-rgw-{{ ansible_hostname }}
-ExecStartPre=-/usr/bin/docker rm ceph-rgw-{{ ansible_hostname }}
-ExecStart=/usr/bin/docker run --rm --net=host \
+ExecStartPre=-/usr/bin/{{ container_binary }} stop ceph-rgw-{{ ansible_hostname }}
+ExecStartPre=-/usr/bin/{{ container_binary }} rm ceph-rgw-{{ ansible_hostname }}
+ExecStart=/usr/bin/{{ container_binary }} run --rm --net=host \
   --memory={{ ceph_rgw_docker_memory_limit }} \
-  {% if ceph_docker_version.split('.')[0] is version_compare('13', '>=') -%}
+  {% if (container_binary == 'docker' and ceph_docker_version.split('.')[0] is version_compare('13', '>=')) or container_binary == 'podman' -%}
   --cpus={{ cpu_limit }} \
   {% else -%}
   --cpu-quota={{ cpu_limit * 100000 }} \
@@ -33,7 +37,7 @@ ExecStart=/usr/bin/docker run --rm --net=host \
   --name=ceph-rgw-{{ ansible_hostname }} \
   {{ ceph_rgw_docker_extra_env }} \
   {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
-ExecStopPost=-/usr/bin/docker stop ceph-rgw-{{ ansible_hostname }}
+ExecStopPost=-/usr/bin/{{ container_binary }} stop ceph-rgw-{{ ansible_hostname }}
 Restart=always
 RestartSec=10s
 TimeoutStartSec=120
index c03200b18adc1d1bc98a4aac35856ad698ae33a1..23e295bf59189d8cdcd58ee83fbd2004dbd2d47e 100644 (file)
@@ -38,6 +38,7 @@ def node(host, request):
     osd_scenario = ansible_vars.get("osd_scenario")
     lvm_scenario = osd_scenario in ['lvm', 'lvm-batch']
     devices = ansible_vars.get("devices", [])
+    container_binary = ''
     ceph_release_num = {
         'jewel': 10,
         'kraken': 11,
@@ -98,6 +99,11 @@ def node(host, request):
         cluster_name = ansible_vars.get("cluster", "ceph")
     conf_path = "/etc/ceph/{}.conf".format(cluster_name)
 
+    if docker:
+        container_binary = "docker"
+    if docker and str_to_bool(os.environ.get('IS_PODMAN', False)):  # noqa E501
+        container_binary = "podman"
+
     data = dict(
         address=address,
         subnet=subnet,
@@ -112,6 +118,7 @@ def node(host, request):
         ceph_stable_release=ceph_stable_release,
         ceph_release_num=ceph_release_num,
         rolling_update=rolling_update,
+        container_binary=container_binary
     )
     return data
 
diff --git a/tests/functional/docker2podman.yml b/tests/functional/docker2podman.yml
new file mode 100644 (file)
index 0000000..a4fbe47
--- /dev/null
@@ -0,0 +1,8 @@
+- hosts: all
+  gather_facts: true
+  become: true
+  tasks:
+    - name: install podman
+      package:
+        name: podman
+        state: present
\ No newline at end of file
diff --git a/tests/functional/docker2podman/Vagrantfile b/tests/functional/docker2podman/Vagrantfile
new file mode 120000 (symlink)
index 0000000..706a5bb
--- /dev/null
@@ -0,0 +1 @@
+../../../Vagrantfile
\ No newline at end of file
diff --git a/tests/functional/docker2podman/ceph-override.json b/tests/functional/docker2podman/ceph-override.json
new file mode 100644 (file)
index 0000000..45b050d
--- /dev/null
@@ -0,0 +1,37 @@
+{
+  "ceph_conf_overrides": {
+    "global": {
+      "osd_pool_default_pg_num": 12,
+      "osd_pool_default_size": 1,
+      "mon_allow_pool_size_one": true,
+      "mon_warn_on_pool_no_redundancy": false
+    }
+  },
+  "cephfs_pools": [
+    {
+      "name": "cephfs_data",
+      "pg_num": 8,
+      "pgp_num": 8,
+      "rule_name": "replicated_rule",
+      "type": 1,
+      "erasure_profile": "",
+      "expected_num_objects": "",
+      "application": "cephfs",
+      "size": 3,
+      "min_size": 0
+    },
+    {
+      "name": "cephfs_metadata",
+      "pg_num": 8,
+      "pgp_num": 8,
+      "rule_name": "replicated_rule",
+      "type": 1,
+      "erasure_profile": "",
+      "expected_num_objects": "",
+      "application": "cephfs",
+      "size": 3,
+      "min_size": 0
+    }
+  ],
+  "ceph_mon_docker_memory_limit": "2g"
+}
diff --git a/tests/functional/docker2podman/group_vars/all b/tests/functional/docker2podman/group_vars/all
new file mode 100644 (file)
index 0000000..b8c2390
--- /dev/null
@@ -0,0 +1,44 @@
+---
+# this is only here to let the CI tests know
+# that this scenario is using docker
+docker: True
+container_binary: docker
+
+containerized_deployment: True
+monitor_interface: "{{ 'eth1' if ansible_distribution == 'CentOS' else 'ens6' }}"
+radosgw_interface: "{{ 'eth1' if ansible_distribution == 'CentOS' else 'ens6' }}"
+ceph_mon_docker_subnet: "{{ public_network }}"
+ceph_docker_on_openstack: False
+public_network: "192.168.58.0/24"
+cluster_network: "192.168.59.0/24"
+rgw_override_bucket_index_max_shards: 16
+rgw_bucket_default_quota_max_objects: 1638400
+ceph_conf_overrides:
+  global:
+    mon_allow_pool_size_one: true
+    mon_warn_on_pool_no_redundancy: false
+    osd_pool_default_size: 1
+openstack_config: False
+openstack_glance_pool:
+  name: "images"
+  pg_num: "{{ osd_pool_default_pg_num }}"
+  pgp_num: "{{ osd_pool_default_pg_num }}"
+  rule_name: "HDD"
+  type: 1
+  erasure_profile: ""
+  expected_num_objects: ""
+  size: 1
+openstack_cinder_pool:
+  name: "volumes"
+  pg_num: "{{ osd_pool_default_pg_num }}"
+  pgp_num: "{{ osd_pool_default_pg_num }}"
+  rule_name: "HDD"
+  type: 1
+  erasure_profile: ""
+  expected_num_objects: ""
+  size: 1
+openstack_pools:
+  - "{{ openstack_glance_pool }}"
+  - "{{ openstack_cinder_pool }}"
+handler_health_mon_check_delay: 10
+handler_health_osd_check_delay: 10
diff --git a/tests/functional/docker2podman/group_vars/clients b/tests/functional/docker2podman/group_vars/clients
new file mode 100644 (file)
index 0000000..a8ea366
--- /dev/null
@@ -0,0 +1,22 @@
+---
+user_config: True
+copy_admin_key: True
+test:
+  name: "test"
+  pg_num: "{{ osd_pool_default_pg_num }}"
+  pgp_num: "{{ osd_pool_default_pg_num }}"
+  rule_name: "HDD"
+  type: 1
+  erasure_profile: ""
+  expected_num_objects: ""
+test2:
+  name: "test2"
+  pg_num: "{{ osd_pool_default_pg_num }}"
+  pgp_num: "{{ osd_pool_default_pg_num }}"
+  rule_name: "HDD"
+  type: 1
+  erasure_profile: ""
+  expected_num_objects: ""
+pools:
+  - "{{ test }}"
+  - "{{ test2 }}"
diff --git a/tests/functional/docker2podman/group_vars/iscsigws b/tests/functional/docker2podman/group_vars/iscsigws
new file mode 100644 (file)
index 0000000..2cd4511
--- /dev/null
@@ -0,0 +1,3 @@
+---
+gateway_ip_list: "{{ ansible_all_ipv4_addresses | ipaddr(public_network) | first }}"
+generate_crt: True
diff --git a/tests/functional/docker2podman/group_vars/mons b/tests/functional/docker2podman/group_vars/mons
new file mode 100644 (file)
index 0000000..f7f3792
--- /dev/null
@@ -0,0 +1,11 @@
+---
+create_crush_tree: False
+crush_rule_config: False
+crush_rule_hdd:
+  name: HDD
+  root: default
+  type: host
+  class: hdd
+  default: true
+crush_rules:
+  - "{{ crush_rule_hdd }}"
diff --git a/tests/functional/docker2podman/group_vars/osds b/tests/functional/docker2podman/group_vars/osds
new file mode 100644 (file)
index 0000000..db8a552
--- /dev/null
@@ -0,0 +1,7 @@
+---
+osd_objectstore: "bluestore"
+osd_scenario: lvm
+devices:
+  - /dev/sda
+  - /dev/sdb
+  - /dev/sdc
\ No newline at end of file
diff --git a/tests/functional/docker2podman/group_vars/rgws b/tests/functional/docker2podman/group_vars/rgws
new file mode 100644 (file)
index 0000000..18a2be6
--- /dev/null
@@ -0,0 +1,7 @@
+---
+copy_admin_key: True
+rgw_create_pools:
+  foo:
+    pg_num: 16
+  bar:
+    pg_num: 16
diff --git a/tests/functional/docker2podman/hosts b/tests/functional/docker2podman/hosts
new file mode 100644 (file)
index 0000000..f849f04
--- /dev/null
@@ -0,0 +1,29 @@
+[mons]
+mon0
+
+[osds]
+osd0
+
+[mgrs]
+mon0
+
+[mdss]
+osd0
+
+[rgws]
+osd0
+
+[nfss]
+nfs0
+
+[rbdmirrors]
+rbd-mirror0
+
+[iscsigws]
+iscsi-gw0
+
+[all:vars]
+nfs_ganesha_stable=True
+nfs_ganesha_dev=False
+nfs_ganesha_stable_branch="V2.7-stable"
+nfs_ganesha_flavor="ceph_master"
diff --git a/tests/functional/docker2podman/vagrant_variables.yml b/tests/functional/docker2podman/vagrant_variables.yml
new file mode 100644 (file)
index 0000000..9588b19
--- /dev/null
@@ -0,0 +1,32 @@
+---
+
+# DEPLOY CONTAINERIZED DAEMONS
+docker: True
+
+# DEFINE THE NUMBER OF VMS TO RUN
+mon_vms: 1
+osd_vms: 1
+mds_vms: 0
+rgw_vms: 1
+nfs_vms: 1
+rbd_mirror_vms: 1
+client_vms: 0
+iscsi_gw_vms: 1
+mgr_vms: 0
+
+# SUBNETS TO USE FOR THE VMS
+public_subnet: 192.168.58
+cluster_subnet: 192.168.59
+
+# MEMORY
+# set 1024 for CentOS
+memory: 1024
+
+vagrant_box: centos/7
+# The sync directory changes based on vagrant box
+# Set to /home/vagrant/sync for Centos/7, /home/{ user }/vagrant for openstack and defaults to /vagrant
+#vagrant_sync_dir: /home/vagrant/sync
+vagrant_sync_dir: /vagrant
+# Disables synced folder creation. Not needed for testing, will skip mounting
+# the vagrant directory on the remote box regardless of the provider.
+vagrant_disable_synced_folder: true
index 716e4884b107d53c40bb2282710a6104fd63ca01..40117f1a02e17abc83cc8dca0f983d477e7be010 100644 (file)
@@ -21,13 +21,15 @@ class TestMDSs(object):
 
     def test_mds_is_up(self, node, host):
         hostname = node["vars"]["inventory_hostname"]
+        container_binary = node['container_binary']
         if node['docker']:
-            docker_exec_cmd = 'docker exec ceph-mds-{hostname}'.format(hostname=hostname)
+            container_exec_cmd = '{container_binary} exec ceph-mds-{hostname}'.format(  # noqa E501
+                hostname=hostname, container_binary=container_binary)
         else:
-            docker_exec_cmd = ''
+            container_exec_cmd = ''
 
-        cmd = "sudo {docker_exec_cmd} ceph --name client.bootstrap-mds --keyring /var/lib/ceph/bootstrap-mds/{cluster}.keyring --cluster={cluster} --connect-timeout 5 -f json -s".format(
-            docker_exec_cmd=docker_exec_cmd,
+        cmd = "sudo {container_exec_cmd} ceph --name client.bootstrap-mds --keyring /var/lib/ceph/bootstrap-mds/{cluster}.keyring --cluster={cluster} --connect-timeout 5 -f json -s".format(
+            container_exec_cmd=container_exec_cmd,
             cluster=node['cluster_name']
         )
         cluster_status = json.loads(host.check_output(cmd))
index a6e62c52b67ffe4e39646a000ef90ec939d193c9..dae63e957bd22cb5b3df0656472f701c9ed35f72 100644 (file)
@@ -22,12 +22,13 @@ class TestMGRs(object):
     def test_mgr_is_up(self, node, host):
         hostname=node["vars"]["inventory_hostname"]
         cluster=node["cluster_name"]
+        container_binary=node['container_binary']
         if node['docker']:
-            docker_exec_cmd = 'docker exec ceph-mgr-{hostname}'.format(hostname=hostname)
+            container_exec_cmd = '{container_binary} exec ceph-mgr-{hostname}'.format(container_binary=container_binary, hostname=hostname)
         else:
-            docker_exec_cmd = ''
-        cmd = "sudo {docker_exec_cmd} ceph --name mgr.{hostname} --keyring /var/lib/ceph/mgr/{cluster}-{hostname}/keyring --cluster={cluster} --connect-timeout 5 -f json -s".format(
-            docker_exec_cmd=docker_exec_cmd,
+            container_exec_cmd = ''
+        cmd = "sudo {container_exec_cmd} ceph --name mgr.{hostname} --keyring /var/lib/ceph/mgr/{cluster}-{hostname}/keyring --cluster={cluster} --connect-timeout 5 -f json -s".format(
+            container_exec_cmd=container_exec_cmd,
             hostname=node["vars"]["inventory_hostname"],
             cluster=cluster
         )
index e06e18cc8b72d212974b810d04136d6a43a8722c..febea1dcc72435cd8f9dc89bfefc230bbd9c7cdd 100644 (file)
@@ -28,10 +28,10 @@ class TestMons(object):
         output = host.check_output(cmd)
         assert output.strip().startswith("cluster")
 
-    def test_ceph_config_has_inital_members_line(self, node, File):
-        assert File(node["conf_path"]).contains("^mon initial members = .*$")
+    def test_ceph_config_has_inital_members_line(self, node, host):
+        assert host.file(node["conf_path"]).contains("^mon initial members = .*$")
 
-    def test_initial_members_line_has_correct_value(self, node, host, File):
+    def test_initial_members_line_has_correct_value(self, node, host):
         mon_initial_members_line = host.check_output("grep 'mon initial members = ' /etc/ceph/{cluster}.conf".format(cluster=node['cluster_name']))
         result = True
         for host in node["vars"]["groups"]["mons"]:
index 8ec9218eacb7bff807bc97e56eedc409cc8e3a91..50bf1e05d4370abd9169de36eebb077b1e1493f7 100644 (file)
@@ -26,12 +26,13 @@ class TestNFSs(object):
     def test_nfs_is_up(self, node, host):
         hostname = node["vars"]["inventory_hostname"]
         cluster = node['cluster_name']
+        container_binary = node['container_binary']
         if node['docker']:
-            docker_exec_cmd = 'docker exec ceph-nfs-{hostname}'.format(hostname=hostname)
+            container_exec_cmd = '{container_binary} exec ceph-nfs-{hostname}'.format(container_binary=container_binary, hostname=hostname)
         else:
-            docker_exec_cmd = ''
-        cmd = "sudo {docker_exec_cmd} ceph --name client.rgw.{hostname} --keyring /var/lib/ceph/radosgw/{cluster}-rgw.{hostname}/keyring --cluster={cluster} --connect-timeout 5 -f json -s".format(
-            docker_exec_cmd=docker_exec_cmd,
+            container_exec_cmd = ''
+        cmd = "sudo {container_exec_cmd} ceph --name client.rgw.{hostname} --keyring /var/lib/ceph/radosgw/{cluster}-rgw.{hostname}/keyring --cluster={cluster} --connect-timeout 5 -f json -s".format(
+            container_exec_cmd=container_exec_cmd,
             hostname=hostname,
             cluster=cluster
         )
index 36aa8958448cf90fe3ec4152b5dd6b4c5b8aff76..bb00b0d58732a8d19e3fd7b044eb32f29ff7ddfd 100644 (file)
@@ -12,9 +12,9 @@ class TestOSDs(object):
             osds = cmd.stdout.rstrip("\n").split("\n")
         return osds
 
-    def _get_docker_exec_cmd(self, host):
+    def _get_docker_exec_cmd(self, node, host):
         osd_id = host.check_output(
-            "docker ps -q --filter='name=ceph-osd' | head -1")
+            "{container_binary} ps -q --filter='name=ceph-osd' | head -1".format(container_binary=node['container_binary']))
         return osd_id
 
 
@@ -86,8 +86,10 @@ class TestOSDs(object):
 
     @pytest.mark.docker
     def test_all_docker_osds_are_up_and_in(self, node, host):
-        cmd = "sudo docker exec {osd_id} ceph --cluster={cluster} --connect-timeout 5 --keyring /var/lib/ceph/bootstrap-osd/{cluster}.keyring -n client.bootstrap-osd osd tree -f json".format(
-            osd_id=self._get_docker_exec_cmd(host),
+        container_binary= node['container_binary']
+        cmd = "sudo {container_binary} exec {osd_id} ceph --cluster={cluster} --connect-timeout 5 --keyring /var/lib/ceph/bootstrap-osd/{cluster}.keyring -n client.bootstrap-osd osd tree -f json".format(
+            container_binary=container_binary,
+            osd_id=self._get_docker_exec_cmd(node, host),
             cluster=node["cluster_name"]
         )
         output = json.loads(host.check_output(cmd))
index 7bdd1549443e17ccdbe9b20e979bfa7dd34c3280..1d52747ef47cdf1f7e42ceb4123e129706e12782 100644 (file)
@@ -30,15 +30,16 @@ class TestRbdMirrors(object):
     def test_rbd_mirror_is_up(self, node, host):
         hostname=node["vars"]["inventory_hostname"]
         cluster=node["cluster_name"]
+        container_binary = node["container_binary"]
         daemons = []
         if node['docker']:
-            docker_exec_cmd = 'docker exec ceph-rbd-mirror-{hostname}'.format(hostname=hostname)
+            container_exec_cmd = '{container_binary} exec ceph-rbd-mirror-{hostname}'.format(container_binary=container_binary, hostname=hostname)
         else:
-            docker_exec_cmd = ''
+            container_exec_cmd = ''
         hostname = node["vars"]["inventory_hostname"]
         cluster = node['cluster_name']
-        cmd = "sudo {docker_exec_cmd} ceph --name client.bootstrap-rbd --keyring /var/lib/ceph/bootstrap-rbd/{cluster}.keyring --cluster={cluster} --connect-timeout 5 -f json -s".format(
-            docker_exec_cmd=docker_exec_cmd,
+        cmd = "sudo {container_exec_cmd} ceph --name client.bootstrap-rbd --keyring /var/lib/ceph/bootstrap-rbd/{cluster}.keyring --cluster={cluster} --connect-timeout 5 -f json -s".format(
+            container_exec_cmd=container_exec_cmd,
             hostname=hostname,
             cluster=cluster
         )
index c940d260b30f6c92373f97ac86b17344acc4f77e..52b13a886be38a51747b1e76429711d46d6715e3 100644 (file)
@@ -25,12 +25,13 @@ class TestRGWs(object):
     def test_rgw_is_up(self, node, host):
         hostname=node["vars"]["inventory_hostname"]
         cluster=node["cluster_name"]
+        container_binary=node['container_binary']
         if node['docker']:
-            docker_exec_cmd = 'docker exec ceph-rgw-{hostname}'.format(hostname=hostname)
+            container_exec_cmd = '{container_binary} exec ceph-rgw-{hostname}'.format(container_binary=container_binary, hostname=hostname)
         else:
-            docker_exec_cmd = ''
-        cmd = "sudo {docker_exec_cmd} ceph --name client.bootstrap-rgw --keyring /var/lib/ceph/bootstrap-rgw/{cluster}.keyring --cluster={cluster} --connect-timeout 5 -f json -s".format(
-            docker_exec_cmd=docker_exec_cmd,
+            container_exec_cmd = ''
+        cmd = "sudo {container_exec_cmd} ceph --name client.bootstrap-rgw --keyring /var/lib/ceph/bootstrap-rgw/{cluster}.keyring --cluster={cluster} --connect-timeout 5 -f json -s".format(
+            container_exec_cmd=container_exec_cmd,
             hostname=hostname,
             cluster=cluster
         )
index ff42cf95479c19628f349c42d6d9090f8ea12ef9..bb390435a3008828e5e06871682ed74c00a1fc84 100644 (file)
@@ -37,7 +37,9 @@ class TestRGWs(object):
     def test_docker_rgw_tuning_pools_are_set(self, node, host):
         hostname = node["vars"]["inventory_hostname"]
         cluster = node['cluster_name']
-        cmd = "sudo docker exec ceph-rgw-{hostname} ceph --cluster={cluster} -n client.rgw.{hostname} --connect-timeout 5 --keyring /var/lib/ceph/radosgw/{cluster}-rgw.{hostname}/keyring  osd dump".format(
+        container_binary = node['container_binary']
+        cmd = "sudo {container_binary} exec ceph-rgw-{hostname} ceph --cluster={cluster} -n client.rgw.{hostname} --connect-timeout 5 --keyring /var/lib/ceph/radosgw/{cluster}-rgw.{hostname}/keyring  osd dump".format(
+            container_binary=container_binary,
             hostname=hostname,
             cluster=cluster
         )
index 4300ab2b4fb20766adebe131e1bb14e52ead2576..ebc37d74f726c8914f0b9a45e0e539939ac66fac 100644 (file)
@@ -22,8 +22,8 @@ class TestInstall(object):
 
 class TestCephConf(object):
 
-    def test_ceph_config_has_mon_host_line(self, node, File):
-        assert File(node["conf_path"]).contains("^mon host = .*$")
+    def test_ceph_config_has_mon_host_line(self, node, host):
+        assert host.file(node["conf_path"]).contains("^mon host = .*$")
 
     def test_mon_host_line_has_correct_value(self, node, host):
         mon_host_line = host.check_output("grep 'mon host = ' /etc/ceph/{cluster}.conf".format(cluster=node['cluster_name']))
index 57a8bf69bf5b9cf1c2e86fe6ce56a6392f4ab079..99c6cd5ffb5f9a9be003ec0cb490f449025b7c99 100644 (file)
@@ -1,6 +1,6 @@
 # These are Python requirements needed to run the functional tests
 six==1.10.0
-testinfra==1.19.0
+testinfra==3.4.0
 pytest-xdist==1.27.0
 pytest==3.6.1
 ansible~=2.6,<2.7
diff --git a/tox-docker2podman.ini b/tox-docker2podman.ini
new file mode 100644 (file)
index 0000000..fd205fe
--- /dev/null
@@ -0,0 +1,68 @@
+[tox]
+envlist = centos-container-docker_to_podman
+
+skipsdist = True
+
+[testenv]
+whitelist_externals =
+    vagrant
+    bash
+    pip
+    sleep
+    rm
+    cp
+passenv=*
+sitepackages=True
+setenv=
+  ANSIBLE_SSH_ARGS = -F {changedir}/vagrant_ssh_config -o ControlMaster=auto -o ControlPersist=600s -o PreferredAuthentications=publickey
+  ANSIBLE_CONFIG = {toxinidir}/ansible.cfg
+  ANSIBLE_CALLBACK_WHITELIST = profile_tasks
+  ANSIBLE_KEEP_REMOTE_FILES = 1
+  ANSIBLE_CACHE_PLUGIN = memory
+  ANSIBLE_GATHERING = implicit
+  # only available for ansible >= 2.5
+  ANSIBLE_STDOUT_CALLBACK = yaml
+  # Set the vagrant box image to use
+  CEPH_ANSIBLE_VAGRANT_BOX = centos/7
+
+deps= -r{toxinidir}/tests/requirements.txt
+changedir= {toxinidir}/tests/functional/docker2podman
+
+commands=
+  bash {toxinidir}/tests/scripts/vagrant_up.sh --no-provision {posargs:--provider=virtualbox}
+  bash {toxinidir}/tests/scripts/generate_ssh_config.sh {changedir}
+
+  ansible-playbook -vv -i {changedir}/hosts {toxinidir}/tests/functional/setup.yml
+
+  ansible-playbook -vv -i {changedir}/hosts {toxinidir}/site-container.yml.sample --extra-vars "\
+      delegate_facts_host={env:DELEGATE_FACTS_HOST:True} \
+      fetch_directory={env:FETCH_DIRECTORY:{changedir}/fetch} \
+      ceph_docker_registry={env:CEPH_DOCKER_REGISTRY:docker.io} \
+      ceph_stable_release={env:CEPH_STABLE_RELEASE:luminous} \
+      ceph_docker_image={env:CEPH_DOCKER_IMAGE:ceph/daemon} \
+      ceph_docker_image_tag={env:CEPH_DOCKER_IMAGE_TAG:latest-luminous} \
+  "
+
+  pip uninstall -y ansible
+  pip install ansible==2.10.0a2
+  cp {toxinidir}/infrastructure-playbooks/docker-to-podman.yml {toxinidir}/docker-to-podman.yml
+  ansible-playbook -vv -i {changedir}/hosts {toxinidir}/docker-to-podman.yml --extra-vars "\
+      delegate_facts_host={env:DELEGATE_FACTS_HOST:True} \
+      fetch_directory={env:FETCH_DIRECTORY:{changedir}/fetch} \
+      ansible_python_interpreter=/usr/bin/python2 \
+      ceph_docker_registry={env:CEPH_DOCKER_REGISTRY:docker.io} \
+      ceph_stable_release={env:CEPH_STABLE_RELEASE:luminous} \
+      ceph_docker_image={env:CEPH_DOCKER_IMAGE:ceph/daemon} \
+      ceph_docker_image_tag={env:CEPH_DOCKER_IMAGE_TAG:latest-luminous} \
+  "
+  # install podman
+  ansible-playbook -vv -i {changedir}/hosts {toxinidir}/tests/functional/docker2podman.yml -e ansible_python_interpreter=/usr/bin/python2
+
+  py.test -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/hosts --ssh-config={changedir}/vagrant_ssh_config {toxinidir}/tests/functional/tests
+  # reboot machines
+  ansible-playbook -i {changedir}/hosts {toxinidir}/tests/functional/reboot.yml
+  # wait 120 sec and run tests (there's a chance nodes are still downloading container image after the reboot)
+  sleep 120
+  bash -c 'IS_PODMAN=TRUE py.test -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/hosts --ssh-config={changedir}/vagrant_ssh_config {toxinidir}/tests/functional/tests'
+
+  vagrant destroy -f
index 5b34dbc5d6355bdca9c47c8ac9ebd0193b14dbed..53e92693eb6caa3b993ae7360622f1f53374e928 100644 (file)
@@ -78,6 +78,6 @@ commands=
       'dedicated_devices': [/dev/sdc,/dev/sdc], \
       'osd_scenario': 'non-collocated' \}"
 
-  bash -c "CEPH_STABLE_RELEASE={env:UPDATE_CEPH_STABLE_RELEASE:luminous} ROLLING_UPDATE=TRUE py.test -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/{env:INVENTORY} {toxinidir}/tests/functional/tests"
+  bash -c "CEPH_STABLE_RELEASE={env:UPDATE_CEPH_STABLE_RELEASE:luminous} ROLLING_UPDATE=TRUE py.test -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/{env:INVENTORY} --ssh-config={changedir}/vagrant_ssh_config {toxinidir}/tests/functional/tests"
 
   vagrant destroy --force
\ No newline at end of file
diff --git a/tox.ini b/tox.ini
index 7a7e76167276904dca1d9d9514ad2e8cdd382ca0..cd77e049ef56787fcfe7cc7430e5096278e3bb1d 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -73,7 +73,7 @@ commands=
       ceph_docker_image_tag={env:CEPH_DOCKER_IMAGE_TAG:latest-luminous} \
   "
   # test that the cluster can be redeployed in a healthy state
-  py.test -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/{env:INVENTORY} {toxinidir}/tests/functional/tests
+  py.test -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/{env:INVENTORY} --ssh-config={changedir}/vagrant_ssh_config {toxinidir}/tests/functional/tests
 
 [purge-lvm]
 commands=
@@ -99,7 +99,7 @@ commands=
       ceph_docker_image_tag={env:CEPH_DOCKER_IMAGE_TAG:latest-luminous} \
   "
   # test that the cluster can be redeployed in a healthy state
-  py.test -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/{env:INVENTORY} {toxinidir}/tests/functional/tests
+  py.test -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/{env:INVENTORY} --ssh-config={changedir}/vagrant_ssh_config {toxinidir}/tests/functional/tests
 
 [shrink-mon]
 commands=
@@ -141,7 +141,7 @@ commands=
       ceph_docker_image_tag={env:CEPH_DOCKER_IMAGE_TAG:latest-luminous} \
   "
 
-  py.test -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/hosts-switch-to-containers {toxinidir}/tests/functional/tests
+  py.test -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/hosts-switch-to-containers --ssh-config={changedir}/vagrant_ssh_config {toxinidir}/tests/functional/tests
 
 [add-osds]
 commands=
@@ -157,7 +157,7 @@ commands=
       ceph_docker_image={env:CEPH_DOCKER_IMAGE:ceph/daemon} \
       ceph_docker_image_tag={env:CEPH_DOCKER_IMAGE_TAG:latest-luminous} \
       "
-  py.test -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/hosts-2 {toxinidir}/tests/functional/tests
+  py.test -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/hosts-2 --ssh-config={changedir}/vagrant_ssh_config {toxinidir}/tests/functional/tests
 
 [rgw-multisite]
 commands=
@@ -268,14 +268,14 @@ commands=
   # wait 30sec for services to be ready
   sleep 30
   # test cluster state using ceph-ansible tests
-  py.test -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/{env:INVENTORY} {toxinidir}/tests/functional/tests
+  py.test -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/{env:INVENTORY} --ssh-config={changedir}/vagrant_ssh_config {toxinidir}/tests/functional/tests
 
   # reboot all vms
   all_daemons: ansible-playbook -vv -i {changedir}/{env:INVENTORY} {toxinidir}/tests/functional/reboot.yml
 
   # wait 30sec for services to be ready
   # retest to ensure cluster came back up correctly after rebooting
-  all_daemons: py.test -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/{env:INVENTORY} {toxinidir}/tests/functional/tests
+  all_daemons: py.test -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/{env:INVENTORY} --ssh-config={changedir}/vagrant_ssh_config {toxinidir}/tests/functional/tests
 
   # handlers/idempotency test
   all_daemons,all_in_one: ansible-playbook -vv -i {changedir}/{env:INVENTORY} {toxinidir}/{env:PLAYBOOK:site.yml.sample} --extra-vars "delegate_facts_host={env:DELEGATE_FACTS_HOST:True} fetch_directory={env:FETCH_DIRECTORY:{changedir}/fetch} ceph_stable_release={env:CEPH_STABLE_RELEASE:luminous} ceph_docker_registry={env:CEPH_DOCKER_REGISTRY:docker.io} ceph_docker_image={env:CEPH_DOCKER_IMAGE:ceph/daemon} ceph_docker_image_tag={env:CEPH_DOCKER_IMAGE_TAG_BIS:latest-bis-luminous} copy_admin_key={env:COPY_ADMIN_KEY:False} " --extra-vars @ceph-override.json