# merge/override variable from devices\_role and tags variable file with netbox 

**URL:** <https://forum.ansible.com/t/merge-override-variable-from-devices-role-and-tags-variable-file-with-netbox/8734>\
**Category:** Get Help\
**Tags:** playbook, netbox\
**Created:** [September 24, 2024, 5:16pm UTC](https://forum.ansible.com/t/merge-override-variable-from-devices-role-and-tags-variable-file-with-netbox/8734 "2024-09-24T17:16:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![PoPz57](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/popz57/32/4858_2.png) [@PoPz57](https://forum.ansible.com/u/PoPz57)\
**Post date:** [September 24, 2024, 5:16pm UTC](https://forum.ansible.com/t/merge-override-variable-from-devices-role-and-tags-variable-file-with-netbox/8734/1 "2024-09-24T17:16:12Z")

</div>

Hi All,

im getting confused with the usage of dynamic inventories with netbox.

I had a playbook which is execute on server with a specific role:  
ex:

```auto
- name: server_monit
  hosts: device_roles_server_monit
  roles:
    - role: role0
      tags: [role0]
    - role: role1
    - role: role2
      when: is_role_2 is defined

```

The variable is\_role\_2 is defined in tags\_role\_2 file in group\_vars and there is a device\_roles\_server\_monit in groups\_vars as well.

But when i tag my server with role\_2 in netbox, ansible didnt run the playbook and output an empty inventory. it didnt take in count the device\_roles.

i tought there were a precedence with device\_role before tags variable and just merge variable if both are retrieve from netbox.

Where im wrong ?
