Netbox Ip address Ansible Module Question

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