Skip to content

Idempotency in bigip_provision for module mgmt and memory value #2499

@oldmanhere

Description

@oldmanhere
COMPONENT NAME

bigip_provision version 1.39 and before

Environment

ANSIBLE VERSION
 2.15.13,  python version = 3.9.21
BIGIP VERSION
17.5.1.3 and all before
CONFIGURATION
OS / ENVIRONMENT
SUMMARY

The ansible task result for memory using bigip_provision is always "changed", even the value is already the same on big ip

STEPS TO REPRODUCE

Use multiple times one of these tasks. The first could change the value, but the next ones with the same value must do nothing.

    - name: Config Large for memory management
      f5networks.f5_modules.bigip_provision:
        module: mgmt
        memory: large
        provider: "{{ provider }}"
      delegate_to: localhost

or

    - name: Config "1000" for memory management
      f5networks.f5_modules.bigip_provision:
        module: mgmt
        memory: 1000
        provider: "{{ provider }}"
      delegate_to: localhost

or

    - name: Config "2000" for memory management
      f5networks.f5_modules.bigip_provision:
        module: mgmt
        memory: "2000"
        provider: "{{ provider }}"
      delegate_to: localhost

EXPECTED RESULTS

ok: [mybigip -> localhost]

ACTUAL RESULTS

changed: [mybigip -> localhost]

SOLUTION

The value on big ip is in string and the value from the task is in integer. Those values differ.

So, change

    @property
    def memory(self):
        if self._values['memory'] is None:
            return None
        if self._values['module'] != 'mgmt':
            return None
        return int(self._validate_memory_limit(self._values['memory']))

by

    @property
    def memory(self):
        if self._values['memory'] is None:
            return None
        if self._values['module'] != 'mgmt':
            return None
        return str(self._validate_memory_limit(self._values['memory']))

Tested with success on our environments

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssues that are related to bugs in the Ansible modules

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions