Open Atoms opened 2 years ago
v3.6.0
ansible [core 2.12.4] config file = /home/asterns/projects/ansible/ansible.cfg configured module search path = ['/home/asterns/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /home/asterns/projects/ansible/.env/lib/python3.8/site-packages/ansible ansible collection location = /home/asterns/.ansible/collections:/usr/share/ansible/collections executable location = /home/asterns/projects/ansible/.env/bin/ansible python version = 3.8.10 (default, Mar 15 2022, 12:22:08) [GCC 9.4.0] jinja version = 3.1.1 libyaml = True
v3.1.9
3.8
Create 2 virtual servers and then create interfaces for those servers that are the same on both servers.
- hosts: "localhost" connection: local vars: netbox_url: "https://netbox.url/" netbox_token: "xxxxxxxxxxxxxxx" tasks: - name: Create virtual machine netbox.netbox.netbox_virtual_machine: netbox_url: "{{ netbox_url }}" netbox_token: "{{ netbox_token }}" data: name: "vm1" cluster: "cluster01" site: "zzz" virtual_machine_role: "Virtual Server" state: present - name: "Create VM1 interface enp1s0 " netbox.netbox.netbox_vm_interface: netbox_url: "{{ netbox_url }}" netbox_token: "{{ netbox_token }}" data: virtual_machine: "vm1" name: "enp1s0" enabled: true mode: Access state: present - name: Create VLAN interface enp1s0.72 netbox.netbox.netbox_vm_interface: netbox_url: "{{ netbox_url }}" netbox_token: "{{ netbox_token }}" data: virtual_machine: "vm1" name: "enp1s0.72" enabled: true parent_vm_interface: "enp1s0" tagged_vlans: - site: "zzz" vid: "72" mode: Tagged state: present - name: Create virtual machine netbox.netbox.netbox_virtual_machine: netbox_url: "{{ netbox_url }}" netbox_token: "{{ netbox_token }}" data: name: "vm2" cluster: "cluster01" site: "zzz" virtual_machine_role: "Virtual Server" state: present - name: "Create VM2 interface enp1s0 " netbox.netbox.netbox_vm_interface: netbox_url: "{{ netbox_url }}" netbox_token: "{{ netbox_token }}" data: virtual_machine: "vm2" name: "enp1s0" enabled: true mode: Access state: present - name: Create VLAN interface enp1s0.72 netbox.netbox.netbox_vm_interface: netbox_url: "{{ netbox_url }}" netbox_token: "{{ netbox_token }}" data: virtual_machine: "vm2" name: "enp1s0.72" enabled: true parent_vm_interface: "enp1s0" tagged_vlans: - site: "zzz" vid: "72" mode: Tagged state: present
2 virtual machines created both with 2 interfaces enp1s0 and enp1s0.72
$ ansible-playbook test.yaml PLAY [localhost] *********************************************************************************************************************************************************************************************************************************************************************** TASK [Gathering Facts] ***************************************************************************************************************************************************************************************************************************************************************** ok: [localhost] TASK [Create virtual machine] ********************************************************************************************************************************************************************************************************************************************************** changed: [localhost] TASK [Create VM1 interface enp1s0] ***************************************************************************************************************************************************************************************************************************************************** changed: [localhost] TASK [Create VLAN interface enp1s0.72] ************************************************************************************************************************************************************************************************************************************************* changed: [localhost] TASK [Create virtual machine] ********************************************************************************************************************************************************************************************************************************************************** changed: [localhost] TASK [Create VM1 interface enp1s0] ***************************************************************************************************************************************************************************************************************************************************** changed: [localhost] TASK [Create VLAN interface enp1s0.72] ************************************************************************************************************************************************************************************************************************************************* fatal: [localhost]: FAILED! => changed=false msg: More than one result returned for parent_vm_interface PLAY RECAP ***************************************************************************************************************************************************************************************************************************************************************************** localhost : ok=6 changed=5 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
seems this is specific to virtual machines only, as it's working for devices.
any updates ?
Can confirm the issue, maybe the check should be only on interfaces within the same virtual machine?
Ansible NetBox Collection version
v3.6.0
Ansible version
NetBox version
v3.1.9
Python version
3.8
Steps to Reproduce
Create 2 virtual servers and then create interfaces for those servers that are the same on both servers.
Expected Behavior
2 virtual machines created both with 2 interfaces enp1s0 and enp1s0.72
Observed Behavior
seems this is specific to virtual machines only, as it's working for devices.