Reply
Highlighted

Problem getting Ansible playbook to run

Chris_In_LA
Techie
Posts: 3
3028     0

I'm using the ansible module here:

https://github.com/xoanmi/ansible-module-infoblox

 

It's logging in fine but I keep getting errors when I specify a host: and an address:. I just want to add a host with a static IP and I can't figure out how to specify this, becasue it says address: and network: are mutually exclusive. What am I not getting? Does anyone have an example? The example.yml doesn't work for me because I guess I haven't defined a DHCP range. I just want to add a static A and PTR record.

Re: Problem getting Ansible playbook to run

[ Edited ]
Moderator BRampling
Moderator
Posts: 69
3029     0

This playbook below works for me. Address and network are mutually exclusive, you can either specify a specific address in the address parameter or a network in the network parameter (or a range using start_addr and end_addr) in which case it will call nextavailableip for the network or range.

 

---
- name: create
  hosts: localhost 
  gather_facts: no
  remote_user: brampling
  become: true
  become_user: root
  tasks:
   - name: add_host
     infoblox:
       server: 10.60.27.4
       username: admin
       password: infoblox
       api_version: 2.6 
       action: add_host
       host: ansibletest1.test.com
       dns_view: default
       address: 1.1.1.5
     register: result
... 

Result:

brampling@ansible:~/src/ansible$ ansible-playbook test-addhost.yml 

PLAY [create] ******************************************************************

TASK [add_host] ****************************************************************
changed: [localhost]

PLAY RECAP *********************************************************************
localhost                  : ok=1    changed=1    unreachable=0    failed=0 

Let me know if it works for you. If we need to clarify the documentation I can have a look at it.

Re: Problem getting Ansible playbook to run

[ Edited ]
Chris_In_LA
Techie
Posts: 3
3029     0

Thanks for your reponse. I tried your example but I'm still getting this error:

 

TASK [add_host] *************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: Exception: No network or range start/end address specified
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible_YoBeWd/ansible_module_infoblox.py\", line 1394, in <module>\n main()\n File \"/tmp/ansible_YoBeWd/ansible_module_infoblox.py\", line 1298, in main\n raise Exception(\"No network or range start/end address specified\")\nException: No network or range start/end address specified\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 0}
to retry, use: --limit @/home/ctaylor/infoblox-test/example.retry

PLAY RECAP ******************************************************************************************************************
localhost : ok=0 changed=0 unreachable=0 failed=1

 

Here is my playbook:

 

---
- name: create
hosts: localhost
gather_facts: no
tasks:
- name: add_host
infoblox:
server: 10.1.1.10
username: ansible
password: XXXXXXX
api_version: 1.6
action: add_host
host: test01.activision.com
dns_view: default
address: 10.213.10.33
register: result

- name: Do stuff with the result
debug: msg="debug output here"
...

 

What could I be doing wrong?

 

Re: Problem getting Ansible playbook to run

Moderator BRampling
Moderator
Posts: 69
3029     0

That's a bug (that I introduced). I'll fix it and try to push it up to github this afternoon. I'll post a link when it's done.

Re: Problem getting Ansible playbook to run

Chris_In_LA
Techie
Posts: 3
3029     0

Hi BRampling! Did you ever get a chance to look at that bug? Thanks

Re: Problem getting Ansible playbook to run

Moderator BRampling
Moderator
Posts: 69
3029     0

Pull request #30 was just merged in to the master branch, I believe it fixes this issue. I tested the commit and it is working for me. If you clone/pull the repo it should work now.

Re: Problem getting Ansible playbook to run

Chris_In_LA
Techie
Posts: 3
3029     0

It works! Thanks a lot! So, I should add another play to create the PTR record in the in-addr.arpa domain?

Showing results for 
Search instead for 
Do you mean 

Recommended for You