F5Networks / f5-ansible

Imperative Ansible modules for F5 BIG-IP products
GNU General Public License v3.0
375 stars 231 forks source link

bigip_node requires quorum field to enable existing node. #742

Closed caphrim007 closed 6 years ago

caphrim007 commented 6 years ago
SUMMARY

When trying to set node state to enabled, quorum value must be specified.

ISSUE TYPE
COMPONENT NAME

bigip_node

ANSIBLE VERSION
ansible 2.5.4
  config file = /Users/michael.perzel/stash/ansible-test/networkAutomation/ansible.cfg
  configured module search path = [u'/usr/share/ansible', u'/opt/ansible/ansible-test/networkAutomation']
  ansible python module location = /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ansible
  executable location = /Library/Frameworks/Python.framework/Versions/2.7/bin/ansible
  python version = 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 12:01:12) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
CONFIGURATION

No customizations

OS / ENVIRONMENT

BIG-IP 13.1.0.5 Build 0.0.5 Point Release 5

STEPS TO REPRODUCE
---
- name: Network Automation Playbook
  hosts: 127.0.0.1
  connection: local
  gather_facts: false
  tasks:
    - name: Enable node
      local_action:
        module: bigip_node
        server: '{{ item }}'
        user: '{{ f5_ltm_username }}'
        password: '{{ f5_ltm_password }}'
        state: enabled
        partition: Common
        name: "{{ host | lower }}"
        validate_certs: no
      with_items: "{{ f5_ltm_server }}"
EXPECTED RESULTS

I would expect the session and monitor state of the node in the F5 LTM to be set to enabled.

ACTUAL RESULTS

An error message is returned stating quorum is a required field. Since this is an existing node, I don't think this should be a required field. If I specify a quorum of 1 (what the quorum of the node is currently), I get "400 Unexpected Error: Bad Request for uri: https://mll-ltm01.surescripts.internal:443/mgmt/tm/ltm/node/~Common~mll-swch01a.surescripts-lt.ext/\nText: u'{\"code\":400,\"message\":\"one or more properties must be specified\",\"errorStack\":[],\"apiError\":26214401}'"

PLAYBOOK: enableNode.yml ****************************************************************************************************************************************************
1 plays in enableNode.yml

PLAY [Network Automation Validation Playbook] *******************************************************************************************************************************
META: ran handlers
TASK [Enable node including session/monitor state] **************************************************************************************************************************
task path: /Users/michael.perzel/stash/ansible-test/networkAutomation/enableNode.yml:24
Using module file /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_node.py
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: michael.perzel
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1527867206.39-118049420518010 `" && echo ansible-tmp-1527867206.39-118049420518010="` echo $HOME/.ansible/tmp/ansible-tmp-1527867206.39-118049420518010 `" ) && sleep 0'
<localhost> PUT /Users/michael.perzel/.ansible/tmp/ansible-local-93091bHXxJ_/tmp2kHpgJ TO /Users/michael.perzel/.ansible/tmp/ansible-tmp-1527867206.39-118049420518010/bigip_node.py
<localhost> EXEC /bin/sh -c 'chmod u+x /Users/michael.perzel/.ansible/tmp/ansible-tmp-1527867206.39-118049420518010/ /Users/michael.perzel/.ansible/tmp/ansible-tmp-1527867206.39-118049420518010/bigip_node.py && sleep 0'
<localhost> EXEC /bin/sh -c '/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python /Users/michael.perzel/.ansible/tmp/ansible-tmp-1527867206.39-118049420518010/bigip_node.py && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /Users/michael.perzel/.ansible/tmp/ansible-tmp-1527867206.39-118049420518010/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
  File "/var/folders/p6/vlfvmcbx4h37x1sxr109t7vhrvfdvf/T/ansible_cJ5Nn1/ansible_module_bigip_node.py", line 735, in main
    results = mm.exec_module()
  File "/var/folders/p6/vlfvmcbx4h37x1sxr109t7vhrvfdvf/T/ansible_cJ5Nn1/ansible_module_bigip_node.py", line 520, in exec_module
    changed = self.present()
  File "/var/folders/p6/vlfvmcbx4h37x1sxr109t7vhrvfdvf/T/ansible_cJ5Nn1/ansible_module_bigip_node.py", line 534, in present
    return self.update()
  File "/var/folders/p6/vlfvmcbx4h37x1sxr109t7vhrvfdvf/T/ansible_cJ5Nn1/ansible_module_bigip_node.py", line 605, in update
    if not self.should_update():
  File "/var/folders/p6/vlfvmcbx4h37x1sxr109t7vhrvfdvf/T/ansible_cJ5Nn1/ansible_module_bigip_node.py", line 598, in should_update
    result = self._update_changed_options()
  File "/var/folders/p6/vlfvmcbx4h37x1sxr109t7vhrvfdvf/T/ansible_cJ5Nn1/ansible_module_bigip_node.py", line 488, in _update_changed_options
    change = diff.compare(k)
  File "/var/folders/p6/vlfvmcbx4h37x1sxr109t7vhrvfdvf/T/ansible_cJ5Nn1/ansible_module_bigip_node.py", line 384, in compare
    result = getattr(self, param)
  File "/var/folders/p6/vlfvmcbx4h37x1sxr109t7vhrvfdvf/T/ansible_cJ5Nn1/ansible_module_bigip_node.py", line 406, in monitor_type
    "Quorum value must be specified with monitor_type 'm_of_n'."
failed: [127.0.0.1 -> localhost] (item=(0, u'mll-ltm01.surescripts.internal')) => {
    "changed": false,
    "invocation": {
        "module_args": {
            "address": null,
            "description": null,
            "fqdn": null,
            "monitor_type": null,
            "monitors": null,
            "name": "mll-swch01a.surescripts-lt.ext",
            "partition": "Common",
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "provider": {
                "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "server": "mll-ltm01.surescripts.internal",
                "server_port": 443,
                "ssh_keyfile": null,
                "timeout": 10,
                "transport": "rest",
                "user": "ansible",
                "validate_certs": false
            },
            "quorum": null,
            "server": "mll-ltm01.surescripts.internal",
            "server_port": 443,
            "state": "enabled",
            "transport": "rest",
            "user": "ansible",
            "validate_certs": false
        }
    },
    "item": [
        0,
        "mll-ltm01.surescripts.internal"
    ],
    "msg": "Quorum value must be specified with monitor_type 'm_of_n'."
}
caphrim007 commented 6 years ago

on behalf of @perzizzle

caphrim007 commented 6 years ago

https://github.com/ansible/ansible/issues/41013#issuecomment-393920348