Open jnc-cnj opened 7 years ago
@jnc-cnj can you elaborate on what you changed in the infoblox.py ?
@davisionz sure. I add a new variable
_IPV4_ADDRESS = "ipv4addrs" <<<<<<<<<<<<
_IPV4_ADDRESS_PROPERTY = "ipv4addr"
added it to the list
self.model_list = [_COMMENT_PROPERTY, _TTL_PROPERTY, _USE_TTL_PROPERTY, _NAME_PROPERTY,
_VIEW_PROPERTY, _IPV4_ADDRESS, _IPV4_ADDRESS_PROPERTY, _IPV6_ADDRESS_PROPERTY,
_ID_PROPERTY, _PTRDNAME_PROPERTY, _EXT_ATTR_PROPERTY, _TXT_PROPERTY,
_PORT_PROPERTY, _PRIORITY_PROPERTY, _WEIGHT_PROPERTY, _TARGET_PROPERTY,
_MAC_PROPERTY, _CANONICAL_PROPERTY, _FQDN_PROPERTY, _FORWARD_TO_PROPERTY,
_NETWORK_PROPERTY, _NETWORK_VIEW_PROPERTY, _DELEGATE_TO_PROPERTY]
Then change the following in 'create_host_record` to:
model = {_NAME_PROPERTY: host, _IPV4_ADDRESS: [{_IPV4_ADDRESS_PROPERTY: address}],
_VIEW_PROPERTY: self.dns_view,
_COMMENT_PROPERTY: comment, _EXT_ATTR_PROPERTY: extattrs}
HTH.
many thanks!
Hi guys!
Could you open a Pull Request with the needed changes to solve the problem?
Thanks!
@xoanmi Hi, I wish I could help but unfortunately I don't know how. Just start learning coding. And please take a look of other functions as well. They might have the same issue.
I am still getting this error with this playbook
tasks:
- name: add host
infoblox:
server: xxxx
username: xxxx
password:xxxx
action: add_host
api_version: 2.1
host: "sn1-rsw-a02-40"
dns_view: INTERNAL
address: 172.16.0.150
register: result
With the newest code. Anyone have any ideas how to resovle this?
this is the current error i am getting:
The full traceback is:
Traceback (most recent call last):
File "/tmp/ansible_EcuoTp/ansible_module_infoblox.py", line 2206, in <module>
main()
File "/tmp/ansible_EcuoTp/ansible_module_infoblox.py", line 1920, in main
host, address, None, comment, ttl, extattrs)
File "/tmp/ansible_EcuoTp/ansible_module_infoblox.py", line 1069, in create_host_record
return self.invoke("post", "record:host", ok_codes=(200, 201, 400), json=model)
File "/tmp/ansible_EcuoTp/ansible_module_infoblox.py", line 230, in invoke
raise Exception(payload["text"])
Exception: The action is not allowed. A parent was not found.
fatal: [localhost]: FAILED! => {
"changed": false,
"failed": true,
"module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible_EcuoTp/ansible_module_infoblox.py\", line 2206, in <module>\n main()\n File \"/tmp/ansible_EcuoTp/ansible_module_infoblox.py\", line 1920, in main\n host, address, None, comment, ttl, extattrs)\n File \"/tmp/ansible_EcuoTp/ansible_module_infoblox.py\", line 1069, in create_host_record\n return self.invoke(\"post\", \"record:host\", ok_codes=(200, 201, 400), json=model)\n File \"/tmp/ansible_EcuoTp/ansible_module_infoblox.py\", line 230, in invoke\n raise Exception(payload[\"text\"])\nException: The action is not allowed. A parent was not found.\n",
"module_stdout": "",
"msg": "MODULE FAILURE",
"rc": 0
}```
figured it out. The OPs code changed did in fact do the trick the rest were mental errors on my part
Hi, I am testing Ansible module and I am able to get host. However, when adding a host, it failed. Here's what I have:
Playbook:
error:
debug output:
I think what happened is: This is the infoblox API:
This is the code in infoblox.py module.
Seems the model wasn't built correctly. It builds a record like this: "ipv4addr": [{"ipv4adr": "x.x.x.x"}].
I modified the infoblox.py file and it's working for me now. However, I think this might affect other functions as well. Since I have very limited knowledge of coding, I am open this issue to let professional to take a look and fix it.