netbox-community / ansible_modules

NetBox modules for Ansible using Ansible Collections
GNU General Public License v3.0
305 stars 198 forks source link

[Bug]: Netbox inventory services data variable name interfere with ansible builtin service_facts #1272

Open a-haurylau opened 2 weeks ago

a-haurylau commented 2 weeks ago

Ansible NetBox Collection version

v3.17.0

Ansible version

2.15.10

NetBox version

v3.7.8

Python version

3.9

Steps to Reproduce

Just enable fact cache and perform host service data gathering with ansible as stated here https://docs.ansible.com/ansible/latest/collections/ansible/builtin/service_facts_module.html

- name: Gather the service facts
  ansible.builtin.service_facts:

This one stores in fact cache all service data in 'services' dict. But in the same way netbox inventory stores service data from netbox in same 'services' list. So it means that you cannot use fact cache for host services and service data from netbox in same time.

Expected Behavior

Instead of 'services' variable netbox inventory should put data to lets say 'netbox_services' or better, as stated here https://ansible.readthedocs.io/projects/lint/rules/var-naming/ -

var-naming[no-reserved]: Variables names must not be Ansible reserved names.
var-naming[no-role-prefix]: Variables names from within roles should use role_name_ as a prefix. Underlines are accepted before the prefix.

Observed Behavior

'services' dict from fact cache used instead 'services' list from host vars