f5-ansible
f5-ansible copied to clipboard
bigip_gtm_server in CHECK mode does not verify datacenter existence
ISSUE TYPE
- Bug Report
COMPONENT NAME
bigip_gtm_server
ANSIBLE VERSION
ansible 2.9.17
config file = /home/pbystrov-a/.ansible.cfg
configured module search path = [u'/home/pbystrov-a/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.16 (default, Oct 10 2019, 22:02:15) [GCC 8.3.0]
PYTHON VERSION
Python 2.7.16
BIGIP VERSION
Sys::Version
Main Package
Product BIG-IP
Version 14.1.2.6
Build 0.0.2
Edition Point Release 6
Date Fri Jun 5 11:36:46 PDT 2020
CONFIGURATION
OS / ENVIRONMENT
Debian GNU/Linux 10 (buster)
SUMMARY
bigip_gtm_server in CHECK mode does not verify datacenter existence
STEPS TO REPRODUCE
ansible-playbook playbooks/bigip-gtm-bug.yml --check --diff -v
- name: Reproduce
hosts: localhost
strategy: free
gather_facts: no
vars:
provider:
server: "{{ lookup('env', 'F5_GTM_DEVICE') }}"
transport: rest
user: "{{ lookup('env', 'F5_GTM_USER') }}"
password: "{{ lookup('env', 'F5_GTM_PASSWORD') }}"
validate_certs: no
tasks:
- name: Create server(s)
f5networks.f5_modules.bigip_gtm_server:
provider: "{{ provider }}"
name: TEST-SERVER
server_type: generic-host
devices:
- name: TEST-SERVER
address: "1.1.1.1"
datacenter: NON-EXISTENT-DC
monitors:
- gateway_icmp
prober_preference: inherit
prober_fallback: any
state: present
delegate_to: localhost
EXPECTED RESULTS
I expect this task to fail check mode with 'Datacenter does not exist' error
ACTUAL RESULTS
Task successfully completes in check mode, but then fails during normal run.
$ ansible-playbook playbooks/bigip-gtm-bug.yml --check
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
PLAY [Reproduce bigip_gtm_server check mode] ********
TASK [Create server(s)] ********
changed: [localhost]
PLAY RECAP ********
localhost : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
$ ansible-playbook playbooks/bigip-gtm-bug.yml
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
PLAY [Reproduce bigip_gtm_server check mode] ********
TASK [Create server(s)] ********
fatal: [localhost]: FAILED! => {"changed": false, "msg": "{\"code\":400,\"message\":\"01070189:3: Server /Common/TEST-SERVER refers to a data center (/Common/NON-EXISTENT-DC) that does not exist\",\"errorStack\":[],\"apiError\":3}"}
PLAY RECAP ********
localhost : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
Thank you for the feedback. Created INFRAANO-227 for internal tracking
Hi, we are closing this request now. Please re-open if required or send an email to [email protected]. Thanks!