ansible / ansible.builtin / v2.9.27 / module / netbox_device Create, update or delete devices within Netbox | "added in version" 2.8 of ansible.builtin" Authors: Mikhail Yohman (@FragmentedPacket), David Gomez (@amb1s1) preview | supported by communityansible.builtin.netbox_device (v2.9.27) — module
pip
Install with pip install ansible==2.9.27
Creates, updates or removes devices from Netbox
- name: "Test Netbox modules" connection: local hosts: localhost gather_facts: False tasks: - name: Create device within Netbox with only required information netbox_device: netbox_url: http://netbox.local netbox_token: thisIsMyToken data: name: Test Device device_type: C9410R device_role: Core Switch site: Main state: present - name: Delete device within netbox netbox_device: netbox_url: http://netbox.local netbox_token: thisIsMyToken data: name: Test Device state: absent - name: Create device with tags netbox_device: netbox_url: http://netbox.local netbox_token: thisIsMyToken data: name: Another Test Device device_type: C9410R device_role: Core Switch site: Main tags: - Schnozzberry state: present - name: Update the rack and position of an existing device netbox_device: netbox_url: http://netbox.local netbox_token: thisIsMyToken data: name: Test Device rack: Test Rack position: 10 face: Front state: present
data: description: - Defines the device configuration required: true suboptions: asset_tag: description: - Asset tag that is associated to the device cluster: description: - Cluster that the device will be assigned to comments: description: - Comments that may include additional information in regards to the device custom_fields: description: - must exist in Netbox device_role: description: - Required if I(state=present) and the device does not exist yet device_type: description: - Required if I(state=present) and the device does not exist yet face: description: - Required if I(rack) is defined name: description: - The name of the device required: true platform: description: - The platform of the device position: description: - The position of the device in the rack defined above rack: description: - The name of the rack to assign the device to serial: description: - Serial number of the device site: description: - Required if I(state=present) and the device does not exist yet status: choices: - Active - Offline - Planned - Staged - Failed - Inventory description: - The status of the device tags: description: - Any tags that the device may need to be associated with tenant: description: - The tenant that the device will be assigned to state: choices: - absent - present default: present description: - Use C(present) or C(absent) for adding or removing. netbox_url: description: - URL of the Netbox instance resolvable by Ansible control host required: true netbox_token: description: - The token created within Netbox to authorize API access required: true validate_certs: default: 'yes' description: - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. type: bool
device: description: Serialized object as created or already existent within Netbox returned: success (when I(state=present)) type: dict msg: description: Message indicating failure or info about what has been achieved returned: always type: str