Documentation

    PLEASE NOTE: This document applies to latest version and not to the latest stable release v2.21

    Documentation for other releases can be found by using the version selector in the top right of any doc page.

    netbox_ipam

    Manage IP addresses and prefixes in NetBox IPAM/DCIM system.

    Attributes

    check_mode:
      support: full
    

    Parameters

    Parameter Required Type Values Description
    url true string   NetBox instance URL.
    token true string   NetBox API token.
    type   string ip_address
    prefix
    vlan
    vrf
    Type of NetBox IPAM object to manage. [default: "ip_address"]
    address   string   IP address or prefix CIDR (required for ip_address and prefix types).
    state   string present
    absent
    query
    Desired state of the resource. [default: "present"]
    description   string   Description for the resource.
    tenant   string   Tenant name to assign.
    vlan_id   integer   VLAN ID (required for vlan type).
    vlan_name   string   VLAN name (for vlan type).
    vrf_name   string   VRF name (required for vrf type).
    rd   string   Route distinguisher for VRF (e.g. “65000:100”).
    timeout   integer   Timeout in seconds for API requests.
    validate_certs   boolean   If false, SSL certificates will not be validated.

    Examples

    - name: Create an IP address in NetBox
      netbox_ipam:
        url: "http://netbox:8000"
        token: "{{ netbox_token }}"
        type: ip_address
        address: "192.168.1.100/24"
        state: present
        description: "Web server"
    
    - name: Create a prefix
      netbox_ipam:
        url: "http://netbox:8000"
        token: "{{ netbox_token }}"
        type: prefix
        address: "192.168.1.0/24"
        state: present
        description: "Office network"
    
    - name: Query an IP address
      netbox_ipam:
        url: "http://netbox:8000"
        token: "{{ netbox_token }}"
        type: ip_address
        address: "192.168.1.100/24"
        state: query
      register: ip_info
    
    - name: Create a VLAN
      netbox_ipam:
        url: "http://netbox:8000"
        token: "{{ netbox_token }}"
        type: vlan
        vlan_id: 100
        vlan_name: "office-vlan"
        state: present
    
    - name: Create a VRF
      netbox_ipam:
        url: "http://netbox:8000"
        token: "{{ netbox_token }}"
        type: vrf
        vrf_name: "customer-a"
        state: present
    
    - name: Delete an IP address
      netbox_ipam:
        url: "http://netbox:8000"
        token: "{{ netbox_token }}"
        type: ip_address
        address: "192.168.1.100/24"
        state: absent
    
    - name: Create IP with tenant
      netbox_ipam:
        url: "http://netbox:8000"
        token: "{{ netbox_token }}"
        type: ip_address
        address: "10.0.0.1/24"
        state: present
        tenant: "engineering"