# Netbox Ip address Ansible Module Question

**URL:** <https://forum.ansible.com/t/netbox-ip-address-ansible-module-question/31012>\
**Category:** Ansible Project\
**Created:** [August 9, 2019, 6:29pm UTC](https://forum.ansible.com/t/netbox-ip-address-ansible-module-question/31012 "2019-08-09T18:29:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhilash\_Reddy\_Ch](https://avatars.discourse-cdn.com/v4/letter/a/4bbf92/32.png) [@Abhilash\_Reddy\_Ch](https://forum.ansible.com/u/Abhilash_Reddy_Ch)\
**Post date:** [August 9, 2019, 6:29pm UTC](https://forum.ansible.com/t/netbox-ip-address-ansible-module-question/31012/1 "2019-08-09T18:29:10Z")

</div>

Hello

I am trying to create Netbox Devices using Ansible Netbox Modules .  
I am running into an issue making an IP address Primary for the Device created by assigning facter facts.

Here is the code

To create an IP

- name: Create IP address within Netbox with Primary IP  
netbox\_ip\_address:  
data:

family: 4  
address: “{{ hostvars[item][‘facter\_ipaddress’] }}”  
interface:  
name: Interface  
device: “{{item}}”  
state: present  
with\_items: “{{groups.list}}”

To Update Primary IP

- name: Update Fields  
netbox\_device:  
netbox\_url:  
netbox\_token:  
data:  
name: “{{item}}”  
primary\_ip4: “{{ hostvars[item][‘facter\_ipaddress’] }}”

state: present  
with\_items: “{{groups.list}}”

It was working for some devices and failed for some but I am not able to get it working good for all the devices.

Could someone help here if they encountered the same issue ?

Thanks
