Installing and running collection from EE¶
Use the following information to create an Execution Environment (EE) container, run playbooks from the EE, and then create F5 ansible collections daily builds on an EE.
Creating EE (Execution Environment) container with f5_modules and f5_bigip collections¶
Before you start install the following packages:
For more information on ansible-builder head to https://ansible-builder.readthedocs.io/en/latest/index.html.
ansible-builder
pip install ansible-builder
For more information on ansible-builder head to https://ansible-navigator.readthedocs.io/en/latest/settings/.
ansible-navigator
pip3 install 'ansible-navigator[ansible-core]'
Create the following files:
execution-environment.yml
version: 3
dependencies:
galaxy: requirements.yml
python: requirements.txt
additional_build_steps:
prepend_base:
- RUN ln -s /usr/bin/microdnf /usr/bin/dnf
images:
base_image:
name: quay.io/ansible/creator-ee:latest
requirements.yml
---
collections:
- name: ansible.netcommon
version: ">=2.0.0"
- name: f5networks.f5_modules
- name: f5networks.f5_bigip
requirements.txt
ansible
ansible-runner
cryptography
objectpath
ordereddict
simplejson
paramiko
jinja2
netaddr
packaging
Once the previous files are created, run the following command from the same directory. If you placed the files somewhere else refer to ansible-builder documentation for appropriate command switches.
ansible-builder build --tag f5net_ee --container-runtime docker
Once the process is complete the image should appear when running docker image ls
command:
└─▪ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
f5net_ee latest 58cfdfa301f2 13 minutes ago 664MB
test_image latest c6b10c5283a3 2 days ago 662MB
quay.io/ansible/ansible-navigator-demo-ee 0.4.0 2542b362b47e 4 months ago 1.28GB
Running Playbooks from EE¶
To use the EE container to execute playbooks in your environment, it is recommended that an ansible-navigator config file is created to avoid typing long commands e.g.
ansible-navigator run to_run/f5_test.yaml --eei f5net_ee --pp never -i inv/hosts_bigips.yaml -m stdout --log-level debug --pas test_run.json
can be shortened to:
ansible-navigator run to_run/f5_test.yaml -i inv/hosts_bigips.yaml
with the following ansible-navigator.yml
file:
ansible-navigator:
ansible:
config: /tmp/ansible.cfg
ansible-runner:
artifact-dir: /tmp
rotate-artifacts-count: 10
timeout: 300
app: run
execution-environment:
container-engine: docker
image: f5net_ee:latest
pull-policy: never
logging:
level: debug
append: True
file: /tmp/log.txt
mode: stdout
playbook-artifact:
enable: True
save-as: /tmp/test_run.json
Please refer to ansible-navigator official documentation for further help: https://ansible-navigator.readthedocs.io/en/latest/settings/
One thing to note is that updating collections installed in containers, which were created locally, is not supported by ansible-builder,
it seems that ansible-builder uses docker cache to create EE image so any attempts to rebuild the container will not cause new version
of collection to be downloaded. To remedy this you can run docker command with –no-cache option against Dockerfile in
the context directory which was created in the folder where ansible-builder build
command was run:
docker build -f context/Dockerfile -t f5net_ee context --no-cache
Creating F5 Networks ansible collections daily builds on EE¶
The process of creating the EE container with daily builds remains the same as above, with the exception of requirements.yml
file, which should be as follows:
---
collections:
- name: ansible.netcommon
version: ">=2.0.0"
- name: f5networks.f5_modules
source: https://github.com/F5Networks/f5-ansible.git#ansible_collections/f5networks/f5_modules
type: git
version: devel
- name: f5networks.f5_bigip
source: https://github.com/F5Networks/f5-ansible-bigip.git#ansible_collections/f5networks/f5_bigip
type: git
version: devel
- Learn more about Ansible collections.
- F5 BIG-IP Ansible collections
- F5OS Ansible collection