AAP Image Update Procedure

Mindwatering Incorporated

Author: Tripp W Black

Created: 08/24 at 11:08 AM

 

Category:
Linux
Docker

Task:
Update an existing podman/docker execution environment image:


The steps below are being used to create a EE for communication between AAP and vCenter. We have the requests module, but the pyvomi code is still failing trying to check python using pyton instead of python 3. Therefore we have added an alias added to the existing image so that python, instead of only python3 can be run.


Steps:
Review the file contents of our copied main execution environment. We've updated the newtest-ee with additional_build_steps to add the python and pip soft-links. The first is needed to fix issue where the VMware vCenter call errors out looking for requests module that is already installed. The second was for our ease-of-use.

The main execution environment yml file consumes the other files. The updated section of newtest-ee.yml is in orange below.

We are in the image folder. Below are all our files.
# ls -ltr
drwxr-x--- 1 root root 41 Aug 11 01:01 context
-rwxr----- 1 root root 68 Aug 11 01:11 bind-dep.txt
-rw-r----- 1 root root 54 Aug 11 01:21 requirements.yml
-rw-r----- 1 root root 24 Aug 11 01:31 requirements.txt
-rw-r----- 1 root root 124 Aug 11 01:41 ansible.cfg
-rw-r----- 1 root root 228 Aug 11 01:00 test-ee.yml
drwxr-x--- 2 root root 99 _build
-rw-r----- 1 root root 1234 Aug 11 01:51 Containerfile

The build files:
# ls -ltr _build
-rwxr----- 1 root root 68 Aug 11 02:11 bind-dep.txt
-rw-r----- 1 root root 54 Aug 11 02:21 requirements.yml
-rw-r----- 1 root root 24 Aug 11 02:31 requirements.txt
-rw-r----- 1 root root 124 Aug 11 02:41 ansible.cfg


# cat newtest-ee.yml
---
version: 1
build_arg_defaults:
EE_BASE_IMAGE: 'ahub.mindwatering.net/my-ee:latest'

ansible_config: 'ansible.cfg'

dependencies:
galaxy: requirements.yml
python: requirements.txt
system: bind-dep.txt

additional_build_steps:
append:
- RUN ln -fs /usr/bin/python3 /usr/bin/python
- RUN ln -fs /usr/bin/pip3 /usr/bin/pin


# cat requirements.yml
---
collections:
- name: awx.awx
# version


# cat requirements.txt
requests==2.28.1


# cat bind-dep.txt
gcc [platform:rpm]
iputils [platform:rpm]
bind-utils [platform:rpm]


# cat ansible.cfg
[defaults]
collections_path=~/.ansible/collections:/usr/share/ansible/collections:./collections/ansible_collections


Prepare for push...
Login to the Ansible hub server before push:
# podman login ahub.mindwatering.net
<enter username and password in prompts>
Login Succeeded!

Send new test build to Ansible hub (as desired):
# podman push ahub.mindwatering.net/newtest-ee

Verify images on the Ansible hub:
# podman images | grep newtest-ee
<review output>

Perform build:
# ansible-builder build --tag=ahub.mindwatering.net/newtest-ee --file=newtest.yml --context=. -v=3
<review output>
Note: The build context is printed at the end of the new image build:
Complete! The build context can be found at: /home/myadmin/ansible-tower-setup-bundle-x.x.x-x/newtest-ee


Update/replace tagging as applicable:
# podmain rmi ahub.mindwatering.net/myee
# podman tag ahub.mindwatering.net/newtest-ee ahub.mindwatering.net/myee


Verify the packages and requirements are in the image for the execution environment:
# podman run --rm -it aap.mindwatering.net/my-ee bash
bash-4.4# pip3 list
<review output>
bash-4.4# python3 -V
<review output>
bash-4.4# python -V
<review output to confirm RUN link works>
bash-4.4# exit


Push to the Ansible hub repo:
# podman push ahub.mindwatering.net/my-ee



previous page