set_openstack_containers
A role to set the environment variables for openstack services containers and friends used during OpenStack services deployment for any openstack operator.
The role will generate two 2 files in ~/ci-framework-data/artifacts/ directory after execution.
update_env_vars.sh: Reusable script to update the env variable from the job (useful for reproducing locally)operator_env.txt: List of updated env variables
Parameters
cifmw_set_openstack_containers_basedir: Directory to store role generated contents. Defaults to"{{ cifmw_basedir | default(ansible_user_dir ~ '/ci-framework-data') }}"cifmw_set_openstack_containers_registry: Name of the container registry to pull containers from. Defaults toquay.iocifmw_set_openstack_containers_namespace: Name of the container namespace. Defaults to{{ cifmw_default_container_image_namespace }}(defined in group_vars/all.yml)cifmw_set_openstack_containers_tag: Container tag. Defaults to{{ cifmw_default_container_image_tag }}(defined in group_vars/all.yml)cifmw_set_openstack_containers_tag_from_md5: Get the tag from delorean.repo.md5. Defaults tofalse.cifmw_set_openstack_containers_dlrn_md5_path: Full path of delorean.repo.md5. Defaults to/etc/yum.repos.d/delorean.repo.md5.cifmw_set_openstack_containers_overrides: Extra container overrides. Defaults to{}cifmw_set_openstack_containers_overrides_transform: Extra container overrides but here the key is expected to be the IMAGE_URL name (like incifmw_set_openstack_containers_overrides) but the value is the definite name of the image, so the registry and tag addition to that name will happen. Defaults to{ RELATED_IMAGE_IRONIC_PYTHON_AGENT_IMAGE_URL_DEFAULT: "ironic-python-agent"}cifmw_set_openstack_containers_prefix: Container prefix name to set. Defaults toopenstackcifmw_set_openstack_containers_prefix_filter: Include in filter containers containing prefix in the name. Defaults to value ofcifmw_set_openstack_containers_prefixcifmw_set_openstack_containers_excluded_envs: (List[string]) List of excluded environment variables for container, that should not be modified by the role. Defaults to[].cifmw_set_openstack_containers_openstack_version_change: (Boolean) Set environment variables for openstack services containers for specific OPENSTACK_RELEASE_VERSION defined in cifmw_set_openstack_containers_update_target_version. It should be used only for meta openstack operator in prepare for openstack minor update. Defaults tofalse.cifmw_set_openstack_containers_update_target_version: Value of OPENSTACK_RELEASE_VERSION env in openstack operator that should be set. Defaults to0.0.2.cifmw_set_openstack_containers_openstack_final_env: File name to store the operator env in a file. Default tooperator_env.txt.
Examples
Notes: Make sure we installed the meta operator before updating the environment variable(s) for all openstack services. openstack-baremetal-operator is not installed by meta operator. Make sure we first install it openstack-baremetal-operator and update the environment variable for this baremetal operator.
Update all openstack services containers env vars with podified-ci-testing tag in meta operator
It is used in edpm-prepare role to update all openstack service containers.
- hosts: all
tasks:
# It will generate delorean.md5 file using podified-ci-testing dlrn tag
# in ~/ci-framework-data/artifacts/repositories/delorean.repo.md5
- name: Populate podified-ci-testing repo with repo-setup role
ansible.builtin.include_role:
name: repo-setup
vars:
cifmw_repo_setup_promotion: podified-ci-testing
cifmw_repo_setup_branch: antelope
- name: Update all openstack services containers env vars in meta operator with podified-ci-testing
vars:
cifmw_set_openstack_containers_dlrn_md5_path: "~/ci-framework-data//artifacts/repositories/delorean.repo.md5"
cifmw_set_openstack_containers_tag_from_md5: true
cifmw_set_openstack_containers_registry: quay.rdoproject.org
ansible.builtin.include_role:
name: set_openstack_containers
Update all the openstack services containers env vars with podified-ci-testing for a single operator baremetal
It is used in edpm_deploy_baremetal role to update the UEFI image
- hosts: all
tasks:
# It will generate delorean.md5 file using podified-ci-testing dlrn tag
# in ~/ci-framework-data/artifacts/repositories/delorean.repo.md5
- name: Populate podified-ci-testing repo with repo-setup role
ansible.builtin.include_role:
name: repo-setup
vars:
cifmw_repo_setup_promotion: podified-ci-testing
cifmw_repo_setup_branch: antelope
- name: Update all openstack services containers env vars in baremetal operator with podified-ci-testing
vars:
cifmw_set_openstack_containers_operator_name: openstack-baremetal
cifmw_set_openstack_containers_dlrn_md5_path: "~/ci-framework-data//artifacts/repositories/delorean.repo.md5"
cifmw_set_openstack_containers_tag_from_md5: true
cifmw_set_openstack_containers_registry: quay.rdoproject.org
ansible.builtin.include_role:
name: set_openstack_containers
Update an specific environment variables for a particular operator
It is used in edpm-ansible job to update the ANSIBLEEE_IMAGE_URL_DEFAULT.
- hosts: all
tasks:
- name: Update ANSIBLEEE_IMAGE_URL_DEFAULT environment variable with custom image.
vars:
ansibleee_runner_img: "quay.io/openstack-k8s-operators/openstack-ansibleee-runner:<random_hash>"
cifmw_set_openstack_containers_operator_name: openstack-ansibleee
cifmw_set_openstack_containers_overrides:
ANSIBLEEE_IMAGE_URL_DEFAULT: "{{ ansibleee_runner_img }}"
ansible.builtin.include_role:
name: set_openstack_containers
Update an image which doesn’t have openstack- in its name
For instance RELATED_IMAGE_IRONIC_PYTHON_AGENT_IMAGE_URL_DEFAULT has this kind of url registry-proxy.engineering.redhat.com/rh-osbs/rhoso18-ironic-python-agent:18.0 where the usual openstack- prefix is absent.
Setting cifmw_set_openstack_containers_overrides_transform will enable the transformation to happen.
- hosts: all
tasks:
- name: Update IRONIC_PYTHON_AGENT_IMAGE environment variable with custom image.
vars:
cifmw_set_openstack_containers_registry: 'quay.io'
cifmw_set_openstack_containers_namespace: 'test-namespace'
cifmw_set_openstack_containers_prefix: 'openstack'
cifmw_set_openstack_containers_tag: 'test-tag'
cifmw_set_openstack_containers_overrides_transform:
RELATED_IMAGE_IRONIC_PYTHON_AGENT_IMAGE_URL_DEFAULT: "ironic-python-agent"
ansible.builtin.include_role:
name: set_openstack_containers
Will transform registry-proxy.engineering.redhat.com/rh-osbs/rhoso18-ironic-python-agent:18.0 into quay.io/test-namespace/ironic-python-agent:test-tag
Update all openstack services containers env vars in meta operator with tag from delorean and set OPENSTACK_RELEASE_VERSION env
It is used in update job to set openstack services containers in prepare for running openstack update.
- name: Update all openstack services containers env vars in meta operator with tag from delorean and set OPENSTACK_RELEASE_VERSION
vars:
cifmw_set_openstack_containers_dlrn_md5_path: "~/ci-framework-data//artifacts/repositories/delorean.repo.md5"
cifmw_set_openstack_containers_tag_from_md5: true
cifmw_set_openstack_containers_registry: quay.rdoproject.org
cifmw_set_openstack_containers_openstack_version_change: true
cifmw_set_openstack_containers_update_target_version: 0.0.2
ansible.builtin.include_role:
name: set_openstack_containers