networktocode / networktocode.nautobot / 4.5.0 / module / ip_address Creates or removes IP addresses from Nautobot | "added in version" 1.0.0 of networktocode.nautobot" Authors: Mikhail Yohman (@FragmentedPacket), Anthony Ruhier (@Anthony25)networktocode.nautobot.ip_address (4.5.0) — module
Install with ansible-galaxy collection install networktocode.nautobot:==4.5.0
collections: - name: networktocode.nautobot version: 4.5.0
Creates or removes IP addresses from Nautobot
- name: "Test Nautobot IP address module" connection: local hosts: localhost gather_facts: False tasks: - name: Create IP address within Nautobot with only required information networktocode.nautobot.ip_address: url: http://nautobot.local token: thisIsMyToken address: 192.168.1.10 status: active state: present - name: Force to create (even if it already exists) the IP networktocode.nautobot.ip_address: url: http://nautobot.local token: thisIsMyToken address: 192.168.1.10 state: new - name: Get a new available IP inside 192.168.1.0/24 networktocode.nautobot.ip_address: url: http://nautobot.local token: thisIsMyToken prefix: 192.168.1.0/24 state: new - name: Delete IP address within nautobot networktocode.nautobot.ip_address: url: http://nautobot.local token: thisIsMyToken address: 192.168.1.10 state: absent - name: Create IP address with several specified options networktocode.nautobot.ip_address: url: http://nautobot.local token: thisIsMyToken address: 192.168.1.20 vrf: Test tenant: Test Tenant status: Reserved role: Loopback description: Test description tags: - Schnozzberry state: present - name: Create IP address and assign a nat_inside IP networktocode.nautobot.ip_address: url: http://nautobot.local token: thisIsMyToken address: 192.168.1.30 vrf: Test nat_inside: address: 192.168.1.20 vrf: Test assigned_object: name: GigabitEthernet1 device: test100 - name: Ensure that an IP inside 192.168.1.0/24 is attached to GigabitEthernet1 networktocode.nautobot.ip_address: url: http://nautobot.local token: thisIsMyToken prefix: 192.168.1.0/24 vrf: Test assigned_object: name: GigabitEthernet1 device: test100 state: present - name: Attach a new available IP of 192.168.1.0/24 to GigabitEthernet1 networktocode.nautobot.ip_address: url: http://nautobot.local token: thisIsMyToken prefix: 192.168.1.0/24 vrf: Test assigned_object: name: GigabitEthernet1 device: test100 state: new
url: description: - 'The URL of the Nautobot instance resolvable by the Ansible host (for example: http://nautobot.example.com:8000)' required: true type: str vrf: description: - VRF that IP address is associated with required: false type: raw version_added: 3.0.0 version_added_collection: networktocode.nautobot role: choices: - Loopback - Secondary - Anycast - VIP - VRRP - HSRP - GLBP - CARP description: - The role of the IP address required: false type: str version_added: 3.0.0 version_added_collection: networktocode.nautobot tags: description: - Any tags that this item may need to be associated with elements: raw required: false type: list version_added: 3.0.0 version_added_collection: networktocode.nautobot state: choices: - absent - new - present default: present description: - 'Use C(present), C(new) or C(absent) for adding, force adding or removing. C(present) will check if the IP is already created, and return it if true. C(new) will force to create it anyway (useful for anycasts, for example). ' type: str token: description: - The token created within Nautobot to authorize API access required: true type: str prefix: description: - 'With state C(present), if an interface is given, it will ensure that an IP inside this prefix (and vrf, if given) is attached to this interface. Otherwise, it will get the next available IP of this prefix and attach it. With state C(new), it will force to get the next available IP in this prefix. If an interface is given, it will also force to attach it. Required if state is C(present) or C(new) when no address is given. Unused if an address is specified. ' required: false type: raw version_added: 3.0.0 version_added_collection: networktocode.nautobot status: description: - The status of the IP address - Required if I(state=present) and does not exist yet required: false type: raw version_added: 3.0.0 version_added_collection: networktocode.nautobot tenant: description: - The tenant that the device will be assigned to required: false type: raw version_added: 3.0.0 version_added_collection: networktocode.nautobot address: description: - Required if state is C(present) required: false type: str version_added: 3.0.0 version_added_collection: networktocode.nautobot dns_name: description: - Hostname or FQDN required: false type: str version_added: 3.0.0 version_added_collection: networktocode.nautobot nat_inside: description: - The inside IP address this IP is assigned to required: false type: raw version_added: 3.0.0 version_added_collection: networktocode.nautobot api_version: description: - API Version Nautobot REST API required: false type: str version_added: 4.1.0 version_added_collection: networktocode.nautobot description: description: - The description of the interface required: false type: str version_added: 3.0.0 version_added_collection: networktocode.nautobot query_params: description: - This can be used to override the specified values in ALLOWED_QUERY_PARAMS that is defined - in plugins/module_utils/utils.py and provides control to users on what may make - an object unique in their environment. elements: str required: false type: list version_added: 3.0.0 version_added_collection: networktocode.nautobot custom_fields: description: - Must exist in Nautobot and in key/value format required: false type: dict version_added: 3.0.0 version_added_collection: networktocode.nautobot validate_certs: default: true description: - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. required: false type: raw assigned_object: description: - Definition of the assigned object. required: false suboptions: device: description: - The device the interface is attached to. required: false type: str name: description: - The name of the interface required: false type: str virtual_machine: description: - The virtual machine the interface is attached to. required: false type: str type: dict version_added: 3.0.0 version_added_collection: networktocode.nautobot
ip_address: description: Serialized object as created or already existent within Nautobot returned: on creation type: dict msg: description: Message indicating failure or info about what has been achieved returned: always type: str