From 6f893e5ed9b737a253aecf85d319825cdd07b5d1 Mon Sep 17 00:00:00 2001 From: Dimitri Savineau Date: Thu, 16 Apr 2020 11:30:11 -0400 Subject: [PATCH] docker2podman: pull images from docker daemon The docker2podman playbook only installs the podman package and updates the systemd units with the right container_binary value. We never pull the container image so if one service is restarted then the container image will be pulled first before the service can start which could cause longer downstream. To avoid to download the container image from internet again we can just pull it from the local docker daemon. The container_{binding,package,service}_name variables are removed because they are only used in the ceph-container-engine role which isn't call in this playbook. Signed-off-by: Dimitri Savineau (cherry picked from commit d38f21aeba29f341dc737b8cdeaa9fdaa9f55408) --- infrastructure-playbooks/docker-to-podman.yml | 31 +++++++++++++------ tox-docker2podman.ini | 8 ++++- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/infrastructure-playbooks/docker-to-podman.yml b/infrastructure-playbooks/docker-to-podman.yml index 19b28335e..a27b1fd8a 100644 --- a/infrastructure-playbooks/docker-to-podman.yml +++ b/infrastructure-playbooks/docker-to-podman.yml @@ -46,8 +46,9 @@ - "{{ mgr_group_name | default('mgrs') }}" - "{{ iscsi_gw_group_name | default('iscsigws') }}" - "{{ rbdmirror_group_name | default('rbdmirrors') }}" + gather_facts: false become: true - pre_tasks: + tasks: - import_role: name: ceph-defaults - import_role: @@ -68,15 +69,10 @@ set_fact: ceph_docker_version: "{{ ceph_docker_version.stdout.split(' ')[2] }}" - - tasks: - - name: set_fact container_binary, container_binding_name, container_service_name, container_package_name + - name: set_fact docker2podman and container_binary set_fact: docker2podman: True container_binary: podman - container_binding_name: podman - container_service_name: podman - container_package_name: podman - name: install podman package: @@ -84,10 +80,25 @@ state: present register: result until: result is succeeded - tags: - - with_pkg + tags: with_pkg when: not is_atomic | bool + - name: "pulling {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} image from docker daemon" + command: "{{ timeout_command }} {{ container_binary }} pull docker-daemon:{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}" + changed_when: false + register: pull_image + until: pull_image.rc == 0 + retries: "{{ docker_pull_retry }}" + delay: 10 + when: inventory_hostname in groups.get(mon_group_name, []) or + inventory_hostname in groups.get(osd_group_name, []) or + inventory_hostname in groups.get(mds_group_name, []) or + inventory_hostname in groups.get(rgw_group_name, []) or + inventory_hostname in groups.get(mgr_group_name, []) or + inventory_hostname in groups.get(rbdmirror_group_name, []) or + inventory_hostname in groups.get(iscsi_gw_group_name, []) or + inventory_hostname in groups.get(nfs_group_name, []) + - import_role: name: ceph-mon tasks_from: systemd.yml @@ -133,6 +144,6 @@ tasks_from: systemd.yml when: inventory_hostname in groups.get(rgw_group_name, []) - - name: reload ceph monitor systemd unit + - name: reload systemd daemon systemd: daemon_reload: yes \ No newline at end of file diff --git a/tox-docker2podman.ini b/tox-docker2podman.ini index b9b56784d..633bacecc 100644 --- a/tox-docker2podman.ini +++ b/tox-docker2podman.ini @@ -44,7 +44,13 @@ commands= ceph_docker_image_tag={env:CEPH_DOCKER_IMAGE_TAG:latest-nautilus} \ " - ansible-playbook -vv -i {changedir}/hosts {toxinidir}/infrastructure-playbooks/docker-to-podman.yml + ansible-playbook -vv -i {changedir}/hosts {toxinidir}/infrastructure-playbooks/docker-to-podman.yml --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_docker_image={env:CEPH_DOCKER_IMAGE:ceph/daemon} \ + ceph_docker_image_tag={env:CEPH_DOCKER_IMAGE_TAG:latest-nautilus} \ + " py.test --reruns 5 --reruns-delay 1 -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/hosts --ssh-config={changedir}/vagrant_ssh_config {toxinidir}/tests/functional/tests