From d46c187470064c00053513ce56aab7a8a06692e7 Mon Sep 17 00:00:00 2001 From: Sander Steffann Date: Fri, 14 Jun 2019 06:29:47 +0200 Subject: [PATCH] netbox: inventory: fix implementation of groups option (#57689) (cherry picked from commit 71a704cc14dcbffa08c5d805b47c3fd49928ef46) --- changelogs/fragments/57688-netbox-groups.yaml | 2 ++ lib/ansible/plugins/inventory/netbox.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/57688-netbox-groups.yaml diff --git a/changelogs/fragments/57688-netbox-groups.yaml b/changelogs/fragments/57688-netbox-groups.yaml new file mode 100644 index 0000000000..864ddb7f6e --- /dev/null +++ b/changelogs/fragments/57688-netbox-groups.yaml @@ -0,0 +1,2 @@ +bugfixes: + - netbox - Fix missing implementation of `groups` option (https://github.com/ansible/ansible/issues/57688) diff --git a/lib/ansible/plugins/inventory/netbox.py b/lib/ansible/plugins/inventory/netbox.py index 9de0b9738c..f6d7c4622c 100644 --- a/lib/ansible/plugins/inventory/netbox.py +++ b/lib/ansible/plugins/inventory/netbox.py @@ -434,8 +434,9 @@ class InventoryModule(BaseInventoryPlugin, Constructable): # Composed variables self._set_composite_vars(self.get_option('compose'), host, hostname, strict=strict) + # Complex groups based on jinja2 conditionals, hosts that meet the conditional are added to group - self._set_composite_vars(self.get_option('compose'), host, hostname, strict=strict) + self._add_host_to_composed_groups(self.get_option('groups'), host, hostname, strict=strict) # Create groups based on variable values and add the corresponding hosts to it self._add_host_to_keyed_groups(self.get_option('keyed_groups'), host, hostname, strict=strict)