ansible_modules icon indicating copy to clipboard operation
ansible_modules copied to clipboard

Add prefix string to groups and hostvars output by nb_inventory plugin

Open h3po opened this issue 2 years ago • 3 comments

Related Issue

#959

New Behavior

Adds new boolean parameters group_names_prefix and host_vars_prefix to the inventory plugin to add the string prefix "netbox_" to group names and hostvars, so for example "role_switch" becomes "netbox_role_switch" and "primary_ipv4" becomes "netbox_primary_ipv4".

Contrast to Current Behavior

Currently the inventory plugin does not prefix its group and hostvars names, potentially creating name collisions when used in conjunction with static inventory

Discussion: Benefits and Drawbacks

Benefit: Users can optionally enable the prefix. By having it disabled by default, the change is backwards compatible with existing configs. Drawbacks: None

Changes to the Documentation

Documentation for the new parameters are included in the PR.

Proposed Release Note Entry

Added parameters group_names_prefix and host_vars_prefix to the inventory plugin

Double Check

  • [x] I have read the comments and followed the CONTRIBUTING.md.
  • [x] I have explained my PR according to the information in the comments or in a linked issue.
  • [x] My PR targets the devel branch.

I have read the contributing guidelines, but unit tests are currently missing, as I can not get them to run locally. @sc68cal told me to create a pull request anyway.

h3po avatar Apr 19 '23 09:04 h3po

@sc68cal you requested that i open this pull request to have it ci tested, but the pipeline failed due to unrelated issues. I don't know how to retrigger it

h3po avatar Aug 08 '23 14:08 h3po

I tried browsing around for a way to re-run the checks, but couldn't find it. Since this PR is outdated, please merge from master and re-push, and that will re-trigger

sc68cal avatar Aug 09 '23 15:08 sc68cal

I corrected a mistake in the PR description above: the options are boolean parameters, adding a fixed prefix of "netbox_". Not string parameters.

h3po avatar Aug 30 '23 11:08 h3po