Closed simonkowallik closed 1 year ago
The exact ansible environment can be build using the below Dockerfile
.
FROM python:3.10-bullseye
RUN useradd ansible -d /ansible -M -u 1000
RUN apt update; apt upgrade -y;
RUN apt install -y \
jq \
less \
vim \
iproute2 \
rpm \
;
RUN pip3 install \
'ansible-core>=2.14.1' \
ansible \
ansible-lint \
yamllint \
;
# requirements.txt of f5_modules and f5_bigip
RUN pip3 install \
cryptography \
objectpath \
ordereddict \
simplejson \
paramiko \
jinja2 \
netaddr \
;
RUN \
echo ' UserKnownHostsFile /dev/null' >> /etc/ssh/ssh_config; \
echo ' StrictHostKeyChecking no' >> /etc/ssh/ssh_config;
USER ansible
WORKDIR /ansible
docker build -t ansible-runner .
fixed in 1.13.0
COMPONENT NAME
f5networks.f5_bigip.bigip_as3_deploy
version1.12.0
Environment
ANSIBLE VERSION
BIGIP VERSION
CONFIGURATION
OS / ENVIRONMENT
N/A
SUMMARY
bigip_as3_deploy
assumes that a declaration starts with the AS3 class, but AS3 does allow declarations to omit the AS3 class and directly start with the ADC class.There are many example declarations in the Postman collection on the release page of the f5-appsvcs-extension omitting the AS3 class and directly using the ADC class.
STEPS TO REPRODUCE
Below is a playbook with a full repro of the issue. Obviously the
&bigip_provider
needs to be modified to match the test bed.EXPECTED RESULTS
The expectation is that
bigip_as3_deploy
implements the provided AS3 declaration and not require explicitly wrapping it in the AS3 class. The AS3 API perfectly supports this use-case.ACTUAL RESULTS
ROOT CAUSE
The root cause lies in the exists() method, specifically in the below line:
https://github.com/F5Networks/f5-ansible-bigip/blob/4c65ba594dac5c1018550a8ab923eb74753a2453/ansible_collections/f5networks/f5_bigip/plugins/modules/bigip_as3_deploy.py#L251
The above code inserts (or overwrites) the
action
property without checking if the AS3 class is actually used. This inserts theaction
property into the ADC class which results in a validation error.This can be easily fixed by checking for class AS3 and wrapping the actual declaration in an AS3 class if it isn't used.