Skip to content

Capability to NOT group by all defined tags #98

@Sneedes

Description

@Sneedes

Using the oracle.oci.oci inventory plugin.
Perhaps it's my usage/implementation, but the default Group by defined tags in the code is undesired.

For example...if I comment out lines 959-971 in oci/plugins/inventory/oci.py, I get my desired functionality. I have OCI compute instances that have many namespace tags that I don't necessarily want to see nor group on within my Ansible inventory.

Is there any way functionality can be added so that my inventory will NOT group on EVERY defined tags?
Such as a default/boolean switch to skip this Group by defined tags code block?

            # Group by defined tags
            if hasattr(instance, "defined_tags") and instance.defined_tags:
                for namespace in instance.defined_tags:
                    for key in instance.defined_tags[namespace]:
                        defined_tag_group_name = self.sanitize(
                            namespace
                            + "#"
                            + key
                            + "="
                            + instance.defined_tags[namespace][key]
                        )
                        common_groups.add(defined_tag_group_name)

For example...the default Oracle tags such as CreatedOn have no value for me in an Ansible inventory.

|--@Oracle_Tags#CreatedOn=2021-07-20T23_19_25.865Z:

Additionally, my team has some inventory/processes/workflow items that dislike seeing the "#" character in the group name. Don't know the exact details, but stating the "#" character in the group name is breaking some stuff. Removing the automatic groups of each and every key pair from every tag namespace should remediate this for us.

Please advise what additional information I can provide to assist.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions