Giter Club home page Giter Club logo

nautobot-ansible's Introduction

Code style: black

Nautobot modules for Ansible using Ansible Collections

To keep the code simple, we only officially support the two latest releases of Nautobot and don't guarantee backwards compatibility beyond that.

Requirements

  • Nautobot 1.0.0+ or the two latest Nautobot releases
  • Python 3.6+
  • Python modules: pynautobot 1.0.0+
  • Ansible 2.9+
  • Nautobot write-enabled token when using modules or read-only token for lookup/inventory

We have a new docs site live that can be found here.

This is a fork of the netbox.netbox Ansible Galaxy collection found at https://github.com/netbox-community/ansible_modules in February, 2021

Releasing, Versioning, and Deprecation

This collection follows Semantic Versioning. More details on versioning can be found in the Ansible docs.

We plan to regularly release new minor or bugfix versions once new features or bugfixes have been implemented.

Releasing the current major version happens from the develop branch with a release.

If backwards incompatible changes are able, we plan to deprecate the old behavior as early as possible. We also plan to backport at least bugfixes for the old major version for some time after releasing a new major version. We will not block community members from backporting other bugfixes and features from the latest stable version to older release branches, under the condition that these backports are of reasonable quality. Some changes may not be able to be back ported.

Some changes that would require immediate patching that are breaking changes will fall to SemVer and constitute a breaking change. These will only be done when necessary, such as to support working with the most recent 3 versions of Ansible. Backporting these changes may not be possible.

nautobot-ansible's People

Contributors

armartirosyan avatar aslafy-z avatar cdot65 avatar chadell avatar dependabot[bot] avatar douglasheriot avatar fragmentedpacket avatar gneville-ot avatar gskjelstad avatar itdependsnetworks avatar jifox avatar joewesch avatar jvanderaa avatar lungj avatar mspiez avatar nahun avatar nrnvgh avatar pkorovin avatar pszulczewski avatar pugnacity avatar qduk avatar richard-olson avatar sc68cal avatar syyna avatar teunvink avatar thomasadavis avatar timizuoebideri1 avatar toerb avatar ubajze avatar vkirovskiy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nautobot-ansible's Issues

Use Ansible Inventory Compose option for custom_fields on child objects, e.g. platforms

ISSUE TYPE
  • Feature Idea
SOFTWARE VERSIONS
Ansible:

2.9.3

Nautobot:

1.0.2

Collection:

1.0.4

SUMMARY

We want to be able to compose variables from custom fields on child objects such as platform.

This was discovered by @lvrfrc87

STEPS TO REPRODUCE
plugin: "networktocode.nautobot.inventory"
url: "https://nautobot.dev.net-tools.only.sap/"
token: "token"
validate_certs: false
config_context: true
group_by:
  - tenants
  - platforms
  - device_roles
compose:
  ansible_network_os: platforms.cf_ansible_network_os
#  serial_nr: serial
device_query_filters:
  - has_primary_ip: true
interfaces: false
EXPECTED RESULTS

Inventory will have the ansible_network_os from the custom field on platforms

ACTUAL RESULTS

No ansible_network_os is composed.

Feature Request: Add Labels to Interfaces

ISSUE TYPE
  • Feature Idea
SOFTWARE VERSIONS
pynautobot
1.0.2
Ansible:

2.10.x & 2.11.x

Nautobot:

1.0.1

Collection:

2.0.0

SUMMARY

Module documentation does not show any support for labels on interfaces. Since labels are available, would look at adding to the module.

STEPS TO REPRODUCE

Reference the interface module (networktocode.nautobot.device_interface)
Label should be one of the items to co-exist with the UI and API.

EXPECTED RESULTS
ACTUAL RESULTS

No label present


Deprecation of Code

ISSUE TYPE
  • Feature Idea
SOFTWARE VERSIONS
pynautobot 1.0
Ansible: 1.0
Nautobot: 1.0
Collection: 2.10
SUMMARY

I am advocating for removal of code that is no longer needed. Specifically removing mulltiple environment variables doing the same thing and creating a requests session, which I believe should be handled by pynautobot.

STEPS TO REPRODUCE

View Code here, to see examples:

or os.getenv("NAUTOBOT_TOKEN")

session = requests.Session()

EXPECTED RESULTS

N/A

ACTUAL RESULTS

N/A

BUG (Documentation): networktocode.nautobot.site requires status parameter for present state

ISSUE TYPE
  • Bug Report
SOFTWARE VERSIONS
pynautobot

1.0.3

Ansible:

2.10.13

Nautobot:
Collection:

3.0.0

SUMMARY

The documentation does not specify that status is required for present state.

STEPS TO REPRODUCE

Run the networktocode.nautobot.site module with present state, but omit the status parameter.

EXPECTED RESULTS

Site to be created

ACTUAL RESULTS
msg: 'state is present but all of the following are missing: status'

Create Nautobot Install Role

ISSUE TYPE
  • Feature Idea
SOFTWARE VERSIONS
pynautobot

N/A

Ansible:

2.11.1

Nautobot:

Current

Collection:

networktocode.nautobot

SUMMARY

Would like to have a role to install Nautobot onto a host via PIP

Update Modules For Verification Changes

ISSUE TYPE
  • Bug Report
SOFTWARE VERSIONS
pynautobot
1.0.2
Ansible:
4.0.0 / 2.11
Nautobot:

1.x

Collection:

nautobot

SUMMARY

There were changes to Ansible Core that changed the verification process. Now the required portions of the modules are broken with ansible-core / ansible 4.x

Inventory with virtual_chassis_name doesn't work

ISSUE TYPE
  • Bug Report
SOFTWARE VERSIONS
pynautobot

pynautobot==1.1.2

Ansible:

root@3be97d18304b:~/ansible_project# ansible --version
ansible [core 2.12.6]
config file = /root/ansible_project/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.10/site-packages/ansible
ansible collection location = /root/ansible_project/collections
executable location = /usr/local/bin/ansible
python version = 3.10.5 (main, Jun 7 2022, 19:11:36) [GCC 8.3.0]
jinja version = 3.1.2
libyaml = True

Nautobot:

v1.3.2

Collection:

Collection Version


amazon.aws 2.3.0
ansible.netcommon 2.6.1
ansible.posix 1.4.0
ansible.utils 2.6.1
ansible.windows 1.10.0
arista.eos 3.1.0
awx.awx 19.4.0
azure.azcollection 1.13.0
check_point.mgmt 2.3.0
chocolatey.chocolatey 1.2.0
cisco.aci 2.2.0
cisco.asa 2.1.0
cisco.dnac 6.4.0
cisco.intersight 1.0.19
cisco.ios 2.8.1
cisco.iosxr 2.9.0
cisco.ise 1.2.1
cisco.meraki 2.6.2
cisco.mso 1.4.0
cisco.nso 1.0.3
cisco.nxos 2.9.1
cisco.ucs 1.8.0
cloud.common 2.1.1
cloudscale_ch.cloud 2.2.2
community.aws 2.5.0
community.azure 1.1.0
community.ciscosmb 1.0.5
community.crypto 2.3.2
community.digitalocean 1.19.0
community.dns 2.2.0
community.docker 2.6.0
community.fortios 1.0.0
community.general 4.8.2
community.google 1.0.0
community.grafana 1.4.0
community.hashi_vault 2.5.0
community.hrobot 1.4.0
community.kubernetes 2.0.1
community.kubevirt 1.0.0
community.libvirt 1.1.0
community.mongodb 1.4.0
community.mysql 2.3.8
community.network 3.3.0
community.okd 2.2.0
community.postgresql 1.7.4
community.proxysql 1.4.0
community.rabbitmq 1.2.1
community.routeros 2.1.0
community.sap 1.0.0
community.sap_libs 1.1.0
community.skydive 1.0.0
community.sops 1.2.2
community.vmware 1.18.0
community.windows 1.10.0
community.zabbix 1.7.0
containers.podman 1.9.3
cyberark.conjur 1.1.0
cyberark.pas 1.0.14
dellemc.enterprise_sonic 1.1.1
dellemc.openmanage 4.4.0
dellemc.os10 1.1.1
dellemc.os6 1.0.7
dellemc.os9 1.0.4
f5networks.f5_modules 1.17.0
fortinet.fortimanager 2.1.5
fortinet.fortios 2.1.6
frr.frr 1.0.4
gluster.gluster 1.0.2
google.cloud 1.0.2
hetzner.hcloud 1.6.0
hpe.nimble 1.1.4
ibm.qradar 1.0.3
infinidat.infinibox 1.3.3
infoblox.nios_modules 1.2.2
inspur.sm 1.3.0
junipernetworks.junos 2.10.0
kubernetes.core 2.3.1
mellanox.onyx 1.0.0
netapp.aws 21.7.0
netapp.azure 21.10.0
netapp.cloudmanager 21.17.0
netapp.elementsw 21.7.0
netapp.ontap 21.19.1
netapp.storagegrid 21.10.0
netapp.um_info 21.8.0
netapp_eseries.santricity 1.3.0
netbox.netbox 3.7.1
ngine_io.cloudstack 2.2.4
ngine_io.exoscale 1.0.0
ngine_io.vultr 1.1.1
openstack.cloud 1.8.0
openvswitch.openvswitch 2.1.0
ovirt.ovirt 1.6.6
purestorage.flasharray 1.13.0
purestorage.flashblade 1.9.0
sensu.sensu_go 1.13.1
servicenow.servicenow 1.0.6
splunk.es 1.0.2
t_systems_mms.icinga_director 1.29.0
theforeman.foreman 2.2.0
vmware.vmware_rest 2.1.5
vyos.vyos 2.8.0
wti.remote 1.0.3
ansible.netcommon 3.0.1
ansible.utils 2.6.1
arista.cvp 3.3.1
cisco.ios 3.1.0
cisco.nxos 3.0.0
community.general 5.1.0
community.network 4.0.1
networktocode.nautobot 3.4.1

SUMMARY

I need to create an inventory ignoring the virtual chassis name. I setted virtual_chassis_name option to false but the output is identical. I resolved the problem but i would to ask if my solution is correct and if it's possible merging the solution in next release. I haven't experience about github merge procedure.

STEPS TO REPRODUCE

Configure two device in virtual chassis.
Configure inventory file with virtual_chassis_name to false.
Run ansible-inventory --graph or similar.

" inventory.yaml

plugin: networktocode.nautobot.inventory
validate_certs: False
virtual_chassis_name: no
services: no
fetch_all: false
cache: yes
cache_timeout: 3600
compose:
  area: (display | split('-'))[1]
group_by:
  - device_roles
  - platforms
  - sites
  - tags
query_filters:
  - role: network
EXPECTED RESULTS

I expected list with specific members.

ACTUAL RESULTS

The inventory contains always the virtual chassis primary device.

I resolved the problem changing the main function in plugins/inventory/inventory.py

from

       for host in chain(self.devices_list, self.vms_list):

            virtual_chassis_master = self._get_host_virtual_chassis_master(host)
            if virtual_chassis_master is not None and virtual_chassis_master != host["id"]:
                # Device is part of a virtual chassis, but is not the master
                continue

to

       for host in chain(self.devices_list, self.vms_list):

            virtual_chassis_master = self._get_host_virtual_chassis_master(host)
            if self.virtual_chassis_name and virtual_chassis_master is not None and virtual_chassis_master != host["id"]:
                # Device is part of a virtual chassis, but is not the master
                continue

Adding 'virtual_chassis' will overwrite entries with different names

ISSUE TYPE
  • Bug Report
SOFTWARE VERSIONS
pynautobot

1.0.1

Ansible:

ansible 2.9.18
config file = /home/ansible/devel/develop/ansible.cfg
configured module search path = ['/usr/local/lib/python3.6/site-packages/napalm_ansible', '/usr/local/lib/python3.6/site-packages/napalm', '/usr/local/lib/python3.6/site-packages/ntc-ansible', '/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/ansible/devel/develop/nornir/lib/python3.7/site-packages/ansible
executable location = /home/ansible/devel/develop/nornir/bin/ansible
python version = 3.7.4 (default, Aug 19 2019, 12:50:17) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]

Nautobot:

42b98514cea3 (v1.0.0b2)

Collection:

1.0.4

SUMMARY

When consecutivly adding virtual_chassis records the first entry will be always overwritten.

In example below only virtual_cassis 'vc_three' is stored in database.

STEPS TO REPRODUCE
    - set_fact:
         nbchassisdb: 
            - "vc_one"
            - "vc_two"
           - " vc_three"

    - name: Add Vitrual Chassis
      networktocode.nautobot.virtual_chassis:
        url: "{{ nburl }}"
        token: "{{ nbtoken }}"
        validate_certs: no
        state: present
        data:
          name: "{{ item }}"
      loop: "{{ nbchassisdb }}"
EXPECTED RESULTS

All different virtual_chassisshould have been added.

As a workaround following task adds all different virtual_chasssis records

    - name: Add Vitrual Chassis
      networktocode.nautobot.virtual_chassis:
        url: "{{ nburl }}"
        token: "{{ nbtoken }}"
        validate_certs: no
        state: present
        data:
          name: "{{ item }}"
        query_params: "name"        # <-------
      loop: "{{ nbchassisdb | flatten }}"
ACTUAL RESULTS
virtual_chassis vc_one created
virtual_chassis vc_two updated
virtual_chassis vc_three updated

Add support for managing relationship associations to collection

ISSUE TYPE
  • Feature Idea
SUMMARY

Add the ability for managing relationship associations that are are based on the /api/extras/relationship-associations/ endpoint.

STEPS TO REPRODUCE
  1. Create the relationship type in nautobot (outside of scope of the FR)
  2. Ansible module that allows for creating realationship associates based on the above relationship.
- name: "ASSIGN RELATION"
   networktocode.nautobot.relationship_association:
     url: http://nautobot.local
     token: thisIsMyToken
     relationship: 3fa85f64-5717-4562-b3fc-2c963f66afa6
     source_type: dcim.device
     source_id: 3fa85f64-5717-4562-b3fc-2c963f66afa6
     destination_type: ipam.vrf
     destination_id: 3fa85f64-5717-4562-b3fc-2c963f66afa
     state: present
EXPECTED RESULTS

Idempotently creates the relationship association

ACTUAL RESULTS

Add check for UUID4 and skip finding if UUID4 exists

ISSUE TYPE
  • Feature Idea
SUMMARY

Nautobot has changed all, but User object from integer ID to UUID4. Need to skip any additional logic if user or field is already UUID4 or integer.

Basically just add OR conditionals for UUID4 checks. Should mainly be within module_utils.utils.

GQL Inventory: Redirects Failing Module

ISSUE TYPE
  • Bug Report
SOFTWARE VERSIONS
pynautobot

1.0.2

Ansible:

4.x

Nautobot:

1.1.4

Collection:

networktocode.nautobot

SUMMARY

When having redirects in the path, the follow redirects option is failing

STEPS TO REPRODUCE
  1. Create GQL inventory
  2. Execute
  3. Receive error
EXPECTED RESULTS
ACTUAL RESULTS

GraphQL Lookup and Action Plugin Do Not Honor SSL Setting

ISSUE TYPE
  • Bug Report
SOFTWARE VERSIONS
pynautobot

1.0.2

Ansible:

2.10.x

Nautobot:

1.0.1

Collection:

2.0.0

SUMMARY

When using validate_certs: False the SSL Certificate is still checked.

STEPS TO REPRODUCE

Create a task using the Action plugin with validate_certs: False. Then get certificate validation errors

Expected

Expected the query to be passed

The issue stems from a mismtach of kwargs for validation of SSL certificates. On the API initialization the keyword is ssl_verify. In the utils.py the keyword argument being looked for is validate_certs.

Unable to get device `config_context` using the the gql_inventory plugin

ISSUE TYPE
  • Bug Report
SOFTWARE VERSIONS
pynautobot

1.0.4

Ansible:

2.9

Nautobot:

1.2.5

Collection:

v3.3.0

SUMMARY

I try to include config contexts in Ansible hosts using Nautobot dynamic inventory. I am using gql inventory plugin, but there is no way to include scalar values like config_context.

Here is a sample query that works using the in-browser gql tool.

query {
  devices {
  name
  platform {
    napalm_driver
  }
  status {
    name
  }
  primary_ip4 {
    address
  }
  device_role {
    name
  }
  site {
    name
  }
  interfaces {
    name
  }
 	config_context      <----- NO OPTION TO SPECIFY PARAMETERS LIKE THIS
}
}
STEPS TO REPRODUCE

I have the following inventory config:

# nautobot-inventory.yaml

plugin: networktocode.nautobot.gql_inventory
api_endpoint: http://172.20.0.6:8080
token: "xxxxxxx"
validate_certs: True
filters:
  site: mysite
additional_variables:
  - "config_context"
query:
  config_context: null

I run this command:

ansible-inventory -v --list -i nautobot-inventory.yaml

I also tried:

query:
  - config_context
query:
  config_context:

But none of these options work.

I think the problem is here in this template:
https://github.com/nautobot/nautobot-ansible/blob/develop/plugins/templates/graphql_additional_query.j2
It explicitly wants to have key:value pairs, which I cannot specify for config_context.

EXPECTED RESULTS

I want to see config_context under the device output, similar to what I can see in the in-browser gql tool.

            "mydevice": {
                "ansible_host": "mydevice",
                "ansible_network_os": "cisco.nxos.nxos",
                "device_role": {
                    "name": "spine"
                }
            },
ACTUAL RESULTS

I get an error or a config context is not present.

update README

ISSUE TYPE
  • Documentation update
SUMMARY

Would be helpful to improve the README to highlight what the collection (modules) can do. At a minimum, include a list of modules and a one-line description.

Missing coices for field type in module rear_ports_template

ISSUE TYPE
  • Bug Report
SOFTWARE VERSIONS
pynautobot

pynautobot==1.0.2

Ansible:

ansible 2.10.9
config file = /home/ansible/devel/nautobot-transfer/nautobot-ansible/ansible.cfg
configured module search path = ['/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/ansible/devel/nautobot-transfer/lib/python3.8/site-packages/ansible
executable location = /home/ansible/devel/nautobot-transfer/bin/ansible
python version = 3.8.7 (default, Mar 8 2021, 07:36:30) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]

Nautobot:

fbe10eeac2ef (v1.0.1b1)

Collection:
# /home/ansible/.ansible/collections/ansible_collections
Collection             Version
---------------------- -------
.mypy_cache.3.6        *      
ansible.posix          1.2.0  
community.general      2.1.1  
gluster.gluster        1.0.1  
networktocode.nautobot 2.0.0  

# /home/ansible/devel/nautobot-transfer/lib/python3.8/site-packages/ansible_collections
Collection                    Version
----------------------------- -------
amazon.aws                    1.4.1  
ansible.netcommon             1.5.0  
ansible.posix                 1.2.0  
ansible.utils                 2.0.2  
ansible.windows               1.5.0  
arista.eos                    1.3.0  
awx.awx                       17.1.0 
azure.azcollection            1.5.0  
check_point.mgmt              2.0.0  
chocolatey.chocolatey         1.1.0  
cisco.aci                     2.0.0  
cisco.asa                     1.0.4  
cisco.intersight              1.0.12 
cisco.ios                     1.3.0  
cisco.iosxr                   1.2.1  
cisco.meraki                  2.2.1  
cisco.mso                     1.1.0  
cisco.nso                     1.0.3  
cisco.nxos                    1.4.0  
cisco.ucs                     1.6.0  
cloudscale_ch.cloud           2.1.0  
community.aws                 1.4.0  
community.azure               1.0.0  
community.crypto              1.6.1  
community.digitalocean        1.1.1  
community.docker              1.5.0  
community.fortios             1.0.0  
community.general             2.5.1  
community.google              1.0.0  
community.grafana             1.2.1  
community.hashi_vault         1.1.3  
community.hrobot              1.1.1  
community.kubernetes          1.2.1  
community.kubevirt            1.0.0  
community.libvirt             1.0.1  
community.mongodb             1.2.1  
community.mysql               1.4.0  
community.network             2.1.1  
community.okd                 1.1.2  
community.postgresql          1.2.0  
community.proxysql            1.0.0  
community.rabbitmq            1.0.3  
community.routeros            1.1.0  
community.skydive             1.0.0  
community.sops                1.0.6  
community.vmware              1.9.0  
community.windows             1.3.0  
community.zabbix              1.3.0  
containers.podman             1.5.0  
cyberark.conjur               1.1.0  
cyberark.pas                  1.0.6  
dellemc.openmanage            3.2.0  
dellemc.os10                  1.1.1  
dellemc.os6                   1.0.7  
dellemc.os9                   1.0.4  
f5networks.f5_modules         1.9.0  
fortinet.fortimanager         2.0.1  
fortinet.fortios              1.1.9  
frr.frr                       1.0.3  
gluster.gluster               1.0.1  
google.cloud                  1.0.2  
hetzner.hcloud                1.4.2  
ibm.qradar                    1.0.3  
infinidat.infinibox           1.2.4  
inspur.sm                     1.1.2  
junipernetworks.junos         1.3.0  
kubernetes.core               1.2.1  
mellanox.onyx                 1.0.0  
netapp.aws                    20.9.0 
netapp.elementsw              20.11.0
netapp.ontap                  21.4.0 
netapp_eseries.santricity     1.2.7  
netbox.netbox                 2.1.0  
ngine_io.cloudstack           2.1.0  
ngine_io.exoscale             1.0.0  
ngine_io.vultr                1.1.0  
openstack.cloud               1.4.0  
openvswitch.openvswitch       1.2.0  
ovirt.ovirt                   1.4.1  
purestorage.flasharray        1.7.0  
purestorage.flashblade        1.5.0  
sensu.sensu_go                1.9.4  
servicenow.servicenow         1.0.4  
splunk.es                     1.0.2  
t_systems_mms.icinga_director 1.16.0 
theforeman.foreman            1.5.1  
vyos.vyos                     1.1.1  
wti.remote                    1.0.1
SUMMARY

There are not all selections for field type available in module rear_port_template

In nautobot/dcim/choices.py the following choices are available:

class PortTypeChoices(ChoiceSet):

    TYPE_8P8C = "8p8c"
    TYPE_8P6C = "8p6c"
    TYPE_8P4C = "8p4c"
    TYPE_8P2C = "8p2c"
    TYPE_GG45 = "gg45"
    TYPE_TERA4P = "tera-4p"
    TYPE_TERA2P = "tera-2p"
    TYPE_TERA1P = "tera-1p"
    TYPE_110_PUNCH = "110-punch"
    TYPE_BNC = "bnc"
    TYPE_MRJ21 = "mrj21"
    TYPE_ST = "st"
    TYPE_SC = "sc"
    TYPE_SC_APC = "sc-apc"
    TYPE_FC = "fc"
    TYPE_LC = "lc"
    TYPE_LC_APC = "lc-apc"
    TYPE_MTRJ = "mtrj"
    TYPE_MPO = "mpo"
    TYPE_LSH = "lsh"
    TYPE_LSH_APC = "lsh-apc"
    TYPE_SPLICE = "splice"
    TYPE_CS = "cs"
    TYPE_SN = "sn"
STEPS TO REPRODUCE

Try to set splice as type

EXPECTED RESULTS
ACTUAL RESULTS
MSG:

value of type must be one of: 8p8c, 110-punch, bnc, mrj21, fc, lc, lc-apc, lsh, lsh-apc, mpo, mtrj, sc, sc-apc, st, got: splice found in data
failed: [localhost] (item={'name': 'rear12', 'type': 'splice', 'positions': 1, 'device_type': 'LWL-12xLC-FD'}) => {
    "ansible_loop_var": "item",
    "changed": false,
    "item": {
        "device_type": "LWL-12xLC-FD",
        "name": "rear12",
        "positions": 1,
        "type": "splice"
    }
}

MSG:

value of type must be one of: 8p8c, 110-punch, bnc, mrj21, fc, lc, lc-apc, lsh, lsh-apc, mpo, mtrj, sc, sc-apc, st, got: splice found in data

Update VLAN module document regarding role requirement

ISSUE TYPE
  • Documentation update
SOFTWARE VERSIONS
Ansible:

Tower 3.8.1, Ansible 2.9.17

Nautobot:

v1.0.3

SUMMARY

The document page for the VLAN module has the following comment for vlan_role variable:

Required if state=present and the vlan does not exist yet

However, since I didn't read this closely I didn't include a role, yet I was able to add VLANs (that did not exist before) using this module. The VLANs created without issue, and under role they just have None. So I think the comment can be modified (or removed), since it doesn't seem required to specify a role for a VLAN.

STEPS TO REPRODUCE
    - name: Ensure VLAN state
      networktocode.nautobot.vlan:
        url: "{{ nautobot_url }}"
        token: "{{ nautobot_token }}"
        validate_certs: no
        data:
          name: "VLAN{{ '%03d' % item }}"
          vid: "{{ item }}"
          vlan_group: "{{ vlan_group }}"
          tenant: "{{ tenant }}"
          status: active
        state: "{{ state }}"
      loop: "{{ vlans }}"

device_interface module does not allow access to custom_fields

ISSUE TYPE
  • Module creation help
SOFTWARE VERSIONS
pynautobot

pynautobot 1.0.3

Ansible:

ansible 2.10.8

Nautobot:

1.1.2

Collection:

networktocode.nautobot 2.0.1

SUMMARY

Working on testing functionality of nautobot and the nautobot ansible collection and noticed that the device_interface module does not allow access to custom_fields on interfaces.

STEPS TO REPRODUCE
    - name: Create interface within Nautobot with only required information
      networktocode.nautobot.device_interface:
        url: "{{ nautobot_url }}"
        token: "{{ token }}"
        data:
          device: DEVICE_NAME
          name: "ge-"
          type: "{{ item.type }}"
          description: "{{ item.description }}"
          enabled: true
          custom_fields:
            monitored: true
        state: present
EXPECTED RESULTS

Module would allow any custom_fields on the interface to be updated if the args were set properly in the playbook. There are a few other of the modules that allow this behavior (such as the device.py module).

ACTUAL RESULTS

Ansible unsupported parameters errors stating that custom_fields is not allowed.

    "msg": "Unsupported parameters for (networktocode.nautobot.device_interface) module: custom_fields found in data. Supported parameters include: description, device, enabled, label, lag, mac_address, mgmt_only, mode, mtu, name, tagged_vlans, tags, type, untagged_vlan"

BUG: GraphQL inventory plugin - boolean filters are invalid

ISSUE TYPE
  • Bug Report
SOFTWARE VERSIONS
pynautobot

1.0.4

Ansible:

2.10.17

Nautobot:

1.3.9

Collection:

4.0.0

SUMMARY

When using the gql_inventory, if you try and use the devices filter of has_primary_ip: true it converts it to has_primary_ip: True for the GraphQL query, which is invalid. I also tried using has_primary_ip: "true", but GraphQL did not accept a string either.

STEPS TO REPRODUCE

Use this inventory.yml file.

---
plugin: networktocode.nautobot.gql_inventory
api_endpoint: https://demo.nautobot.com
token: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
query:
  devices:
    filters:
      has_primary_ip: true

You can confirm the query that gets sent with ansible-inventory -i inventory.yml --list -vvv

EXPECTED RESULTS

It should instead send in the GraphQL query as such:

query {
  devices (has_primary_ip: true) {
    name
    primary_ip4 {
      host
    }
    platform {
      napalm_driver
    }
  }
  virtual_machines {
    name
    primary_ip4 {
      host
    }
    platform {
      name
    }
  }
}
ACTUAL RESULTS

It converts the boolean true to True:

query {
  devices (has_primary_ip: True) {
    name
    primary_ip4 {
      host
    }
    platform {
      napalm_driver
    }
  }
  virtual_machines {
    name
    primary_ip4 {
      host
    }
    platform {
      name
    }
  }
}

ipv6 not working in networktocode.nautobot.ip_address

ISSUE TYPE
  • Bug Report
SOFTWARE VERSIONS
pynautobot

1.0.1

Ansible:

ansible 2.10.8

Nautobot:

1.0.1

Collection:

Collection Version


ansible.netcommon 2.0.1
ansible.utils 2.0.2
cisco.ios 2.0.1
cisco.iosxr 2.0.2
networktocode.nautobot 2.0.0

SUMMARY

Cannot add IPv6 address with ip_address plugin, must be determined directly, but with and without family settings not working

TASK [Check Loopback0 IP addresses] *************************************************************************************************************************************************************************************************************************
ok: [localhost] => (item=10.2.3.1/32)
[DEPRECATION WARNING]: Param 'data["family"]' is deprecated. See the module docs for more information. This feature will be removed in version 0.3.0. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
failed: [localhost] (item=2001:4c32:ff01:f::1/128) => {"ansible_loop_var": "item", "changed": false, "item": "2001:4c32:ff01:f::1/128", "msg": "{\"host\":[\"Ensure this value has at most 16 characters (it has 21).\"],\"broadcast\":[\"Ensure this value has at most 16 characters (it has 21).\"]}"}
STEPS TO REPRODUCE
        - name: Check Loopback0 IP addresses
          networktocode.nautobot.ip_address:
            url: "{{ cmdb_url }}"
            token: "{{ cmdb_token }}"
            data:
              address: "{{ item }}"
              family: "{% if item | ansible.netcommon.ipv4 %}4{% else %}6{% endif %}" # Test with also passing family
              assigned_object:
                name: Loopback0
                device: "{{ distri_set.node1.hostname }}"
              status: active
            state: present
            with_items:
              - 10.2.3.1/32
              - 2001:4c32:ff01:f::1/128
            validate_certs: "{{ cmdb_validate_certs }}"
EXPECTED RESULTS

OK, accespted even without family: 6

ACTUAL RESULTS

Failed to much characters, looks like the validation is not set for length of IPv6

REST API Inventory Better Handle Large Inventories

ISSUE TYPE
  • Bug Report
SOFTWARE VERSIONS
pynautobot

N/A - REST API Inventory

Ansible:

x.x

Nautobot:

1.1.4

Collection:

networktocode.nautobot

SUMMARY

With large inventories, Ansible may cause requests to timeout for Nautobot due to asking for all resources.

STEPS TO REPRODUCE
  1. Create a large inventory in Nautobot
  2. Use Nautobot Inventory
  3. See timeouts and large CPU utilization
EXPECTED RESULTS

Completed inventory

ACTUAL RESULTS

Incomplete inventory

Possible Solution

  1. Look into handling pagination built into Nautobot instead of requesting all
  2. Evaluate moving to pynautobot to handle pagination
  3. Others

Missing description field in ipam_role and region modules

ISSUE TYPE
  • Bug Report
SUMMARY

The ipam_role and region modules are missing the description parameter, which is present in Nautobot's API.

Would be great to have these modules match the API's capabilities.

STEPS TO REPRODUCE

Attempt to create a region or an ipam_role via Ansible and attach a description.

EXPECTED RESULTS

Region / IPAM Role is added with a description

ACTUAL RESULTS

Module fails since it does not expect a description parameter

Create New Inventory With GraphQL Endpoint

ISSUE TYPE
  • Feature Idea
  • Module creation help
SOFTWARE VERSIONS
pynautobot

1.0.2

Ansible:

2.11.1 (ansible-core)

Nautobot:

1.0.3

Collection:

networktocode.nautobot

SUMMARY

Would like to create a new inventory based off the GraphQL interface. Benefits include:

  • Capability of gathering data about the device
  • Able to access custom field data

Virtual Chassis attach to master - device UUID used, expected name

ISSUE TYPE
  • Bug Report
SOFTWARE VERSIONS
pynautobot

1.0.1

Ansible:

Core: 2.10.8

Nautobot:

1.0.2

Collection:

2.0.1

SUMMARY

Device UUID is used in slug and lookup, where the device name is expected for adding devices to virtual chassis.

STEPS TO REPRODUCE

Using the same playbooks as issue #28 where problem got resolved and confirmed working.

tasks:
    - name: Create device
      device:
        url: '{{ nautobot_url }}'
        token: '{{ nautobot_token }}'
        data:
          name: "NET-SWI-001-1"
          device_type: "OS6560"
          device_role: "access"
          site: "UK"
          status: active
        state: present

    - name: Create virtual chassis
      virtual_chassis:
        url: '{{ nautobot_url }}'
        token: '{{ nautobot_token }}'
        data:
          name: 'NET-SWI-001'
          master: 'NET-SWI-001-1'
        state: present

    - name: Add devices to Virtual chassis
      device:
        url: '{{ nautobot_url }}'
        token: '{{ nautobot_token }}'
        data:
          name: 'NET-SWI-001-1'
          virtual_chassis:
            name: "NET-SWI-001"
            master: "NET-SWI-001-1"
          vc_position: '1'
          status: active
        state: present

Inventory:

    NET-SWI-DIST:
      ansible_host: 10.10.10.1
      device_role: Distribution switch
      device_chassis:
        - type: OS6860E-P24
          unit: 1
    NET-SWI-001:
      ansible_host: 10.10.20.1
      device_role: Access switch
      device_chassis:
        - type: OS6560-P48X4
          unit: 1
        - type: OS6560-P48X4
          unit: 2
        - type: OS6560-P48X4
          unit: 3
        - type: OS6560-P48X4
          unit: 4
EXPECTED RESULTS

Devices added to virtual chassis and virtual chassis attached to master device.

ACTUAL RESULTS

Virtual device not created because of the master device is not found (uuid instead of name).
When you try to first add the devices and attach the virtual chassis to master later, the virtual chassis does not get found.

*** Attach Virtual Chassis to device first ***

PLAY [Nautobot add devices from inventory] *****************************************************************************************************************************************************

TASK [NAUTOBOT >> Create devices] **************************************************************************************************************************************************************
changed: [NET-SWI-001] => (item=OS6560-P48X4)
changed: [NET-SWI-DIST] => (item=OS6860E-P24)
changed: [NET-SWI-001] => (item=OS6560-P48X4)
changed: [NET-SWI-001] => (item=OS6560-P48X4)
changed: [NET-SWI-001] => (item=OS6560-P48X4)

TASK [NetBox - Create virtual chassis] *********************************************************************************************************************************************************
fatal: [NET-SWI-001]: FAILED! => changed=false 
  msg: '{"master":["Select a valid choice. c7411e8c-da6e-4465-967b-14de46eec9fa is not one of the available choices."]}'
fatal: [NET-SWI-DIST]: FAILED! => changed=false 
  msg: '{"master":["Select a valid choice. b3b31a1d-d5ef-4832-8350-ee36fd27d4f2 is not one of the available choices."]}'

PLAY RECAP *************************************************************************************************************************************************************************************
NET-SWI-001            : ok=1    changed=1    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   
NET-SWI-DIST           : ok=1    changed=1    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

*** Attach virtual chassis to master after virtual chassis creation and adding device members***

PLAY [Nautobot add devices from inventory] *****************************************************************************************************************************************************

TASK [NAUTOBOT >> Create devices] **************************************************************************************************************************************************************
ok: [NET-SWI-DIST] => (item=OS6860E-P24)
ok: [NET-SWI-001] => (item=OS6560-P48X4)
ok: [NET-SWI-001] => (item=OS6560-P48X4)
ok: [NET-SWI-001] => (item=OS6560-P48X4)
ok: [NET-SWI-001] => (item=OS6560-P48X4)

TASK [NetBox - Create virtual chassis] *********************************************************************************************************************************************************
ok: [NET-SWI-001]
ok: [NET-SWI-DIST]

TASK [NetBox - Add devices to Virtual chassis] *************************************************************************************************************************************************
changed: [NET-SWI-DIST] => (item={'type': 'OS6860E-P24', 'unit': 1})
changed: [NET-SWI-001] => (item={'type': 'OS6560-P48X4', 'unit': 1})
changed: [NET-SWI-001] => (item={'type': 'OS6560-P48X4', 'unit': 2})
changed: [NET-SWI-001] => (item={'type': 'OS6560-P48X4', 'unit': 3})
changed: [NET-SWI-001] => (item={'type': 'OS6560-P48X4', 'unit': 4})

TASK [NetBox - Virtual chassis master] *********************************************************************************************************************************************************
fatal: [NET-SWI-001]: FAILED! => changed=false 
  msg: '{"master":["Select a valid choice. c7411e8c-da6e-4465-967b-14de46eec9fa is not one of the available choices."]}'
fatal: [NET-SWI-DIST]: FAILED! => changed=false 
  msg: '{"master":["Select a valid choice. b3b31a1d-d5ef-4832-8350-ee36fd27d4f2 is not one of the available choices."]}'

PLAY RECAP *************************************************************************************************************************************************************************************
NET-SWI-001            : ok=3    changed=1    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   
NET-SWI-DIST           : ok=3    changed=1    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

Add devices to virtual chassis error -> "More than one result returned for virtual_chassis"

  • Bug Report
SOFTWARE VERSIONS
pynautobot

1.0.1

Ansible:

2.10.7

Nautobot:

1.0.0b2

Collection:

1.0.4

SUMMARY

Adding a device to a virtual-chassis fails with error:
Add devices to virtual chassis error -> "More than one result returned for virtual_chassis"

Reference Netbox issue:
netbox-community/ansible_modules#402

STEPS TO REPRODUCE

Sample playbook:

tasks:
    - name: Create device
      device:
        url: '{{ nautobot_url }}'
        token: '{{ nautobot_token }}'
        data:
          name: "NET-SWI-001-1"
          device_type: "OS6560"
          device_role: "access"
          site: "UK"
          status: active
        state: present

    - name: Create virtual chassis
      virtual_chassis:
        url: '{{ nautobot_url }}'
        token: '{{ nautobot_token }}'
        data:
          name: 'NET-SWI-001'
          master: 'NET-SWI-001-1'
        state: present

    - name: Add devices to Virtual chassis
      device:
        url: '{{ nautobot_url }}'
        token: '{{ nautobot_token }}'
        data:
          name: 'NET-SWI-001-1'
          virtual_chassis:
            name: "NET-SWI-001"
            master: "NET-SWI-001-1"
          vc_position: '1'
          status: active
        state: present
EXPECTED RESULTS

Multiple units/chassis added to the virtual chassis

ACTUAL RESULTS

Error output

Add devices to virtual chassis error -> "More than one result returned for virtual_chassis"

Add 'site' - traceback

ISSUE TYPE
  • Bug Report
SOFTWARE VERSIONS
pynautobot

pynautobot==1.0.1

Ansible:
ansible 2.10.8
  config file = /home/ansible/devel/nautobot-transfer/ansible.cfg
  configured module search path = ['/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/ansible/devel/nautobot-transfer/lib64/python3.6/site-packages/ansible
  executable location = /home/ansible/devel/nautobot-transfer/bin/ansible
  python version = 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
Nautobot:

d7d27ecaeccd (v1.0.0b5)

Collection:
Collection                    Version
----------------------------- -------
amazon.aws                    1.4.1  
ansible.netcommon             1.5.0  
ansible.posix                 1.2.0  
ansible.utils                 2.0.2  
ansible.windows               1.5.0  
arista.eos                    1.3.0  
awx.awx                       17.1.0 
azure.azcollection            1.5.0  
check_point.mgmt              2.0.0  
chocolatey.chocolatey         1.1.0  
cisco.aci                     2.0.0  
cisco.asa                     1.0.4  
cisco.intersight              1.0.12 
cisco.ios                     1.3.0  
cisco.iosxr                   1.2.1  
cisco.meraki                  2.2.1  
cisco.mso                     1.1.0  
cisco.nso                     1.0.3  
cisco.nxos                    1.4.0  
cisco.ucs                     1.6.0  
cloudscale_ch.cloud           2.1.0  
community.aws                 1.4.0  
community.azure               1.0.0  
community.crypto              1.6.1  
community.digitalocean        1.1.1  
community.docker              1.5.0  
community.fortios             1.0.0  
community.general             2.5.1  
community.google              1.0.0  
community.grafana             1.2.1  
community.hashi_vault         1.1.3  
community.hrobot              1.1.1  
community.kubernetes          1.2.1  
community.kubevirt            1.0.0  
community.libvirt             1.0.1  
community.mongodb             1.2.1  
community.mysql               1.4.0  
community.network             2.1.1  
community.okd                 1.1.2  
community.postgresql          1.2.0  
community.proxysql            1.0.0  
community.rabbitmq            1.0.3  
community.routeros            1.1.0  
community.skydive             1.0.0  
community.sops                1.0.6  
community.vmware              1.9.0  
community.windows             1.3.0  
community.zabbix              1.3.0  
containers.podman             1.5.0  
cyberark.conjur               1.1.0  
cyberark.pas                  1.0.6  
dellemc.openmanage            3.2.0  
dellemc.os10                  1.1.1  
dellemc.os6                   1.0.7  
dellemc.os9                   1.0.4  
f5networks.f5_modules         1.9.0  
fortinet.fortimanager         2.0.1  
fortinet.fortios              1.1.9  
frr.frr                       1.0.3  
gluster.gluster               1.0.1  
google.cloud                  1.0.2  
hetzner.hcloud                1.4.2  
ibm.qradar                    1.0.3  
infinidat.infinibox           1.2.4  
inspur.sm                     1.1.2  
junipernetworks.junos         1.3.0  
kubernetes.core               1.2.1  
mellanox.onyx                 1.0.0  
netapp.aws                    20.9.0 
netapp.elementsw              20.11.0
netapp.ontap                  21.4.0 
netapp_eseries.santricity     1.2.7  
netbox.netbox                 2.1.0  
ngine_io.cloudstack           2.1.0  
ngine_io.exoscale             1.0.0  
ngine_io.vultr                1.1.0  
openstack.cloud               1.4.0  
openvswitch.openvswitch       1.2.0  
ovirt.ovirt                   1.4.1  
purestorage.flasharray        1.7.0  
purestorage.flashblade        1.5.0  
sensu.sensu_go                1.9.4  
servicenow.servicenow         1.0.4  
splunk.es                     1.0.2  
t_systems_mms.icinga_director 1.16.0 
theforeman.foreman            1.5.1  
vyos.vyos                     1.1.1  
wti.remote                    1.0.1
SUMMARY

During insert a new site a traceback is shown.

STEPS TO REPRODUCE
  • install ansible, nautobot-ansible, pynautobot and development version of Nautobot
  • run playbook
    - name: "Add Sites in Nautobot"
      networktocode.nautobot.site:
        url: "{{ nburl }}"
        token: "{{ nbtoken }}"
        validate_certs: no
        state: present
        data: "{{ item }}"
      loop: "{{ nbsites }}"
      tags:
      - sites
nbsites: 
    - name: "DEBE"
       slug: "site-debe"
       status: "active"
       description: "ACME Germany "
       time_zone: "Europe/Berlin
       tenant: "tenant-debe"
       comments: "- ACME Berlin\n- ACME Systems Germany GmbH"
EXPECTED RESULTS

Site is added into Anutobot

ACTUAL RESULTS
TASK [Add Sites in Nautobot] ***************************************************
task path: /home/ansible/devel/develop/nautobot-transfer.yml:91
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: ansible
<127.0.0.1> EXEC /bin/sh -c 'echo ~ansible && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/ansible/.ansible/tmp `"&& mkdir "` echo /home/ansible/.ansible/tmp/ansible-tmp-1619068766.2322965-1697-137024437752866 `" && echo ansible-tmp-1619068766.2322965-1697-137024437752866="` echo /home/ansible/.ansible/tmp/ansible-tmp-1619068766.2322965-1697-137024437752866 `" ) && sleep 0'
Using module file /home/ansible/.ansible/collections/ansible_collections/networktocode/nautobot/plugins/modules/site.py
<127.0.0.1> PUT /home/ansible/.ansible/tmp/ansible-local-1670a4q5isnj/tmp99xjxkhu TO /home/ansible/.ansible/tmp/ansible-tmp-1619068766.2322965-1697-137024437752866/AnsiballZ_site.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/ansible/.ansible/tmp/ansible-tmp-1619068766.2322965-1697-137024437752866/ /home/ansible/.ansible/tmp/ansible-tmp-1619068766.2322965-1697-137024437752866/AnsiballZ_site.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/home/ansible/devel/develop/nornir/bin/python3 /home/ansible/.ansible/tmp/ansible-tmp-1619068766.2322965-1697-137024437752866/AnsiballZ_site.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /home/ansible/.ansible/tmp/ansible-tmp-1619068766.2322965-1697-137024437752866/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
  File "/home/ansible/.ansible/tmp/ansible-tmp-1619068766.2322965-1697-137024437752866/AnsiballZ_site.py", line 102, in <module>
    _ansiballz_main()
  File "/home/ansible/.ansible/tmp/ansible-tmp-1619068766.2322965-1697-137024437752866/AnsiballZ_site.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/ansible/.ansible/tmp/ansible-tmp-1619068766.2322965-1697-137024437752866/AnsiballZ_site.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible_collections.networktocode.nautobot.plugins.modules.site', init_globals=None, run_name='__main__', alter_sys=True)
  File "/usr/local/lib/python3.7/runpy.py", line 205, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/local/lib/python3.7/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_networktocode.nautobot.site_payload_svnvmx5c/ansible_networktocode.nautobot.site_payload.zip/ansible_collections/networktocode/nautobot/plugins/modules/site.py", line 283, in <module>
    def check_enableusersite():
  File "/tmp/ansible_networktocode.nautobot.site_payload_svnvmx5c/ansible_networktocode.nautobot.site_payload.zip/ansible_collections/networktocode/nautobot/plugins/modules/site.py", line 278, in main
    if os.path.isdir(sitedir):
  File "/tmp/ansible_networktocode.nautobot.site_payload_svnvmx5c/ansible_networktocode.nautobot.site_payload.zip/ansible_collections/networktocode/nautobot/plugins/module_utils/dcim.py", line 50, in __init__
  File "/tmp/ansible_networktocode.nautobot.site_payload_svnvmx5c/ansible_networktocode.nautobot.site_payload.zip/ansible_collections/networktocode/nautobot/plugins/module_utils/utils.py", line 480, in __init__
  File "/tmp/ansible_networktocode.nautobot.site_payload_svnvmx5c/ansible_networktocode.nautobot.site_payload.zip/ansible_collections/networktocode/nautobot/plugins/module_utils/utils.py", line 813, in _change_choices_id
  File "/tmp/ansible_networktocode.nautobot.site_payload_svnvmx5c/ansible_networktocode.nautobot.site_payload.zip/ansible_collections/networktocode/nautobot/plugins/module_utils/utils.py", line 790, in _fetch_choice_value
KeyError: 'display_name'
failed: [localhost] (item={'name': 'DEBE', 'slug': 'site-debe', 'description': 'ACME Germany', 'status': 'active', 'time_zone': 'Europe/Berlin', 'tenant': 'tenant-debe', 'comments': '- ACME Berlin\n- ACME Systems Germany GmbH'}) => {
    "ansible_loop_var": "item",
    "changed": false,
    "item": {
        "comments": "- ACME Berlin\",
        "description": "ACME Germany ",
        "name": "DEBE",
        "slug": "site-debe",
        "status": "active",
        "tenant": "tenant-debe",
        "time_zone": "Europe/Berlin"
    },
    "rc": 1
}

MSG:

MODULE FAILURE
See stdout/stderr for the exact error


MODULE_STDERR:

Traceback (most recent call last):
  File "/home/ansible/.ansible/tmp/ansible-tmp-1619087657.4245238-14753-175208244676283/AnsiballZ_site.py", line 102, in <module>
    _ansiballz_main()
  File "/home/ansible/.ansible/tmp/ansible-tmp-1619087657.4245238-14753-175208244676283/AnsiballZ_site.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/ansible/.ansible/tmp/ansible-tmp-1619087657.4245238-14753-175208244676283/AnsiballZ_site.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible_collections.networktocode.nautobot.plugins.modules.site', init_globals=None, run_name='__main__', alter_sys=True)
  File "/usr/lib64/python3.6/runpy.py", line 205, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib64/python3.6/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_networktocode.nautobot.site_payload_5pxu34fm/ansible_networktocode.nautobot.site_payload.zip/ansible_collections/networktocode/nautobot/plugins/modules/site.py", line 283, in <module>
    
  File "/tmp/ansible_networktocode.nautobot.site_payload_5pxu34fm/ansible_networktocode.nautobot.site_payload.zip/ansible_collections/networktocode/nautobot/plugins/modules/site.py", line 278, in main
    home directory.
  File "/tmp/ansible_networktocode.nautobot.site_payload_5pxu34fm/ansible_networktocode.nautobot.site_payload.zip/ansible_collections/networktocode/nautobot/plugins/module_utils/dcim.py", line 50, in __init__
  File "/tmp/ansible_networktocode.nautobot.site_payload_5pxu34fm/ansible_networktocode.nautobot.site_payload.zip/ansible_collections/networktocode/nautobot/plugins/module_utils/utils.py", line 475, in __init__
  File "/tmp/ansible_networktocode.nautobot.site_payload_5pxu34fm/ansible_networktocode.nautobot.site_payload.zip/ansible_collections/networktocode/nautobot/plugins/module_utils/utils.py", line 811, in _change_choices_id
  File "/tmp/ansible_networktocode.nautobot.site_payload_5pxu34fm/ansible_networktocode.nautobot.site_payload.zip/ansible_collections/networktocode/nautobot/plugins/module_utils/utils.py", line 788, in _fetch_choice_value
KeyError: 'display_name'


PLAY RECAP *********************************************************************
localhost                  : ok=3    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   
pip freeze

ansible==3.3.0
ansible-base==2.10.8
certifi==2020.12.5
cffi==1.14.5
chardet==4.0.0
cryptography==3.4.7
idna==2.10
Jinja2==2.11.3
MarkupSafe==1.1.1
packaging==20.9
pycparser==2.20
pynautobot==1.0.1
pyparsing==2.4.7
PyYAML==5.4.1
requests==2.25.1
urllib3==1.26.4

query_graphql: Parameters not working

ISSUE TYPE
  • Bug Report
SOFTWARE VERSIONS
pynautobot

pynautobot-1.0.4

Ansible:

ansible [core 2.12.3]
config file = /home/ansible/devel/develop-a5/ansible.cfg
configured module search path = ['/home/ansible/.cache/pypoetry/virtualenvs/net-automation-FMTvBirT-py3.9/lib/python3.9/site-packages/napalm_ansible']
ansible python module location = /home/ansible/.cache/pypoetry/virtualenvs/net-automation-FMTvBirT-py3.9/lib/python3.9/site-packages/ansible
ansible collection location = /home/ansible/devel/develop-a5/collections
executable location = /home/ansible/.cache/pypoetry/virtualenvs/net-automation-FMTvBirT-py3.9/bin/ansible
python version = 3.9.10 (main, Mar 7 2022, 07:16:32) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
jinja version = 3.0.3
libyaml = True

Nautobot:

286883f289fb (v1.2.9)

Collection:

Collection Version


networktocode.nautobot 3.3.1

SUMMARY

Setting the query parameter device_name: {{ inventory_hostname }} will return all results within the playbook whereas the same query will return just the interfaces of the particular device when running in GraphiQL or as an api call (Swagger).

STEPS TO REPRODUCE
  • run playbook,
---
- name: test_nautobot_access.yml
  hosts: all
  become: false

  tasks:

  # Example with variables
  - name: SET FACTS TO SEND TO GRAPHQL ENDPOINT
    set_fact:
      variables:
          device_name: "{{ inventory_hostname }}"
      query_string: |
        query ($device_name: [String]) {
          interfaces(device: $device_name) {
            device {
              name
            }
            name
            cf_interface_config_template
            untagged_vlan {
              vid
            }
            cf_interface_dhcp_trust
            cf_interface_multi_auth
            cf_interface_static_sgt
            enabled
            description
            tags {
              id
            }
            tagged_vlans {
              id
            }
            mode
            lag {
              name
              type
              label
            }
            id
          }
        }

  - name: Obtain interface list of a device from Nautobot
    networktocode.nautobot.query_graphql:
      url: "{{ nautobot_api_endpoint }}"
      token: "{{ nautobot_token }}"
      query: "{{ query_string }}"
      variables: "{{ variables }}"
      validate_certs: no
      update_hostvars: no
    register: res_interfaces

  - name: Display Results
    debug:
      msg: |
        {{ res_interfaces.data }}
    tags: [print_action]
EXPECTED RESULTS
# 1st record from GraphiQL

{
  "data": {
    "interfaces": [
      {
        "device": {
          "name": "ATBRACSE103"
        },
        "name": "GigabitEthernet1/0/1",
        "cf_interface_config_template": "ptype_vlan",
        "untagged_vlan": {
          "vid": 1
        },
        "cf_interface_dhcp_trust": false,
        "cf_interface_multi_auth": false,
        "cf_interface_static_sgt": null,
        "enabled": true,
        "description": "",
        "tags": [
          {
            "id": "7950094f-c8a5-417b-9235-19bb56f67189"
          }
        ],
        "tagged_vlans": [],
        "mode": "ACCESS",
        "lag": null,
        "id": "6615828e-2eaf-401e-8415-74d7120208e9"
      },
ACTUAL RESULTS

see: {'device': {'name': 'WLC02'}, where the playbook is limited to device: ATBRACSE103

ne, 'id': 'e92ead01-d907-4b54-bdc3-ba2be4bb01b3'}, {'device': {'name': 'WLC02'}, 'name': 'vlan3228', 'cf_interface_config_template': 'ptype_vlan', 'untagged_vlan': {'vid': 3228}, 'cf_interface_dhcp_trust': False, 'cf_interface_multi_auth': False, 'cf_interface_static_sgt': None, 'enabled': True, 'description': '', 'tags': [], 'tagged_vlans': [], 'mode': 'ACCESS', 'lag': None, 'id': 'c2749dad-eeb6-4e49-ad47-2a09a867c2f8'}]}

# STATS *******************************************************************************************************************
ATBRACSE103    : ok=4   changed=0       failed=0        unreachable=0   rescued=0       ignored=0

vlan_group module does not work on either create or update

ISSUE TYPE
  • Bug Report
SOFTWARE VERSIONS
pynautobot

1.0.1

Ansible:

ansible 2.10.6

Nautobot:

v1.0.0b2

Collection:

v1.02

SUMMARY

vlan_group cannot be run from a valid playbook, it always generates a uuid error

STEPS TO REPRODUCE
  1. Use the playbook below.
  2. Execute ansible-playbook
  3. see error below
      networktocode.nautobot.vlan_group:
        url: "{{ url }}"
        token: "{{ token }}"
        data:
          name: test
          site: Test
          slug: test
        state: present
        validate_certs: false
EXPECTED RESULTS

vlan groups gets created

ACTUAL RESULTS

Errors out

TASK [Create Vlan groups within Netbox] ******************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "{\"site_id\":[\""name" is not a valid UUID.\"]}"}

with -vvv

The full traceback is:
  File "/tmp/ansible_networktocode.nautobot.vlan_group_payload__2qxhx6a/ansible_networktocode.nautobot.vlan_group_payload.zip/ansible_collections/networktocode/nautobot/plugins/module_utils/utils.py", line 521, in _nb_endpoint_get
    response = nb_endpoint.get(**query_params)
  File "/usr/local/lib/python3.8/dist-packages/pynautobot/core/endpoint.py", line 134, in get
    filter_lookup = self.filter(**kwargs)
  File "/usr/local/lib/python3.8/dist-packages/pynautobot/core/endpoint.py", line 216, in filter
    return response_loader(req.get(), self.return_obj, self)
  File "/usr/local/lib/python3.8/dist-packages/pynautobot/core/query.py", line 293, in get
    return req_all()
  File "/usr/local/lib/python3.8/dist-packages/pynautobot/core/query.py", line 251, in req_all
    req = self._make_call(add_params=add_params)
  File "/usr/local/lib/python3.8/dist-packages/pynautobot/core/query.py", line 224, in _make_call
    raise RequestError(req)
fatal: [localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "data": {
                "name": "test",
                "site": "Test",
                "slug": "test"
            },
            "query_params": null,
            "state": "present",
            "token": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "url": "https://nautobot.infra.robinhood.net",
            "validate_certs": false
        }
    },
    "msg": "{\"site_id\":[\""name" is not a valid UUID.\"]}"
}

ssl_verify does not behave as expected if REQUESTS_CA_BUNDLE is set

ISSUE TYPE
  • Bug Report
SOFTWARE VERSIONS
pynautobot

pynautobot==1.0.4

Ansible:

ansible-core==2.12.2

Nautobot:

1.2.4

Collection:

networktocode.nautobot 3.3.0

SUMMARY

Connections to Nautobot using certificate issued by internal CA, will fail even if ssl_verify: false is set.

STEPS TO REPRODUCE
$ echo $REQUESTS_CA_BUNDLE
/etc/ssl/certs/ca-bundle.crt
---
- hosts: all
  connection: local
  gather_facts: false

  vars:
    api_filter: "device={{ inventory_hostname }}"
    console_ports: "{{ query('networktocode.nautobot.lookup', 'console-server-ports', validate_certs=False, api_filter=api_filter) }}"

  tasks:

  - name: Configure device
    cisco.ios.ios_config:
      src: templates/template.j2
ACTUAL RESULTS
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ansible.errors.AnsibleError: An unhandled exception occurred while templating '{{ query('networktocode.nautobot.lookup', 'console-server-ports', validate_certs=False, api_filter=api_filter) }}'. Error was a <class 'ansible.errors.AnsibleError'>, original message: An unhandled exception occurred while running the lookup plugin 'networktocode.nautobot.lookup'. Error was a <class 'requests.exceptions.SSLError'>, original message: HTTPSConnectionPool(host='nautobot', port=443): Max retries exceeded with url: /api/dcim/console-server-ports/?device=device (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)'))). HTTPSConnectionPool(host='nautobot, port=443): Max retries exceeded with url: /api/dcim/console-server-ports/?device=device (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)')))
fatal: [device]: FAILED! => {"changed": false, "msg": "AnsibleError: An unhandled exception occurred while templating '{{ query('networktocode.nautobot.lookup', 'console-server-ports', validate_certs=False, api_filter=api_filter) }}'. Error was a <class 'ansible.errors.AnsibleError'>, original message: An unhandled exception occurred while running the lookup plugin 'networktocode.nautobot.lookup'. Error was a <class 'requests.exceptions.SSLError'>, original message: HTTPSConnectionPool(host='nautobot', port=443): Max retries exceeded with url: /api/dcim/console-server-ports/?device=device (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)'))). HTTPSConnectionPool(host='nautobot', port=443): Max retries exceeded with url: /api/dcim/console-server-ports/?device=device (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)')))"}

Assigning primary ipv4 address no longer works with nautobot 1.3.0

ISSUE TYPE
  • Bug Report
SOFTWARE VERSIONS
pynautobot

1.0.4

Ansible:

Ansible 5.4.0
Ansible-Core 2.12.3

Nautobot:

1.3.0

Collection:

networktocode.nautobot 3.3.1

SUMMARY

Unable to assign a primary ipv4 address when running nautobot 1.3.0. It worked on version 1.2.11.

STEPS TO REPRODUCE

Device already exists in nautobot.
IP address already exists in nautobot.
Try and assign the IP address to a device and make it the primary_ipv4 address

- name: "SETUP IPAM IP ADDRESSES (ADD IP AS PRIMARY IP TO DEVICE)"
  networktocode.nautobot.device:
    url: "{{ nb_url }}"
    token: "{{ nb_token }}"
    validate_certs: "{{ nb_validate_certs }}"
    name: "{{ ipam_address.assigned_object.device }}"
    primary_ip4: "{{ ipam_address.address }}"
    status: active
    state: present
  loop: "{{ ipam_addresses }}"
  loop_control:
    loop_var: ipam_address
    label: "{{ ipam_address['address'] }}"
  when:
    - ipam_address.assigned_object.primary_for_device|default(False)
EXPECTED RESULTS

IP address is assigned to the device

ACTUAL RESULTS
  module_stderr: |-
      warnings.warn(
    Traceback (most recent call last):
      File "/tmp/ansible-tmp-1650385869.0115254-77358-269172624913517/AnsiballZ_device.py", line 107, in <module>
        _ansiballz_main()
      File "/tmp/ansible-tmp-1650385869.0115254-77358-269172624913517/AnsiballZ_device.py", line 99, in _ansiballz_main
        invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
      File "/tmp/ansible-tmp-1650385869.0115254-77358-269172624913517/AnsiballZ_device.py", line 47, in invoke_module
        runpy.run_module(mod_name='ansible_collections.networktocode.nautobot.plugins.modules.device', init_globals=dict(_module_fqn='ansible_collections.networktocode.nautobot.plugins.modules.device', _modlib_path=modlib_path),
      File "/usr/lib/python3.8/runpy.py", line 207, in run_module
        return _run_module_code(code, init_globals, run_name, mod_spec)
      File "/usr/lib/python3.8/runpy.py", line 97, in _run_module_code
        _run_code(code, mod_globals, init_globals,
      File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
        exec(code, run_globals)
      File "/tmp/ansible_networktocode.nautobot.device_payload_bj97fbp9/ansible_networktocode.nautobot.device_payload.zip/ansible_collections/networktocode/nautobot/plugins/modules/device.py", line 331, in <module>
      File "/tmp/ansible_networktocode.nautobot.device_payload_bj97fbp9/ansible_networktocode.nautobot.device_payload.zip/ansible_collections/networktocode/nautobot/plugins/modules/device.py", line 327, in main
      File "/tmp/ansible_networktocode.nautobot.device_payload_bj97fbp9/ansible_networktocode.nautobot.device_payload.zip/ansible_collections/networktocode/nautobot/plugins/module_utils/dcim.py", line 172, in run
      File "/tmp/ansible_networktocode.nautobot.device_payload_bj97fbp9/ansible_networktocode.nautobot.device_payload.zip/ansible_collections/networktocode/nautobot/plugins/module_utils/utils.py", line 999, in _ensure_object_exists
      File "/tmp/ansible_networktocode.nautobot.device_payload_bj97fbp9/ansible_networktocode.nautobot.device_payload.zip/ansible_collections/networktocode/nautobot/plugins/module_utils/utils.py", line 978, in _update_object
      File "/usr/local/lib/python3.8/dist-packages/pynautobot/core/response.py", line 414, in update
        return self.save()
      File "/usr/local/lib/python3.8/dist-packages/pynautobot/core/response.py", line 386, in save
        if req.patch({i: serialized[i] for i in diff}):
      File "/usr/local/lib/python3.8/dist-packages/pynautobot/core/query.py", line 350, in patch
        return self._make_call(verb="patch", data=data)
      File "/usr/local/lib/python3.8/dist-packages/pynautobot/core/query.py", line 226, in _make_call
        raise RequestError(req)
    pynautobot.core.query.RequestError: The request failed with code 500 Internal Server Error: {'error': "'primary_ip4__nat_outside' does not resolve to an item that supports prefetching - this is an invalid parameter to prefetch_related().", 'exception': 'ValueError', 'nautobot_version': '1.3.0', 'python_version': '3.10.4'}
  module_stdout: ''
  msg: |-
    MODULE FAILURE
    See stdout/stderr for the exact error
  rc: 1

Lookup: GraphQL lookup plugin

ISSUE TYPE
  • Feature Idea
SUMMARY

Implement a GraphQL lookup plugin.

I think maybe if we just return the data key so it's naturally a list and just catch any exception as an AnsibleError.

Arguments would probably be query, api_endpoint, api_token and I think that's it for now.

device_interface module cannot resolve id of lag.

ISSUE TYPE
  • Bug Report
SOFTWARE VERSIONS
pynautobot

1.0.1

Ansible:

ansible 2.10.6

Nautobot:

v1.0.0b2

Collection:

v1.03

SUMMARY

using the device_interface module to assign a lag will fail.

STEPS TO REPRODUCE
# assigning interfaces to LAGs for devices
    - name: Assigning interfaces to LAGs within Netbox
      networktocode.nautobot.device_interface:
         url: "{{ url }}"
         token: "{{ token }}"
         data:
           device: "test1"
           name: "Ethernet49"
          # description: "test2:et3"
           lag:
             name: "Port-Channel1"
         state: present
         validate_certs: false
EXPECTED RESULTS

Lag gets assigned to the specified interface on the specified device. The lag needs to first exist on a device of course.

ACTUAL RESULTS

"msg": "Could not resolve id of lag: {'name': 'Port-Channel1'}"

fatal: [localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "data": {
                "description": null,
                "device": "test1",
                "enabled": null,
                "lag": {
                    "name": "Port-Channel1"
                },
                "mac_address": null,
                "mgmt_only": null,
                "mode": null,
                "mtu": null,
                "name": "Ethernet49",
                "tagged_vlans": null,
                "tags": null,
                "type": null,
                "untagged_vlan": null
            },
            "query_params": null,
            "state": "present",
            "token": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "update_vc_child": false,
            "url": "https://localhost",
            "validate_certs": false
        }
    },
    "msg": "Could not resolve id of lag: {'name': 'Port-Channel1'}"
}

Update Tests for Ansible 2.13

ISSUE TYPE
  • Feature Idea
SOFTWARE VERSIONS
pynautobot

n/a

Ansible:

Need to add tests for latest Ansible.

Nautobot:
Collection:
SUMMARY
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS

Add new rack - KeyError: 'display'

ISSUE TYPE
  • Bug Report
SOFTWARE VERSIONS
pynautobot

pynautobot==1.0.2

Ansible:
ansible 2.9.12
  config file = /home/ansible/devel/nautobot-transfer/ansible.cfg
  configured module search path = ['/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/ansible/nornir/devel/lib64/python3.6/site-packages/ansible
  executable location = /home/ansible/nornir/devel/bin/ansible
  python version = 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
Nautobot:

d7d27ecaeccd (v1.0.0b5)

Collection:

networktocode-nautobot-2.0.0.tar.gz

SUMMARY

Add new rack leads to a traceback.

STEPS TO REPRODUCE
  • install latest versions
    - name: "Add Racks in Nautobot"
      networktocode.nautobot.rack:
        url: "{{ nburl }}"
        token: "{{ nbtoken }}"
        validate_certs: no
        state: present
        data: "{{ item }}"
      loop: "{{ nbracks }}"
      tags:
      - racks
nbracks:
  - name: "Rack-0-A-1",
    comments: "### Schrank-0-A-1 Serverraum-Berlin\n\n**Wartung (IT):**\n",
    desc_units: false,
    facility_id: "Scharank-0-A-1_Serverraum_DEBE",
    rack_group: "rack-group-debedc0",
    site: "site-debe",
    status: "Active",
    tenant: "tenant-debe",
    type: "4-post cabinet",
    u_height: 42,
     width: 19
EXPECTED RESULTS

New Rack in database

ACTUAL RESULTS

Traceback

TASK [Add Racks in Nautobot] ************************************************************************************************************************************************************
task path: /home/ansible/devel/nautobot-transfer/nautobot-transfer.yml:121
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/templates/nautobot_rack_comment.j2"
looking for "templates/nautobot_rack_comment.j2" at "/home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2"
File lookup using /home/ansible/devel/nautobot-transfer/templates/nautobot_rack_comment.j2 as file
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: ansible
<127.0.0.1> EXEC /bin/sh -c 'echo ~ansible && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/ansible/.ansible/tmp `"&& mkdir "` echo /home/ansible/.ansible/tmp/ansible-tmp-1619499985.892657-21899-73879113294739 `" && echo ansible-tmp-1619499985.892657-21899-73879113294739="` echo /home/ansible/.ansible/tmp/ansible-tmp-1619499985.892657-21899-73879113294739 `" ) && sleep 0'
Using module_utils file /home/ansible/nornir/devel/lib64/python3.6/site-packages/ansible/module_utils/basic.py
Using module_utils file ansible_collections/networktocode/nautobot/plugins/module_utils/utils
Using module_utils file ansible_collections/networktocode/nautobot
Using module_utils file ansible_collections/networktocode/nautobot/plugins
Using module_utils file ansible_collections/networktocode/nautobot/plugins/module_utils
Using module_utils file ansible_collections/networktocode/nautobot/plugins/module_utils/dcim
Using module_utils file ansible_collections/networktocode
Using module_utils file ansible_collections
Using module_utils file /home/ansible/nornir/devel/lib64/python3.6/site-packages/ansible/module_utils/_text.py
Using module_utils file /home/ansible/nornir/devel/lib64/python3.6/site-packages/ansible/module_utils/common/validation.py
Using module_utils file /home/ansible/nornir/devel/lib64/python3.6/site-packages/ansible/module_utils/parsing/convert_bool.py
Using module_utils file /home/ansible/nornir/devel/lib64/python3.6/site-packages/ansible/module_utils/common/_json_compat.py
Using module_utils file /home/ansible/nornir/devel/lib64/python3.6/site-packages/ansible/module_utils/six/__init__.py
Using module_utils file /home/ansible/nornir/devel/lib64/python3.6/site-packages/ansible/module_utils/common/sys_info.py
Using module_utils file /home/ansible/nornir/devel/lib64/python3.6/site-packages/ansible/module_utils/parsing/__init__.py
Using module_utils file /home/ansible/nornir/devel/lib64/python3.6/site-packages/ansible/module_utils/compat/__init__.py
Using module_utils file /home/ansible/nornir/devel/lib64/python3.6/site-packages/ansible/module_utils/common/__init__.py
Using module_utils file /home/ansible/nornir/devel/lib64/python3.6/site-packages/ansible/module_utils/pycompat24.py
Using module_utils file /home/ansible/nornir/devel/lib64/python3.6/site-packages/ansible/module_utils/common/_collections_compat.py
Using module_utils file /home/ansible/nornir/devel/lib64/python3.6/site-packages/ansible/module_utils/common/text/__init__.py
Using module_utils file /home/ansible/nornir/devel/lib64/python3.6/site-packages/ansible/module_utils/compat/selectors.py
Using module_utils file /home/ansible/nornir/devel/lib64/python3.6/site-packages/ansible/module_utils/common/text/formatters.py
Using module_utils file /home/ansible/nornir/devel/lib64/python3.6/site-packages/ansible/module_utils/common/parameters.py
Using module_utils file /home/ansible/nornir/devel/lib64/python3.6/site-packages/ansible/module_utils/common/process.py
Using module_utils file /home/ansible/nornir/devel/lib64/python3.6/site-packages/ansible/module_utils/common/file.py
Using module_utils file /home/ansible/nornir/devel/lib64/python3.6/site-packages/ansible/module_utils/common/_utils.py
Using module_utils file /home/ansible/nornir/devel/lib64/python3.6/site-packages/ansible/module_utils/common/text/converters.py
Using module_utils file /home/ansible/nornir/devel/lib64/python3.6/site-packages/ansible/module_utils/common/collections.py
Using module_utils file /home/ansible/nornir/devel/lib64/python3.6/site-packages/ansible/module_utils/distro/__init__.py
Using module_utils file /home/ansible/nornir/devel/lib64/python3.6/site-packages/ansible/module_utils/distro/_distro.py
Using module_utils file /home/ansible/nornir/devel/lib64/python3.6/site-packages/ansible/module_utils/compat/_selectors2.py
Using module_utils file /home/ansible/nornir/devel/lib64/python3.6/site-packages/ansible/module_utils/urls.py
Using module file /home/ansible/.ansible/collections/ansible_collections/networktocode/nautobot/plugins/modules/rack.py
<127.0.0.1> PUT /home/ansible/.ansible/tmp/ansible-local-21877mpu9cgrx/tmp55bi8kuu TO /home/ansible/.ansible/tmp/ansible-tmp-1619499985.892657-21899-73879113294739/AnsiballZ_rack.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/ansible/.ansible/tmp/ansible-tmp-1619499985.892657-21899-73879113294739/ /home/ansible/.ansible/tmp/ansible-tmp-1619499985.892657-21899-73879113294739/AnsiballZ_rack.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/home/ansible/nornir/devel/bin/python /home/ansible/.ansible/tmp/ansible-tmp-1619499985.892657-21899-73879113294739/AnsiballZ_rack.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /home/ansible/.ansible/tmp/ansible-tmp-1619499985.892657-21899-73879113294739/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
  File "/home/ansible/.ansible/tmp/ansible-tmp-1619499985.892657-21899-73879113294739/AnsiballZ_rack.py", line 102, in <module>
    _ansiballz_main()
  File "/home/ansible/.ansible/tmp/ansible-tmp-1619499985.892657-21899-73879113294739/AnsiballZ_rack.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/ansible/.ansible/tmp/ansible-tmp-1619499985.892657-21899-73879113294739/AnsiballZ_rack.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible_collections.networktocode.nautobot.plugins.modules.rack', init_globals=None, run_name='__main__', alter_sys=True)
  File "/usr/lib64/python3.6/runpy.py", line 205, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib64/python3.6/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_networktocode.nautobot.rack_payload_afgaem29/ansible_networktocode.nautobot.rack_payload.zip/ansible_collections/networktocode/nautobot/plugins/modules/rack.py", line 285, in <module>
  File "/tmp/ansible_networktocode.nautobot.rack_payload_afgaem29/ansible_networktocode.nautobot.rack_payload.zip/ansible_collections/networktocode/nautobot/plugins/modules/rack.py", line 280, in main
  File "/tmp/ansible_networktocode.nautobot.rack_payload_afgaem29/ansible_networktocode.nautobot.rack_payload.zip/ansible_collections/networktocode/nautobot/plugins/module_utils/dcim.py", line 50, in __init__
  File "/tmp/ansible_networktocode.nautobot.rack_payload_afgaem29/ansible_networktocode.nautobot.rack_payload.zip/ansible_collections/networktocode/nautobot/plugins/module_utils/utils.py", line 480, in __init__
  File "/tmp/ansible_networktocode.nautobot.rack_payload_afgaem29/ansible_networktocode.nautobot.rack_payload.zip/ansible_collections/networktocode/nautobot/plugins/module_utils/utils.py", line 813, in _change_choices_id
  File "/tmp/ansible_networktocode.nautobot.rack_payload_afgaem29/ansible_networktocode.nautobot.rack_payload.zip/ansible_collections/networktocode/nautobot/plugins/module_utils/utils.py", line 790, in _fetch_choice_value
KeyError: 'display'
failed: [localhost] (item={'name': 'Rack-0-A-1', 'facility_id': 'Scharank-0-A-1_Serverraum_DEBE', 'desc_units': False, 'rack_group': 'rack-group-debedc0', 'site': 'site-debe', 'status': 'Active', 'tenant': 'tenant-debe', 'type': '4-post cabinet', 'u_height': 42, 'width': 19, 'comments': '### Schrank-0-A-1 Serverraum-Berlin\n\n**Wartung (IT)**\n'}) => {
    "ansible_loop_var": "item",
    "changed": false,
    "item": {
        "comments": "### Schrank-0-A-1 Serverraum-Berlin\n\n**Wartung (IT):**\n",
        "desc_units": false,
        "facility_id": "Scharank-0-A-1_Serverraum_DEBE",
        "name": "Rack-0-A-1",
        "rack_group": "rack-group-debedc0",
        "site": "site-debe",
        "status": "Active",
        "tenant": "tenant-debe",
        "type": "4-post cabinet",
        "u_height": 42,
        "width": 19
    },
    "rc": 1
}

MSG:

MODULE FAILURE
See stdout/stderr for the exact error


MODULE_STDERR:

Traceback (most recent call last):
  File "/home/ansible/.ansible/tmp/ansible-tmp-1619499985.892657-21899-73879113294739/AnsiballZ_rack.py", line 102, in <module>
    _ansiballz_main()
  File "/home/ansible/.ansible/tmp/ansible-tmp-1619499985.892657-21899-73879113294739/AnsiballZ_rack.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/ansible/.ansible/tmp/ansible-tmp-1619499985.892657-21899-73879113294739/AnsiballZ_rack.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible_collections.networktocode.nautobot.plugins.modules.rack', init_globals=None, run_name='__main__', alter_sys=True)
  File "/usr/lib64/python3.6/runpy.py", line 205, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib64/python3.6/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_networktocode.nautobot.rack_payload_afgaem29/ansible_networktocode.nautobot.rack_payload.zip/ansible_collections/networktocode/nautobot/plugins/modules/rack.py", line 285, in <module>
  File "/tmp/ansible_networktocode.nautobot.rack_payload_afgaem29/ansible_networktocode.nautobot.rack_payload.zip/ansible_collections/networktocode/nautobot/plugins/modules/rack.py", line 280, in main
  File "/tmp/ansible_networktocode.nautobot.rack_payload_afgaem29/ansible_networktocode.nautobot.rack_payload.zip/ansible_collections/networktocode/nautobot/plugins/module_utils/dcim.py", line 50, in __init__
  File "/tmp/ansible_networktocode.nautobot.rack_payload_afgaem29/ansible_networktocode.nautobot.rack_payload.zip/ansible_collections/networktocode/nautobot/plugins/module_utils/utils.py", line 480, in __init__
  File "/tmp/ansible_networktocode.nautobot.rack_payload_afgaem29/ansible_networktocode.nautobot.rack_payload.zip/ansible_collections/networktocode/nautobot/plugins/module_utils/utils.py", line 813, in _change_choices_id
  File "/tmp/ansible_networktocode.nautobot.rack_payload_afgaem29/ansible_networktocode.nautobot.rack_payload.zip/ansible_collections/networktocode/nautobot/plugins/module_utils/utils.py", line 790, in _fetch_choice_value
KeyError: 'display'

Add parent_tenant_group argument to tenant_group module

ISSUE TYPE
  • Feature Idea
SOFTWARE VERSIONS
pynautobot

1.0.2

Ansible:

2.10.12

Nautobot:

1.0.3

Collection:

3.0.0

SUMMARY

The tenant_group module does not currently allow for a parent_tenant_group argument (which is present in the corresponding Netbox module). The parent_tenant_group is useful to create hierarchies of tenant groups.

STEPS TO REPRODUCE

Try to create or update a tenant group, using the parent_tenant_group parameter.

    - name: Create our Tenant Groups in Nautobot
      networktocode.nautobot.tenant_group:
        description: "{{ item.description }}"
        name: "{{ item.name }}"
        # Parent Tenant Group is currently absent from the collection.
        parent_tenant_group: "{{ item.parent }}"
        token: "{{ nautobot_token }}"
        url: "{{ nautobot_url }}"
        state: present
        validate_certs: false
      loop: "{{ all_tenant_groups }}"
EXPECTED RESULTS

The tenant group to be added with the correct parent.

ACTUAL RESULTS
parent_tenant_group is not a supported parameter

networktocode.nautobot.device: fails to create device

ISSUE TYPE
  • Bug Report
SOFTWARE VERSIONS
pynautobot

pynautobot 1.0.2

Ansible:

2.10.9

Nautobot:

1.0.0

Collection:

2.0.0

SUMMARY

When creating a device I get a fatal error

STEPS TO REPRODUCE

Create a playbook to add a device to nautobot with just the required fields

---
- name: Load Nautobot
  connection: local
  hosts: localhost
  gather_facts: False

  vars:
    nb_url: "https://url"
    nb_token: "token"

  tasks:
  - name: Add Devices
    networktocode.nautobot.device:
      url: "{{ nb_url }}"
      token: "{{ nb_token }}"
      validate_certs: no
      data:
        name: "test"
        device_type: vios_router
        device_role: pod_router
        site: POD1
        # rack: "Pod1 Rack 1"
        # position: "42"
        # face: "front"
        status: active
      state: present
EXPECTED RESULTS

successfully create device in Nautobot

ACTUAL RESULTS
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "/home/Nautobot_Workshop/.venv/lib/python3.8/site-packages/urllib3/connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host '192.168.130.154'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n  warnings.warn(\n/home/Nautobot_Workshop/.venv/lib/python3.8/site-packages/urllib3/connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host '192.168.130.154'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n  warnings.warn(\nTraceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1620309142.3523946-8967-17244935240413/AnsiballZ_device.py\", line 102, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1620309142.3523946-8967-17244935240413/AnsiballZ_device.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1620309142.3523946-8967-17244935240413/AnsiballZ_device.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.networktocode.nautobot.plugins.modules.device', init_globals=None, run_name='__main__', alter_sys=True)\n  File \"/usr/lib/python3.8/runpy.py\", line 207, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib/python3.8/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib/python3.8/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_networktocode.nautobot.device_payload_2axsi40t/ansible_networktocode.nautobot.device_payload.zip/ansible_collections/networktocode/nautobot/plugins/modules/device.py\", line 331, in <module>\n  File \"/tmp/ansible_networktocode.nautobot.device_payload_2axsi40t/ansible_networktocode.nautobot.device_payload.zip/ansible_collections/networktocode/nautobot/plugins/modules/device.py\", line 326, in main\n  File \"/tmp/ansible_networktocode.nautobot.device_payload_2axsi40t/ansible_networktocode.nautobot.device_payload.zip/ansible_collections/networktocode/nautobot/plugins/module_utils/dcim.py\", line 50, in __init__\n  File \"/tmp/ansible_networktocode.nautobot.device_payload_2axsi40t/ansible_networktocode.nautobot.device_payload.zip/ansible_collections/networktocode/nautobot/plugins/module_utils/utils.py\", line 480, in __init__\n  File \"/tmp/ansible_networktocode.nautobot.device_payload_2axsi40t/ansible_networktocode.nautobot.device_payload.zip/ansible_collections/networktocode/nautobot/plugins/module_utils/utils.py\", line 811, in _change_choices_id\n  File \"/tmp/ansible_networktocode.nautobot.device_payload_2axsi40t/ansible_networktocode.nautobot.device_payload.zip/ansible_collections/networktocode/nautobot/plugins/module_utils/utils.py\", line 788, in _fetch_choice_value\nKeyError: 'display'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
ansible-playbook nb.create_devices.yaml

GraphQL Action Plugin for data population

ISSUE TYPE
  • Feature Idea
SOFTWARE VERSIONS

N/A

pynautobot

N/A

Ansible:

N/A

Nautobot:

1.0

Collection:

N/A

SUMMARY

Suggesting the introduction of a GraphQL action plugin that populates the data per device.

STEPS TO REPRODUCE

N/A

EXPECTED RESULTS

There are potentially severe performance penalties from gathering all data at inventory invocation from Nautobot. Luckily Ansible provides an alternative queuing process, in which data can be gathered per device. Traditionally at NTC we have built custom action plugins to gather data as the first task in a playbook. This worked well, and fit the specific use cases, but resulted in N number of action plugins being built. With the introduction of GraphQL to the core platform, in theory a single action plugin can be added to the collection which takes a query parameter and can solve all the same use cases that previously required N number of action plugins.

ACTUAL RESULTS

N/A

Ansible Version Requirements

ISSUE TYPE
  • Documentation update
SOFTWARE VERSIONS
pynautobot
1.0.2
Ansible:
2.10.12
Nautobot:
1.1.0
Collection:
SUMMARY

Documentation is unclear on ansible version requirements currently ansible <= 2.10 is required.

Error creating ipv6 address

ISSUE TYPE
  • Bug Report
  • Feature Idea
  • Module question
  • Module creation help
  • Documentation update
SOFTWARE VERSIONS
pynautobot

1.0.2

Ansible:

2.10.7

Nautobot:

1.0.1

Collection:
SUMMARY

We are trying to create an ipv6 address in nautobot using nautobot-ansible, but every time we get the error message that it could not be created because of the value seems to be exceeded.
The creation of an ipv4 address works this way.

STEPS TO REPRODUCE
    - name: "15 - SETUP IP_ADDRESSES v6"
      networktocode.nautobot.ip_address:
        url: "{{ lookup('env', 'NAUTOBOT_URL') }}"
        token: "{{ lookup('env', 'NAUTOBOT_TOKEN') }}"
        data:
          address: "{{ data['primary_ip6'] }}"
          assigned_object:
            virtual_machine: "{{ data['name'] }}"
            name: ens18
          tenant: "{{ data['tenant'] }}"
          status: active
        state: present
        validate_certs: False
      loop: "{{ datas }}"
      loop_control:
        loop_var: data
        label: "{{ data['name'] }}"
EXPECTED RESULTS
ACTUAL RESULTS
The full traceback is:
  File "/tmp/ansible_networktocode.nautobot.ip_address_payload_zexlua7h/ansible_networktocode.nautobot.ip_address_payload.zip/ansible_collections/networktocode/nautobot/plugins/module_utils/utils.py", line 965, in _create_object
    nb_obj = nb_endpoint.create(data)
  File "/opt/ansible/lib/python3.8/site-packages/pynautobot/core/endpoint.py", line 271, in create
    req = Request(base=self.url, token=self.token, http_session=self.api.http_session,).post(
  File "/opt/ansible/lib/python3.8/site-packages/pynautobot/core/query.py", line 324, in post
    return self._make_call(verb="post", data=data)
  File "/opt/ansible/lib/python3.8/site-packages/pynautobot/core/query.py", line 226, in _make_call
    raise RequestError(req)
failed: [localhost] (item=e.example.com) => {
    "ansible_loop_var": "data",
    "changed": false,
    "data": {
        "cluster": "xy",
        "internal_ip4": "192.168.100.93",
        "name": "e.example.com",
        "primary_ip4": "1.2.3.4",
        "primary_ip6": "2c03:4f9d4b:41t2:312::2"",
        "status": "active",
        "tenant": "asdf",
        "virtual_machine_role": "servers"
    },
    "invocation": {
        "module_args": {
            "data": {
                "address": "2c03:4f9d4b:41t2:312::2",
                "assigned_object": {
                    "device": null,
                    "name": "ens18",
                    "virtual_machine": "e.example.com"
                },
                "custom_fields": null,
                "description": null,
                "dns_name": null,
                "family": null,
                "nat_inside": null,
                "prefix": null,
                "role": null,
                "status": "active",
                "tags": null,
                "tenant": "asdf",
                "vrf": null
            },
            "query_params": null,
            "state": "present",
            "token": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "url": "https://example.com",
            "validate_certs": false
        }
    },
    "msg": "{\"host\":[\"Ensure this value has at most 16 characters (it has 23).\"],\"broadcast\":[\"Ensure this value has at most 16 characters (it has 23).\"]}"

Fails to resolve ids from names when slug is not 1:1 match

ISSUE TYPE
  • Bug Report
SOFTWARE VERSIONS
pynautobot
1.0.2
Ansible:
2.10.12
Nautobot:
1.1.0
Collection:
SUMMARY

When specifying a device type or site (I assume others as well) if the Name doesn't directly correspond to the slug it fails to resolve.

STEPS TO REPRODUCE
  1. Create a site with name New York City and slug nyc
  2. Try to create a device in that site with:
- name: "Configure a device in Nautobot"
      networktocode.nautobot.device:
        data:
          name: "asdf"
          device_type: "asdf"
          device_role: "Router"
          site: "New York City"
          status: "Inventory"
        state: present
EXPECTED RESULTS

Device Created

ACTUAL RESULTS

Site name fails to resolve:

fatal: [localhost]: FAILED! => {"changed": false, "msg": "Could not resolve id of site: new-york-city"}

unexpected keyword argument 'private_key_file'

ISSUE TYPE
  • Bug Report
SOFTWARE VERSIONS
pynautobot

1.0.1

Ansible:

2.10.4

Nautobot:

v1.0.0b1 (developer branch from github 2021-03-08)

Collection:
Collection             Version
---------------------- -------
ansible.netcommon      1.4.1
ansible.posix          1.1.1
community.general      1.3.4
community.kubernetes   1.1.1
community.mysql        1.1.0
google.cloud           1.0.1
netbox.netbox          2.0.0
networktocode.nautobot 1.0.1
SUMMARY

I'm trying to convert a playbook that works fine using NetBox and the NetBox Ansible module to Nautobot. The data has successfully been migrated from NetBox to Nautobot. The playbook uses a lookup in a task which yields and "unexpected keyword" error.

STEPS TO REPRODUCE
- name: Query Nautobot for virtual chassis host information
  set_fact:
    tmp_nautobot_host_info: "{{ query('networktocode.nautobot.lookup', 'devices', api_filter='name__isw=' + inventory_hostname_short + '/', api_endpoint=nautobot.url, token=nautobot.token) }}"
EXPECTED RESULTS

The lookup should simply find all devices that contain the short inventory hostname + "/" and write them to tmp_nautobot_host_info.

ACTUAL RESULTS
fatal: [XXXXXXXX]: FAILED! => {}

MSG:

An unhandled exception occurred while running the lookup plugin 'networktocode.nautobot.lookup'. Error was a <class 'TypeError'>, original message: __init__() got an unexpected keyword argument 'private_key_file'

Mark (some ?) Nautobot variables/inputs as unsafe

ISSUE TYPE
  • Bug Report
  • Feature Idea
SOFTWARE VERSIONS
pynautobot

1.0.3

Ansible:

2.11.6

Nautobot:

1.1.4

Collection:

v3.1.0

SUMMARY

When using Jinja2 tags in some fields imported from Nautobot (like a config context), Ansible will try to template the string which is likely to fail (and may have security implications if you put something like a lookup).

Maybe this is an Ansible bug (or feature, it seems Ansible' inventory plugins are not doing any value sanitization, but I'm not sure this should be the default). in that case maybe this could be an option (enabled by default) in this plugin?

STEPS TO REPRODUCE
  • Create a config context like:
{"my_var": "{{ hi_ansible }}"}
  • Use this config context in some playbook like below
- hosts: all
  tasks:
    # Ok for some reason ..
    - ansible.builtin.debug:
        msg: "{{ hostvars[inventory_hostname].config_context.my_var }}"
      run_once: true
      delegate_to: localhost

    # All of them will fail
    - ansible.builtin.debug:
        msg: "{{ config_context.my_var }}"
        # msg: "{{ lookup('list', [config_context.my_var]) }}"
        # msg: "{{ lookup('list', [hostvars[inventory_hostname].config_context.my_var]) }}"
      run_once: true
      delegate_to: localhost
    
    # ->"The task includes an option with an undefined variable. The error was: {[..]}: 'hi_ansible' is undefined"
EXPECTED RESULTS
ok: [my_host -> localhost] => {
    "msg": "{{ hi_ansible }}"
}
ACTUAL RESULTS
"The task includes an option with an undefined variable. The error was: {[..]}: 'hi_ansible' is undefined"
Additional informations

This can be patched by importing from ansible.utils.unsafe_proxy import wrap_var and wrapping values at https://github.com/nautobot/nautobot-ansible/blob/v3.1.0/plugins/inventory/inventory.py#L1409-L1412.

While I checked the changelog before posting this, I couldn't test with a newer version, sorry.

Add support for Nautobot REST API versioning in nautobot-ansible

ISSUE TYPE
  • Feature Idea
SUMMARY

Once nautobot/pynautobot#35 is implemented, nautobot-ansible needs to expose a way to select a Nautobot REST API version for a given module usage. Most likely this would take the form of an optional api_version argument added to the NautobotModule base class?

Additional references and information:

Create `nautobot-server` module

ISSUE TYPE
  • Feature Idea
SOFTWARE VERSIONS
pynautobot

N/A

Ansible:

2.11.1

Nautobot:

1.0.2

Collection:

Nautobot Ansible Collection

SUMMARY

Would like to have a module that will manage the application install, so add networktocode.nautobot.nautobot_server as a module to execute nautobot-server commands on the host.

STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.