f5-ansible icon indicating copy to clipboard operation
f5-ansible copied to clipboard

bigip_virtual_server always return changed: true

Open dagheyman opened this issue 3 years ago • 12 comments

COMPONENT NAME

bigip_virtual_server

Environment

ANSIBLE VERSION
ansible 2.9.23
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/usr/users/XXXX/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Aug 13 2020, 02:51:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
BIGIP 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

Red Hat Enterprise Linux Server release 7.9 (Maipo)

SUMMARY

Every time I use the big_ip_virtual_server module, Ansible reports the result as "changed" (yellow output), even though no values are changed. I am using this together with a non-default partition together with profiles, so I'm guessing this could be related to https://github.com/F5Networks/f5-ansible/issues/961

STEPS TO REPRODUCE

Use the bigip_virtual_servers module in a playbook that also specifies a partition and profiles.

EXPECTED RESULTS

The module should not report changes when there is none.

ACTUAL RESULTS

Module always reports changed:true.

dagheyman avatar Sep 13 '21 09:09 dagheyman

@dagheyman - Please share the playbook you are using. we can try the same and help you resolve this issue.

trinaths avatar Sep 13 '21 11:09 trinaths

---

- hosts: all
  connection: local
  serial: 1
  tasks:
    - name: Configure virtual servers.
      bigip_virtual_server:
        partition: TEST
        name: test-vs 
        destination: 8.8.8.8
        port: "80"
        provider:
          server: XXX
          user: XXX
          password: XXX
          validate_certs: false
        snat: Automap
        state: present
        profiles:
          - /Common/http
          - /Common/tcp

Here is a minimal playbook to reproduce the issue. Note that if the partition is Common, there is no problem, the partition needs to be a non default one.

dagheyman avatar Sep 14 '21 07:09 dagheyman

@dagheyman - Let me test this and get back to you.

trinaths avatar Sep 14 '21 08:09 trinaths

I think this is due to the last_modified_time in the metadata, when I do a diff of my bigip.conf, I get the following result: " f5-ansible.last_modified {", "- value \"2021-09-15 12:59:55.234225\"", "+ value \"2021-09-15 13:26:59.300030\"",

jurgen1968 avatar Sep 15 '21 14:09 jurgen1968

---

- hosts: all
  connection: local
  serial: 1
  tasks:
    - name: Configure virtual servers.
      bigip_virtual_server:
        partition: TEST
        name: test-vs 
        destination: 8.8.8.8
        port: "80"
        provider:
          server: XXX
          user: XXX
          password: XXX
          validate_certs: false
        snat: Automap
        state: present
        profiles:
          - /Common/http
          - /Common/tcp

Here is a minimal playbook to reproduce the issue. Note that if the partition is Common, there is no problem, the partition needs to be a non default one.

Try to add insert_metadata: false to your task (inside 'bigip_virtual_server'). I had several months ago the same problem. Currently I'm using latest f5_modules (1.11.1) with ansible 2.10.x and it seems that's correct. But I'm not sure if insert_metadata false is workaround or latest version.

@dagheyman: EDIT: after today's test I can confirm that 'bigip_virtual_server' is working correctly - for unchanged virtual servers returns 'ok', for changed returns 'changed'. this test includes 'insert_metadata: true'. I'm using f5_modules version 1.11.1 with ansible-core 2.11.3. maybe helps.

mkyrc avatar Sep 20 '21 16:09 mkyrc

@horol Do you get this result even when using a partition that is not Common ?

The insert_metadata: false does not work for me, still always reporting changed: true.

dagheyman avatar Sep 21 '21 08:09 dagheyman

@horol Do you get this result even when using a partition that is not Common ?

@dagheyman: yes. I'm using always unique partition (not Common) per service/app configuration

mkyrc avatar Sep 21 '21 08:09 mkyrc

I'm using the version of the module bundled with Ansible 2.9.24, I will try to use the latest from galaxy instead and see if the results are different.

dagheyman avatar Sep 21 '21 08:09 dagheyman

Unfortunately I'm seeing the same results with even module version 1.11.1 installed from Galaxy. Could the Ansible version or BIG-IP version play a role in this as well?

dagheyman avatar Sep 22 '21 08:09 dagheyman

I have same results with 2.9.16 and the 1.11.1 collections, has this been fixed yet ?

muhammad-rafi avatar Sep 29 '21 22:09 muhammad-rafi

Using Ansible 2.9.26 + f5 collections v1.11.1, we have to add insert_metadata: false because (i suppose) of some access restrictions from our provider. We have limited access to a partition. The module always returns "changed: true". So if its fixed, as @martinkyrc says, when using insert_metadata: true, it still needs to be fixed when using false. NOTE: BigIP version: 15.1, OS: RHEL 8

geof77 avatar Oct 27 '21 13:10 geof77

The combination of Ansible (Tower) 2.9.27, BIG IP v 14.1.2.6, F5 collections v.1.12.0 and insert_metadata: true still have this problem for me.

I'm not able to try F5 collections v.1.13.0 since it fails with TypeError: split() takes no keyword arguments.

dagheyman avatar Jan 04 '22 09:01 dagheyman

Hi @dagheyman, I tried to create a VS in Common and in another partition and I got the same behavior. ok=1 in green and changed=1 in yellow.

If I tried to apply the same playbook without any change I got: ok=1 in green and changed=0 in white

Do you have a different behavior?

pgouband avatar Dec 01 '22 16:12 pgouband

@pgouband I have changed jobs and don't have access to any BIG IP instances anymore, sorry.

dagheyman avatar Dec 02 '22 07:12 dagheyman

Hi @dagheyman, ok. Is it ok to close the issue?

pgouband avatar Dec 02 '22 12:12 pgouband