Tag creating using netbox module netbox.netbox.netbox_tag #8250

Closed
opened 2025-12-29 20:34:20 +01:00 by adam · 2 comments
Owner

Originally created by @gesandovalr on GitHub (Jun 27, 2023).

NetBox version

3.5.5

Python version

3.9

Steps to Reproduce

awx 22.3.0
custom-awx-ee module: netbox.netbox added

I will followed the exampled based on the docs I don't if I'm making a mistake i've tried on multiple ways.

Example # 1

  • name: "Test tags creation/deletion"
    connection: local
    hosts: localhost
    gather_facts: False
    tasks:
    • name: Create tags
      netbox.netbox.netbox_tag:
      netbox_url: http://x.x.x.x
      netbox_token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
      data:
      name: "{{ item.name }}"
      description: "{{ item.description }}"
      loop:
      • { name: mgmt, description: "management" }
      • { name: tun, description: "tunnel" }

Example # 2

  • name: Create tags
    netbox.netbox.netbox_tag:
    netbox_url: http://x.x.x.x
    netbox_token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    data:
    name: "{{ item.name }}"
    description: "{{ item.description }}"
    state: present
    validate_certs: "false"
    loop:
    • name: mgmt
      description: management

Expected Behavior

Tags should be created.

Observed Behavior

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'bool' object has no attribute 'strip'
fatal: [myserver.local]: FAILED! => {"msg": "Unexpected failure during module execution: 'bool' object has no attribute 'strip'", "stdout": ""}

Originally created by @gesandovalr on GitHub (Jun 27, 2023). ### NetBox version 3.5.5 ### Python version 3.9 ### Steps to Reproduce awx 22.3.0 custom-awx-ee module: netbox.netbox added I will followed the exampled based on the docs I don't if I'm making a mistake i've tried on multiple ways. **Example # 1** - name: "Test tags creation/deletion" connection: local hosts: localhost gather_facts: False tasks: - name: Create tags netbox.netbox.netbox_tag: netbox_url: http://x.x.x.x netbox_token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx data: name: "{{ item.name }}" description: "{{ item.description }}" loop: - { name: mgmt, description: "management" } - { name: tun, description: "tunnel" } **Example # 2** - name: Create tags netbox.netbox.netbox_tag: netbox_url: http://x.x.x.x netbox_token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx data: name: "{{ item.name }}" description: "{{ item.description }}" state: present validate_certs: "false" loop: - name: mgmt description: management ### Expected Behavior Tags should be created. ### Observed Behavior An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'bool' object has no attribute 'strip' fatal: [myserver.local]: FAILED! => {"msg": "Unexpected failure during module execution: 'bool' object has no attribute 'strip'", "stdout": ""}
adam closed this issue 2025-12-29 20:34:20 +01:00
Author
Owner

@pobradovic08 commented on GitHub (Jun 27, 2023):

This should probably be opened in ansible_modules instead.
Also, you should include more debug information and correctly format the yaml in description. Its hard to know how the file is actually formatted.

@pobradovic08 commented on GitHub (Jun 27, 2023): This should probably be opened in [ansible_modules](https://github.com/netbox-community/ansible_modules) instead. Also, you should include more debug information and correctly format the yaml in description. Its hard to know how the file is actually formatted.
Author
Owner

@gesandovalr commented on GitHub (Jun 27, 2023):

This was related on the custom environment on AWX I thought Pynetbox was only required on the host, started working after adding it on requirements.txt thanks I'm sorry for make anyone lose time on this.

I'm closing the issue.

pyvmomi
jmespath
zabbix-api
psycopg2-binary
cryptography
openshift>=0.6.2
requests-oauthlib
docker
urllib3
pywinrm
pynetbox

The full traceback is:
Traceback (most recent call last):
File "/tmp/ansible_netbox.netbox.netbox_tag_payload_i_m2byil/ansible_netbox.netbox.netbox_tag_payload.zip/ansible_collections/netbox/netbox/plugins/module_utils/netbox_utils.py", line 25, in
import pynetbox
ModuleNotFoundError: No module named 'pynetbox'
failed: [myserver.local] (item={'name': 'mgmt', 'description': 'test'}) => {
"ansible_loop_var": "item",
"changed": false,
"invocation": {
"module_args": {
"cert": null,
"data": {
"color": null,
"description": "test",
"name": "mgmt",
"slug": null
},
"netbox_token": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"netbox_ur…

@gesandovalr commented on GitHub (Jun 27, 2023): This was related on the custom environment on AWX I thought Pynetbox was only required on the host, started working after adding it on requirements.txt thanks I'm sorry for make anyone lose time on this. I'm closing the issue. pyvmomi jmespath zabbix-api psycopg2-binary cryptography openshift>=0.6.2 requests-oauthlib docker urllib3 pywinrm **pynetbox** The full traceback is: Traceback (most recent call last): File "/tmp/ansible_netbox.netbox.netbox_tag_payload_i_m2byil/ansible_netbox.netbox.netbox_tag_payload.zip/ansible_collections/netbox/netbox/plugins/module_utils/netbox_utils.py", line 25, in <module> import pynetbox **ModuleNotFoundError: No module named 'pynetbox'** failed: [myserver.local] (item={'name': 'mgmt', 'description': 'test'}) => { "ansible_loop_var": "item", "changed": false, "invocation": { "module_args": { "cert": null, "data": { "color": null, "description": "test", "name": "mgmt", "slug": null }, "netbox_token": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "netbox_ur…
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8250