diff --git a/.config/molecule/config_podman.yml b/.config/molecule/config_podman.yml index c45aa8ec5..27954c4b6 100644 --- a/.config/molecule/config_podman.yml +++ b/.config/molecule/config_podman.yml @@ -7,17 +7,13 @@ log: true platforms: - name: centos hostname: centos - image: ubi9/ubi-init + image: ${TRIPLEO_ANSIBLE_MOLECULE_IMAGE:-"ubi9/ubi-init"} registry: - url: registry.access.redhat.com + url: ${TRIPLEO_ANSIBLE_MOLECULE_REGISTRY:-"registry.access.redhat.com"} dockerfile: Dockerfile.j2 pkg_extras: python*setuptools - command: /sbin/init - volumes: - - /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro - - /etc/pki/rpm-gpg:/etc/pki/rpm-gpg:O - - /opt/yum.repos.d:/etc/yum.repos.d:O - - /etc/dnf/vars:/etc/dnf/vars:O + command: ${TRIPLEO_ANSIBLE_MOLECULE_COMMAND:-"/sbin/init"} + volumes: ${TRIPLEO_ANSIBLE_MOLECULE_VOLUMES:-['/etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro','/etc/pki/rpm-gpg:/etc/pki/rpm-gpg:O','/opt/yum.repos.d:/etc/yum.repos.d:O','/etc/dnf/vars:/etc/dnf/vars:O']} privileged: true environment: &env http_proxy: "{{ lookup('env', 'http_proxy') }}" diff --git a/ansible-test-env-podman.rc b/ansible-test-env-podman.rc new file mode 100644 index 000000000..0b7b3b0b7 --- /dev/null +++ b/ansible-test-env-podman.rc @@ -0,0 +1,4 @@ +export TRIPLEO_ANSIBLE_MOLECULE_COMMAND="/bin/sleep infinity" +export TRIPLEO_ANSIBLE_MOLECULE_VOLUMES="[]" +export TRIPLEO_ANSIBLE_MOLECULE_IMAGE="centos/centos:stream9" +export TRIPLEO_ANSIBLE_MOLECULE_REGISTRY="quay.io" diff --git a/doc/source/contributing_roles.rst b/doc/source/contributing_roles.rst index d8811c971..5ba98fa8e 100644 --- a/doc/source/contributing_roles.rst +++ b/doc/source/contributing_roles.rst @@ -133,9 +133,19 @@ file from the project root, and then execute the following commands. .. code-block:: console + (test-python) $ source ansible-test-env.rc (test-python) $ cd tripleo_ansible/roles/${NEWROLENAME}/ - (test-python) $ molecule test --all + (test-python) $ molecule --base-config ../../../.config/molecule/config.yml test --all +To run a test using the `podman` driver, `ansible-test-env-podman.rc` also +needs to be sourced, and specify the `config_podman.yml` molecule config. + +.. code-block:: console + + (test-python) $ source ansible-test-env.rc + (test-python) $ source ansible-test-env-podman.rc + (test-python) $ cd tripleo_ansible/roles/${NEWROLENAME}/ + (test-python) $ molecule --base-config ../../../.config/molecule/config_podman.yml test --all If a role has more than one scenario, a specific scenario can be specified on the command line. Running specific scenarios will diff --git a/tripleo_ansible/roles/test_deps/tasks/main.yml b/tripleo_ansible/roles/test_deps/tasks/main.yml index 4b47cbd67..a803fea78 100644 --- a/tripleo_ansible/roles/test_deps/tasks/main.yml +++ b/tripleo_ansible/roles/test_deps/tasks/main.yml @@ -48,17 +48,6 @@ - (ansible_facts['os_family'] | lower) == 'redhat' - mirrors_file.stat.exists | bool block: - - name: Fetch latest repo version - uri: - url: https://trunk.rdoproject.org/centos{{ ansible_facts['distribution_major_version'] }}/current/delorean.repo - return_content: true - register: tripleo_packages - - - name: Create default repo file - copy: - content: "{{ tripleo_packages.content }}" - dest: /etc/yum.repos.d/delorean.repo - - name: Disable ubi host subscription-manager integration file: path: /etc/rhsm-host @@ -75,6 +64,22 @@ - ubi-9-baseos - ubi-9-codeready-builder +- name: tripleo-repos Block + become: true + when: + - (ansible_facts['os_family'] | lower) == 'redhat' + block: + - name: Fetch latest repo version + uri: + url: https://trunk.rdoproject.org/centos{{ ansible_facts['distribution_major_version'] }}/current/delorean.repo + return_content: true + register: tripleo_packages + + - name: Create default repo file + copy: + content: "{{ tripleo_packages.content }}" + dest: /etc/yum.repos.d/delorean.repo + - name: Install tripleo-repos package become: true package: