Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Have the RHEL VMs in our integration tests use podman instead of docker #1711

Merged
merged 12 commits into from
Jun 21, 2024
3 changes: 3 additions & 0 deletions ansible/ci/inventory_gcp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ keyed_groups:

- prefix: vm_arch
key: labels.vm_arch

- prefix: container_engine
key: labels.container_engine
groups:
gcp: true
auth_kind: serviceaccount
Expand Down
3 changes: 3 additions & 0 deletions ansible/dev/inventory_gcp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ keyed_groups:

- prefix: vm_arch
key: labels.vm_arch

- prefix: container_engine
key: labels.container_engine
groups:
gcp: true
auth_kind: application
Expand Down
4 changes: 4 additions & 0 deletions ansible/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ virtual_machines:
families:
- rhel-8
- rhel-9
container_engine: podman

rhel-arm64:
project: rhel-cloud
arch: arm64
machine_type: t2a-standard-2
families:
- rhel-9-arm64
container_engine: podman

rhel-s390x:
project: rhel-s390x-cloud
Expand All @@ -59,6 +61,7 @@ virtual_machines:
families:
- rhel-8-4-sap-ha
- rhel-8-6-sap-ha
container_engine: podman

rhcos:
project: rhcos-cloud
Expand All @@ -74,6 +77,7 @@ virtual_machines:
- name: core
sshAuthorizedKeys:
- "{{ lookup('file', gcp_ssh_key_file + '.pub', errors='ignore') }}"
container_engine: podman

cos:
project: cos-cloud
Expand Down
6 changes: 6 additions & 0 deletions ansible/group_vars/container_engine_podman.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
runtime_command: podman
runtime_as_root: true
runtime_socket: /run/podman/podman.sock

needs_selinux_permissive: true
6 changes: 0 additions & 6 deletions ansible/group_vars/platform_rhcos.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
---
ansible_user: core

runtime_command: podman
runtime_as_root: true
runtime_socket: /run/podman/podman.sock

needs_selinux_permissive: true
1 change: 1 addition & 0 deletions ansible/roles/create-all-vms/tasks/by-family.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@
vm_machine_type: "{{ item.0.value.machine_type | default('e2-standard-2') }}"
vm_ssh_key_file: "{{ item.0.value.ssh_key_file | default(gcp_ssh_key_file) }}"
vm_user: "{{ item.0.value.username | default(ansible_user) }}"
container_engine: "{{ item.0.value.container_engine | default('docker') }}"
1 change: 1 addition & 0 deletions ansible/roles/create-all-vms/tasks/by-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@
vm_machine_type: "{{ item.0.value.machine_type | default('e2-standard-2') }}"
vm_ssh_key_file: "{{ item.0.value.ssh_key_file | default(gcp_ssh_key_file) }}"
vm_user: "{{ item.0.value.username | default(ansible_user) }}"
container_engine: "{{ item.0.value.container_engine | default('docker') }}"
1 change: 1 addition & 0 deletions ansible/roles/create-vm/tasks/create-gcp-vm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
vm_image_family: "{{ vm_family }}"
vm_collection_method: "{{ vm_collection_method }}"
vm_arch: "{{ vm_arch }}"
container_engine: "{{ container_engine }}"

- name: Get GCP network
gcp_compute_network:
Expand Down
60 changes: 39 additions & 21 deletions ansible/roles/provision-vm/tasks/redhat.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
---
- set_fact:
distro: centos

- when: vm_arch == "s390x"
block:
- name: Get distro info
shell: awk -F= '$1=="ID" { print $2 ;}' /etc/os-release
register: distro_id
when: vm_arch == "s390x"
- name: set distro to RHEL
set_fact:
distro: rhel
when: vm_arch != "ppc64le"

- set_fact:
distro: "{{ distro_id.stdout }}"
# There's currently no ppc64le RHEL docker package, so we use CentOS instead.
- name: set distro to CentOS
set_fact:
distro: centos
when: vm_arch == "ppc64le"

- name: Register server with Red Hat for IBM POWER vms
tags: attach_subscription
Expand All @@ -25,21 +23,41 @@
until: registration is not failed
when: vm_arch == "ppc64le" or vm_arch == "s390x"

- name: Add repository
shell: |
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/"{{ distro }}"/docker-ce.repo
yum-config-manager --setopt="docker-ce-stable.baseurl=https://download.docker.com/linux/"{{ distro }}"/\$releasever/\$basearch/stable" --save
yum update -y
- name: Disable troublesome repo
ansible.builtin.shell: |
dnf config-manager --disable rhui-codeready-builder-for-rhel-8-x86_64-rhui-source-rpms
when: vm_config.find('-8') != -1 and vm_arch == 'amd64'

- name: Install needed utilities
ansible.builtin.dnf:
name:
- git
- make

- name: Add docker repos
ansible.builtin.shell: |
dnf config-manager --add-repo "https://download.docker.com/linux/{{ distro }}/docker-ce.repo"
when: runtime_command == 'docker'

- name: Install docker
yum:
ansible.builtin.dnf:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin
state: present
when: runtime_command == 'docker'

- name: Install podman
ansible.builtin.dnf:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- podman
- podman-docker
- git
- make
state: latest
update_cache: true
when: runtime_command == 'podman'

Loading