From 0771e519d89da9938b9f63528d03a0e1ab2dcaa8 Mon Sep 17 00:00:00 2001 From: Micah Abbott Date: Thu, 11 Oct 2018 11:58:34 -0400 Subject: [PATCH] roles: use alternate set of images for CentOS CentOS AH is missing the Red Hat CA cert, so it is unable to pull images from the registry (see: CentOS/sig-atomic-buildscripts#329). To workaround this, we'll have to build the list of images to pull differently for CentOS vs. the rest. --- roles/podman_pull_run_remove/tasks/main.yml | 18 +++++++++++++----- roles/podman_pull_run_remove/vars/main.yml | 2 ++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/roles/podman_pull_run_remove/tasks/main.yml b/roles/podman_pull_run_remove/tasks/main.yml index ec679d3..775b699 100644 --- a/roles/podman_pull_run_remove/tasks/main.yml +++ b/roles/podman_pull_run_remove/tasks/main.yml @@ -16,6 +16,14 @@ register: podman ignore_errors: true +- when: ansible_distribution != 'CentOS' + set_fact: + pull_images: "{{ popular_images | combine(rhel_images) }}" + +- when: ansible_distribution == 'CentOS' + set_fact: + pull_images: "{{ popular_images }}" + - when: podman.rc == 0 block: - name: Disable the docker daemon @@ -25,7 +33,7 @@ - name: Pull the popular container images command: "podman pull {{ item.key }}" - with_dict: "{{ popular_images }}" + with_dict: "{{ pull_images }}" register: podman_pull retries: 5 delay: 60 @@ -33,22 +41,22 @@ - name: Run the popular container images command: "podman run --rm {{ item.key }} echo 'hello'" - with_dict: "{{ popular_images }}" + with_dict: "{{ pull_images }}" # Test for https://bugzilla.redhat.com/show_bug.cgi?id=1585735 - name: Run the popular container images with cpu-shares flag command: "podman run --cpu-shares 2 --rm {{ item.key }} echo 'hello'" - with_dict: "{{ popular_images }}" + with_dict: "{{ pull_images }}" # Test for https://bugzilla.redhat.com/show_bug.cgi?id=1592932 # https://bugzilla.redhat.com/show_bug.cgi?id=1593419 - name: Run the popular container images testing for network access command: "podman run --rm {{ item.key }} {{ item.value }}" - with_dict: "{{ popular_images }}" + with_dict: "{{ pull_images }}" - name: Remove the popular container images command: "podman rmi {{ item.key }}" - with_dict: "{{ popular_images }}" + with_dict: "{{ pull_images }}" - name: Re-enable docker service: diff --git a/roles/podman_pull_run_remove/vars/main.yml b/roles/podman_pull_run_remove/vars/main.yml index 9370465..c88e44a 100644 --- a/roles/podman_pull_run_remove/vars/main.yml +++ b/roles/podman_pull_run_remove/vars/main.yml @@ -7,4 +7,6 @@ popular_images: docker.io/ubuntu: 'bash -c "apt-get update && apt-get -y install iputils-ping && ping -c 3 1.1.1.1"' registry.fedoraproject.org/fedora: 'bash -c "dnf -y install iputils && ping -c 3 1.1.1.1"' registry.centos.org/centos/centos: 'ping -c 3 1.1.1.1' + +rhel_images: registry.access.redhat.com/rhel: 'curl --fail -o /dev/null -I https://1.1.1.1'