Leveraging keyed_groups, config context and multi-level arrays with nb_inventory #1198
Unanswered
td-raystevens
asked this question in
Q&A
Replies: 1 comment 7 replies
-
I think it is probably best to investigate the |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We currently use netbox and would like to manage this through Ansible automation platform, leveraging the nb_inventory plugin.
There are concerns about using the currently available options under group_by due to the likely complexity of the tagging structure and the responsible team would like instead, to use the config context option to store the relevant host information.
I have tried in a variety of ways to leverage this but without much success and at this point, i'm not sure it's possible.
Where i'm at so far is using keyed_groups:
but this has the obvious flaw that it can only reference the first object in the array for both the groups and which hosts end up in said groups.
i.e.
Would create two groups,
new_var_value_A
andnew_var_value_B
and each would only have one host in each even though both have those values in their array because it's the first object in the listThe goal would be to iterate through layer_two and create as many groups as exist for the values of name (in this case, three groups) then assign the host to each group which is applicable,
new_var_value_A
(two hosts)new_var_value_B
(two hosts) andnew_var_value_C
(one host)I've tried a few different options, none of which produce any results at all
Does anyone have an alternative approach i've missed?
We need something that does the equivalent of
Beta Was this translation helpful? Give feedback.
All reactions