一键导入
netbox-netbox-netbox-device-type
Create, update or delete device types within NetBox Use when managing netbox device type resources via API with Ansible.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Create, update or delete device types within NetBox Use when managing netbox device type resources via API with Ansible.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
create, update, or destroy Automation Platform Controller credential. Use when managing credential resources on remote hosts via Ansible.
Create, update, or destroy custom Automation Platform Controller credential type. Use when managing credential type resources on remote hosts via Ansible.
create, update, or destroy Execution Environments in Automation Platform Controller. Use when managing execution environment resources on remote hosts via Ansible.
create, update, or destroy Automation Platform Controller group. Use when managing group resources on remote hosts via Ansible.
create, update, or destroy Automation Platform Controller host. Use when managing host resources on remote hosts via Ansible.
create, update, or destroy Automation Platform Controller inventory. Use when managing inventory resources on remote hosts via Ansible.
| name | netbox.netbox.netbox_device_type |
| description | Create, update or delete device types within NetBox Use when managing netbox device type resources via API with Ansible. |
Create, update or delete device types within NetBox
Use the netbox.netbox.netbox_device_type Ansible module when you need to manage netbox device type resources via API. This module runs on the control host (not over SSH) and communicates with an external API.
connection: local -- no SSH to remote hostsbecome/sudo--check| Name | Type | Required | Default | Description |
|---|---|---|---|---|
data | dict | yes | - | Defines the device type configuration |
netbox_token | str | yes | - | The NetBox API token. |
netbox_url | str | yes | - | The URL of the NetBox instance. Must be accessible by the Ansible control host. |
cert | raw | no | - | Certificate path |
headers | dict | no | - | Dictionary of headers to be passed to the NetBox API. |
query_params | list | no | - | This can be used to override the specified values in ALLOWED_QUERY_PARAMS that are defined in plugins/module_utils/netbox_utils.py and provides control to users on what may make an object unique in their environment. |
state | str | no | present | The state of the object. |
validate_certs | raw | no | True | If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using a self-signed certificates. |
Run this module using the ansible CLI (from ansible-core):
ansible localhost -m netbox.netbox.netbox_device_type -a "<key=value arguments>" -c local --check --diff
# Dry-run first (always recommended for destructive operations)
ansible localhost -m netbox.netbox.netbox_device_type -a "data=<data> netbox_token=thisIsMyToken netbox_url=http://netbox.local" -c local --check --diff
# Apply the change
ansible localhost -m netbox.netbox.netbox_device_type -a "data=<data> netbox_token=thisIsMyToken netbox_url=http://netbox.local" -c local --diff
- name: "Test NetBox modules"
connection: local
hosts: localhost
gather_facts: false
tasks:
- name: Create device type within NetBox with only required information
netbox.netbox.netbox_device_type:
netbox_url: http://netbox.local
netbox_token: thisIsMyToken
data:
slug: test-device-type
model: ws-test-3750
manufacturer: Test Manufacturer
state: present
- name: Create device type within NetBox with more information
netbox.netbox.netbox_device_type:
netbox_url: http://netbox.local
netbox_token: thisIsMyToken
data:
slug: test-device-type
model: ws-test-3750
manufacturer: Test Manufacturer
part_number: ws-3750g-v2
u_height: 1.5
is_full_depth: false
subdevice_role: parent
state: present
- name: Delete device type within netbox
netbox.netbox.netbox_device_type:
netbox_url: http://netbox.local
netbox_token: thisIsMyToken
data:
slug: test-device-type
state: absent
| Flag | Purpose |
|---|---|
--check | Dry-run mode -- shows what would change without applying |
--diff | Shows detailed before/after differences |
-i <path> | Specify inventory file (see Inventory section below) |
-l <pattern> | Limit to specific hosts within a group |
-c local | Use local connection (no SSH) |
To get structured JSON output for programmatic parsing:
ANSIBLE_STDOUT_CALLBACK=json ansible localhost -m netbox.netbox.netbox_device_type -a "<args>" -c local
Or set stdout_callback = json in your ansible.cfg.
--check --diff before applying destructive changesWhen using this module from a different location than the project root:
-i /path/to/inventory.ymlexport ANSIBLE_INVENTORY=/path/to/inventory.yml/etc/ansible/hostsansible <hostname>, -m netbox.netbox.netbox_device_type -a "..." (note the trailing comma)