Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bigip_vcmp_guest module always reports changed #2394

Open
jasonjuenger opened this issue Mar 1, 2024 · 4 comments · May be fixed by #2395
Open

bigip_vcmp_guest module always reports changed #2394

jasonjuenger opened this issue Mar 1, 2024 · 4 comments · May be fixed by #2395
Labels
awaiting-user-action issue awaiting user's response and/or requested action

Comments

@jasonjuenger
Copy link

COMPONENT NAME

bigip_vcmp_guest

Environment

ANSIBLE VERSION
ansible-playbook [core 2.15.8]
  config file = /runner/project/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.9/site-packages/ansible
  ansible collection location = /runner/requirements_collections:/root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible-playbook
  python version = 3.9.18 (main, Sep 22 2023, 17:58:34) [GCC 8.5.0 20210514 (Red Hat 8.5.0-20)] (/usr/bin/python3.9)
  jinja version = 3.1.2
  libyaml = True
BIGIP VERSION
15.1.10.2 Build 0.44.2
CONFIGURATION

None

OS / ENVIRONMENT

Ansible Automation Platform, execution environment based on ansible-automation-platform-24/ee-supported-rhel8 image.

SUMMARY

bigip_vcmp_guest module reports changed even when no changes are made on the vCMP guest. This was verified by comparing configs pre- and post-run in both the GUI and API (mgmt/tm/vcmp/guest endpoint). Additionally, running multiple playbook runs in a row with identical vars reports changed on every run. This was tested against a vCMP guest deployed manually via the GUI.

STEPS TO REPRODUCE

Deploy a vCMP guest via the GUI with the settings shown in the Ansible task below, with the guest state set to 'deployed'. Once the guest has finished provisioning and has completed bootup set a hostname on the vCMP guest from the host system. Run the Ansible task below. Ansible will report changed on this and all future playbook runs even if no changes are made to the guest configuration.

- name: Provision vCMP guest
  bigip_vcmp_guest:
    provider: REDACTED
    name: "testguest01"
    mgmt_network: "bridged"
    mgmt_address: "10.0.1.10/23"
    mgmt_route: "10.0.0.1"
    initial_image: "BIGIP-15.1.10.2-0.0.2.iso"
    vlans: [
        "peer-net"
    ],
    cores_per_slot": 2,
    number_of_slots": 1,
    min_number_of_slots": 1,
    allowed_slots": [
        "1"
    ],
    state: "present",
    delete_virtual_disk: false,
    partition: "Common"
  delegate_to: localhost
  register: deploy_guest
EXPECTED RESULTS

After initial deployment of the guest subsequent playbook runs should return OK, not changed. Additionally, existing guests deployed via another method should return OK when matching variables are supplied to the module.

ACTUAL RESULTS

Playbook runs always report changed, even when variables are unchanged. GUI and API both show no changes to the guest between playbook runs.

{
  "allowed_slots": [
    "1"
  ],
  "changed": true,
  "invocation": {
    "module_args": {
      "provider": {
        "server": "REDACTED",
        "user": "REDACTED",
        "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
        "validate_certs": false,
        "server_port": 443,
        "transport": "rest",
        "timeout": null,
        "no_f5_teem": false,
        "auth_provider": null
      },
      "name": "testguest01",
      "mgmt_network": "bridged",
      "mgmt_address": "10.0.1.10/23",
      "mgmt_route": "10.0.0.1",
      "initial_image": "BIGIP-15.1.10.2-0.0.2.iso",
      "vlans": [
        "peer-net"
      ],
      "cores_per_slot": 2,
      "number_of_slots": 1,
      "min_number_of_slots": 1,
      "allowed_slots": [
        "1"
      ],
      "state": "present",
      "delete_virtual_disk": false,
      "partition": "Common",
      "initial_hotfix": null
    }
  },
  "_ansible_no_log": null,
  "_ansible_delegated_vars": {
    "ansible_host": "localhost",
    "ansible_port": null,
    "ansible_user": "REDACTED",
    "ansible_connection": "local"
  }
}
@jasonjuenger jasonjuenger added bug Issues that are related to bugs in the Ansible modules untriaged issue that needs an initial response from the developers labels Mar 1, 2024
@jasonjuenger
Copy link
Author

jasonjuenger commented Mar 4, 2024

After additional testing I have narrowed the issue down to the 'allowed_slots' parameter. If I leave that parameter undefined the task returns 'ok' as expected, even with all other parameters defined as above. If I add that parameter back in then the task returns 'changed' every time.

Edit: The issue appears to be the data type this module is expecting for allowed_slots (list of str) and what F5 expects (list of int). I tested casting the allowed_slots param to a list of int and now the module returns OK as expected. I will submit a PR to change the parameter type to list of int.

@pgouband
Copy link
Contributor

pgouband commented Mar 6, 2024

Hi @jasonjuenger,

Thanks for the feedback.

Individuals or business entities who contribute to this project must complete and submit the F5 Contributor License Agreement to [email protected] prior to their code submission being included in this project.

@pgouband pgouband added awaiting-user-action issue awaiting user's response and/or requested action and removed untriaged issue that needs an initial response from the developers labels Mar 6, 2024
@jasonjuenger
Copy link
Author

Hi @pgouband,

I will not be able to complete that form in a timely manner. I am OK if someone else that is already an approved contributor wishes to create a new PR with the same change.

The change I submitted changes the variable type, which could be a breaking change for some users. If there is no appetite to make that change there is another option to cast the existing value retrieved from the F5 for comparison (self.have.allowed_slots) to a list of str to match the input type. Something like

@property
def allowed_slots(self):
    if self.want.allowed_slots is None:
        return None
    if self.have.allowed_slots is None:
        return self.want.allowed_slots
    have_allowed_slots = [str(x) for x in self.have.allowed_slots]
    if set(self.want.allowed_slots) != set(have_allowed_slots):
        return self.want.allowed_slots

@pgouband
Copy link
Contributor

HI @jasonjuenger,

Thanks but without the CLA we can't add your code in our project.

@RavinderReddyF5 RavinderReddyF5 removed the bug Issues that are related to bugs in the Ansible modules label Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-user-action issue awaiting user's response and/or requested action
Projects
None yet
3 participants