Skip to content

[Bug]: Cannot add contact_group to contact #1182

@renekrieg

Description

@renekrieg

Ansible NetBox Collection version

v3.16.0

Ansible version

ansible [core 2.16.3]
  config file = /Users/renekrieg/playground/private/own-projects/homelab-network/configuration/netbox/ansible/ansible.cfg
  configured module search path = ['/Users/renekrieg/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/renekrieg/playground/private/own-projects/homelab-network/configuration/netbox/ansible/.venv/lib/python3.11/site-packages/ansible
  ansible collection location = /Users/renekrieg/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/renekrieg/playground/private/own-projects/homelab-network/configuration/netbox/ansible/.venv/bin/ansible
  python version = 3.11.7 (main, Dec  4 2023, 18:10:11) [Clang 15.0.0 (clang-1500.1.0.2.5)] (/Users/renekrieg/playground/private/own-projects/homelab-network/configuration/netbox/ansible/.venv/bin/python3)
  jinja version = 3.1.3
  libyaml = True

NetBox version

v3.7.2

Python version

3.11

Steps to Reproduce

The following playbook is expected to create a new contact "test" and assign the contact to the contact_group "Administrator".

---
- name: Create Contacts within NetBox
  netbox.netbox.netbox_contact:
    netbox_url: "{{ lookup('ansible.builtin.env', 'NETBOX_API') }}"
    netbox_token: "{{ lookup('ansible.builtin.env', 'NETBOX_TOKEN') }}"
    data: 
      name: test
      contact_group: Administrator
    state: present

Expected Behavior

Contact "test" should be assigned to Group "Administrator".

Observed Behavior

Netbox API throws this error:
image

PLAY [PLAY 2 - Create Contact Groups] ****************************************************************************************************************************************************************************************************************************************************

TASK [create_contact_groups : Create Contact Groups within NetBox] ***********************************************************************************************************************************************************************************************************************
changed: [localhost] => (item=Administrator)
changed: [localhost] => (item=Customer)

PLAY [PLAY 3 - Create Contacts] **********************************************************************************************************************************************************************************************************************************************************

TASK [create_contacts : Create Contacts within NetBox] ***********************************************************************************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "{\"group_id\":[\"“group” is not a valid value.\"]}"}

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions