F5Networks / f5-ansible-bigip

Declarative Ansible collection for managing F5 BIG-IP/BIG-IQ.
37 stars 17 forks source link

bigip_do_deploy - throws error "Server parameter cannot be None or missing" #9

Closed ajgerace closed 3 years ago

ajgerace commented 3 years ago
COMPONENT NAME

bigip_do_deploy

Environment

ANSIBLE VERSION
[gerace@europa ansible]$ ansible --version
ansible [core 2.11.4] 
  config file = /home/gerace/Documents/ansible/ansible.cfg
  configured module search path = ['/home/gerace/Documents/ansible/library']
  ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
  ansible collection location = /home/gerace/Documents/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
  jinja version = 3.0.1
  libyaml = True
BIGIP VERSION
[root@localhost:NO LICENSE:Standalone] config # tmsh show sys version

Sys::Version
Main Package
  Product     BIG-IP
  Version     15.1.3.1
  Build       0.0.18
  Edition     Point Release 1
  Date        Mon Jul 12 23:47:21 PDT 2021
CONFIGURATION
ansible_host: "192.168.0.201"
ansible_user: "admin"
ansible_httpapi_password: "{{ bigip_admin_pass }}"
ansible_network_os: f5networks.f5_bigip.bigip
ansible_httpapi_use_ssl: yes
ansible_httpapi_validate_certs: no
OS / ENVIRONMENT

CentOS7

SUMMARY

Attempting to post a DO declaration to the BIG-IP and receive the following error: fatal: [notahost]: FAILED! => {"changed": false, "msg": "Server parameter cannot be None or missing, please provide a valid value"}

STEPS TO REPRODUCE
---
- hosts: all
  collections:
    - f5networks.f5_bigip
  connection: httpapi

  vars:
    ansible_host: "192.168.0.201"
    ansible_user: "admin"
    ansible_httpapi_password: "{{ bigip_admin_pass }}"
    ansible_network_os: f5networks.f5_bigip.bigip
    ansible_httpapi_use_ssl: yes
    ansible_httpapi_validate_certs: no

  tasks:
    - name: Deploy DO declaration
      bigip_do_deploy:
        content: "{{ lookup('file', '{{bigipVmName}}_do.json') }}"  
EXPECTED RESULTS

Have the DO declaration posted to the BIG-IP

ACTUAL RESULTS
File lookup using /home/gerace/Documents/ansible/configs/bigTest01_do.json as file
redirecting (type: connection) ansible.builtin.httpapi to ansible.netcommon.httpapi
Loading collection ansible.netcommon from /home/gerace/Documents/ansible/collections/ansible_collections/ansible/netcommon
<192.168.0.201> attempting to start connection
<192.168.0.201> using connection plugin ansible.netcommon.httpapi
Found ansible-connection at path /usr/local/bin/ansible-connection
<192.168.0.201> found existing local domain socket, using it!
<192.168.0.201> updating play_context for connection
<192.168.0.201> 
<192.168.0.201> local domain socket path is /home/gerace/.ansible/pc/51465be718
<192.168.0.201> Using network group action bigip for bigip_do_deploy
<192.168.0.201> ANSIBLE_NETWORK_IMPORT_MODULES: disabled
<192.168.0.201> ANSIBLE_NETWORK_IMPORT_MODULES: module execution time may be extended
<192.168.0.201> ESTABLISH LOCAL CONNECTION FOR USER: gerace
<192.168.0.201> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/gerace/.ansible/tmp/ansible-local-3639bzbyljqc `"&& mkdir "` echo /home/gerace/.ansible/tmp/ansible-local-3639bzbyljqc/ansible-tmp-1631577163.2544668-3717-65038104816318 `" && echo ansible-tmp-1631577163.2544668-3717-65038104816318="` echo /home/gerace/.ansible/tmp/ansible-local-3639bzbyljqc/ansible-tmp-1631577163.2544668-3717-65038104816318 `" ) && sleep 0'
Using module file /home/gerace/Documents/ansible/collections/ansible_collections/f5networks/f5_bigip/plugins/modules/bigip_do_deploy.py
<192.168.0.201> PUT /home/gerace/.ansible/tmp/ansible-local-3639bzbyljqc/tmpyybuze8x TO /home/gerace/.ansible/tmp/ansible-local-3639bzbyljqc/ansible-tmp-1631577163.2544668-3717-65038104816318/AnsiballZ_bigip_do_deploy.py
<192.168.0.201> EXEC /bin/sh -c 'chmod u+x /home/gerace/.ansible/tmp/ansible-local-3639bzbyljqc/ansible-tmp-1631577163.2544668-3717-65038104816318/ /home/gerace/.ansible/tmp/ansible-local-3639bzbyljqc/ansible-tmp-1631577163.2544668-3717-65038104816318/AnsiballZ_bigip_do_deploy.py && sleep 0'
<192.168.0.201> EXEC /bin/sh -c '/usr/bin/python3 /home/gerace/.ansible/tmp/ansible-local-3639bzbyljqc/ansible-tmp-1631577163.2544668-3717-65038104816318/AnsiballZ_bigip_do_deploy.py && sleep 0'
<192.168.0.201> EXEC /bin/sh -c 'rm -f -r /home/gerace/.ansible/tmp/ansible-local-3639bzbyljqc/ansible-tmp-1631577163.2544668-3717-65038104816318/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
  File "/tmp/ansible_bigip_do_deploy_payload_8hjkdptf/ansible_bigip_do_deploy_payload.zip/ansible_collections/f5networks/f5_bigip/plugins/modules/bigip_do_deploy.py", line 325, in main
  File "/tmp/ansible_bigip_do_deploy_payload_8hjkdptf/ansible_bigip_do_deploy_payload.zip/ansible_collections/f5networks/f5_bigip/plugins/modules/bigip_do_deploy.py", line 160, in __init__
  File "/tmp/ansible_bigip_do_deploy_payload_8hjkdptf/ansible_bigip_do_deploy_payload.zip/ansible_collections/f5networks/f5_bigip/plugins/module_utils/bigip_local.py", line 20, in __init__
    self.provider = self.merge_provider_params()
  File "/tmp/ansible_bigip_do_deploy_payload_8hjkdptf/ansible_bigip_do_deploy_payload.zip/ansible_collections/f5networks/f5_bigip/plugins/module_utils/local.py", line 116, in merge_provider_params
    self.merge_provider_server_param(result, provider)
  File "/tmp/ansible_bigip_do_deploy_payload_8hjkdptf/ansible_bigip_do_deploy_payload.zip/ansible_collections/f5networks/f5_bigip/plugins/module_utils/local.py", line 132, in merge_provider_server_param
    raise F5ModuleError('Server parameter cannot be None or missing, please provide a valid value')
fatal: [notahost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "content": {
                "$schema": "https://raw.githubusercontent.com/F5Networks/f5-declarative-onboarding/master/src/schema/1.10.0/base.schema.json",
                "Common": {
                    "ansible": {
                        "class": "User",
                        "partitionAccess": {
                            "all-partitions": {
                                "role": "admin"
                            }
                        },
                        "password": "@n$1bl3",
                        "shell": "none",
                        "userType": "regular"
                    },
                    "class": "Tenant",
                    "defaultRoute": {
                        "class": "Route",
                        "gw": "10.0.10.1",
                        "mtu": 0,
                        "network": "default"
                    },
                    "external": {
                        "class": "VLAN",
                        "interfaces": [
                            {
                                "name": "1.2",
                                "tagged": false
                            }
                        ],
                        "mtu": 1500,
                        "tag": 100
                    },
                    "external-self": {
                        "address": "10.0.10.126/24",
                        "allowService": "none",
                        "class": "SelfIp",
                        "trafficGroup": "traffic-group-local-only",
                        "vlan": "external"
                    },
                    "hostname": "bigTest01.f5demo.org",
                    "internal": {
                        "class": "VLAN",
                        "interfaces": [
                            {
                                "name": "1.1",
                                "tagged": false
                            }
                        ],
                        "mtu": 1500,
                        "tag": 200
                    },
                    "internal-self": {
                        "address": "10.0.20.96/24",
                        "allowService": "default",
                        "class": "SelfIp",
                        "trafficGroup": "traffic-group-local-only",
                        "vlan": "internal"
                    },
                    "k8sadmn": {
                        "class": "User",
                        "partitionAccess": {
                            "all-partitions": {
                                "role": "admin"
                            }
                        },
                        "password": "k8sadmn",
                        "shell": "none",
                        "userType": "regular"
                    },
                    "myDns": {
                        "class": "DNS",
                        "nameServers": [
                            "8.8.8.8",
                            "8.8.4.4"
                        ],
                        "search": [
                            "f5demo.org"
                        ]
                    },
                    "myLicense": {
                        "class": "License",
                        "licenseType": "regKey",
                        "regKey": "LYIXU-MUWRM-HGADE-QGBMS-QSCUJJH"
                    },
                    "myNtp": {
                        "class": "NTP",
                        "servers": [
                            "128.138.140.44"
                        ],
                        "timezone": "America/New_York"
                    },
                    "myProvisioning": {
                        "apm": "nominal",
                        "avr": "nominal",
                        "class": "Provision",
                        "ltm": "nominal"
                    },
                    "prometheus": {
                        "class": "User",
                        "partitionAccess": {
                            "all-partitions": {
                                "role": "admin"
                            }
                        },
                        "password": "pr0m3th3u$",
                        "shell": "none",
                        "userType": "regular"
                    }
                },
                "async": true,
                "class": "Device",
                "label": "BIG-IP declaration for bigTest01",
                "schemaVersion": "1.9.0"
            },
            "provider": null,
            "timeout": 150
        }
    },
    "msg": "Server parameter cannot be None or missing, please provide a valid value"
}
wojtek0806 commented 3 years ago

This looks like an issue with your environment, for some reason you are using connection: local this could be down to old version of collection installed? If you have tried with the latest release then please do the following:

Open bash session and insert this if you haven't got this already in your env:

export ANSIBLE_LOG_PATH=/tmp/ansible.log

If you have got ansible.log elswhere modify it accordingly, also good idea is to zero out the file before next step.

Next in your playbook vars put this line: persistent_log_messages: true

Run the above playbook again with -vvvvv output, send me the resulting ansible.log file, a gist made from ansible.log file would be better

Before you post anything I would suggest looking at the ansible.log and redacting any sensitive info.

ajgerace commented 3 years ago

Problem was resolved by re-installation of f5-bigip collection from the f5Networks/f5-ansible-bigip repo using the following command: ansible-galaxy collection install -f git+https://github.com/f5networks/f5-ansible-bigip.git#ansible_collections/f5networks/f5_bigip -p ./collections/