Open
Description
Ansible NetBox Collection version
3.7.1
Ansible version
ansible [core 2.12.7]
config file = /builds/it/fortigates/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.10/site-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.10.4 (main, Apr 30 2022, 16:49:16) [GCC 11.2.1 20220219]
jinja version = 3.1.2
libyaml = True
NetBox version
v3.2.2
Python version
3.10
Steps to Reproduce
- name: Reproduce bug
netbox.netbox.netbox_site:
netbox_url: '{{ netbox_url }}'
netbox_token: '{{ netbox_token }}'
state: present
data:
name: '{{ item }}'
tags: [FortiGate-Sync]
loop:
- Königliches Rechenzentrum
- Skåne
- Keep an eye on this site 👀
Expected Behavior
The three site names should be "slugified" to:
- knigliches-rechenzentrum
- skne
- keep-an-eye-on-this-site
Observed Behavior
The task fails all site names with "umlauts" and creates the site with the emoji, but with a different slug than what the Netbox UI would use:
TASK [Reproduce slugification bug] ************************************************************************************
failed: [localhost] (item=Königliches Rechenzentrum) => changed=false
ansible_loop_var: item
item: Königliches Rechenzentrum
msg: '{"slug":["Enter a valid \"slug\" consisting of letters, numbers, underscores or hyphens."]}'
failed: [localhost] (item=Skåne) => changed=false
ansible_loop_var: item
item: Skåne
msg: '{"slug":["Enter a valid \"slug\" consisting of letters, numbers, underscores or hyphens."]}'
changed: [localhost] => (item=Keep an eye on this site 👀)
Netbox 3.2.2 UI slug for the last site:
What the netbox_site ansible action created (note the trailing hyphen):
I've prepared a PR to fix both of these issues (umlauts causing an error and emojis producing a trailing slash)