Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions plugins/inventory/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
default: []
type: list
tags:
description: Populate inventory only with instances which have at least one of the tags listed here.
description: Populate inventory only with instances which have at least one of the linode tags listed here.
default: []
type: list
types:
Expand All @@ -75,13 +75,13 @@
plugin: linode.cloud.instance
api_token: foobar
keyed_groups:
- key: tags
- key: linode_tags
separator: ''
- key: region
prefix: region
groups:
webservers: "'web' in (tags|list)"
mailservers: "'mail' in (tags|list)"
webservers: "'web' in linode_tags"
mailservers: "'mail' in linode_tags"
Comment on lines +83 to +84
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updated group filter expressions assume linode_tags is a list, but they don't use the |list filter that was present in the original code. This could cause issues if linode_tags is not already a list type. Consider adding |list filter to maintain consistency with the original logic: 'web' in (linode_tags|list)

Suggested change
webservers: "'web' in linode_tags"
mailservers: "'mail' in linode_tags"
webservers: "'web' in (linode_tags|list)"
mailservers: "'mail' in (linode_tags|list)"

Copilot uses AI. Check for mistakes.
compose:
ansible_port: 2222
"""
Expand Down Expand Up @@ -214,6 +214,12 @@ def _add_hostvars_for_instances(self) -> None:
hostvars.update(instance._raw_json)
hostvars["networking_info"] = instance.ips.dict

# Fix #744 - Rename 'tags' to circumvent collision
# between linode tags and ansible tags, and avoid Ansible
# reserved word warning.
if 'tags' in hostvars:
hostvars['linode_tags'] = hostvars.pop('tags')

for hostvar_key in hostvars:
self.inventory.set_variable(
instance.label, hostvar_key, hostvars[hostvar_key]
Expand Down