This collection provides Ansible roles for setting up and configuring a Red Hat MicroShift environment.
This role sets up a local container registry and optionally mirrors a list of container images to it.
- A host named
registrymust be defined in your Ansible inventory. podmanandskopeoneed to be installed on theregistryhost.
registry_mirror_images: A boolean that determines whether to mirror container images to the local registry. Defaults totrue.registry_images_to_mirror: A list of container images to mirror. The role provides a default list of images for MicroShift.ocp4_pull_secret: Your pull secret forquay.ioand other registries, in JSON format. This is required to pull the default images.
Default Usage (with image mirroring):
- hosts: registry
roles:
- role: registryCustomizing Mirrored Images:
You can override the default list of images by setting the registry_images_to_mirror variable.
- hosts: registry
roles:
- role: registry
vars:
registry_images_to_mirror:
- "my.registry.com/my/image:latest"
- "another.registry.com/another/image:1.2.3"Disabling Image Mirroring:
If you only want to set up the registry without mirroring images, set registry_mirror_images to false.
- hosts: registry
roles:
- role: registry
vars:
registry_mirror_images: false-
Create an inventory file (
inventory.yml):all: hosts: registry: ansible_host: 192.168.1.100
-
Create a playbook file (
playbook.yml):To mirror images from private registries, you need to provide a pull secret. You can get your pull secret from Red Hat OpenShift Cluster Manager.
--- - hosts: registry vars: ocp4_pull_secret: '{"auths":{"quay.io":{"auth":"<your_quay.io_pull_secret>"}}}' roles: - role: registry
-
Run the playbook:
ansible-playbook -i inventory.yml playbook.yml
- This role uses
skopeoto mirror images. It handles multi-architecture images and preserves the repository path.