Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Imprv] add functionality constructed to module inventory #235

Closed
peshay opened this issue Jul 12, 2022 · 2 comments · Fixed by #233
Closed

[Imprv] add functionality constructed to module inventory #235

peshay opened this issue Jul 12, 2022 · 2 comments · Fixed by #233
Assignees
Labels
1.7 enhancement New feature or request
Projects

Comments

@peshay
Copy link
Contributor

peshay commented Jul 12, 2022

Describe the request
Enable Constructed Features for the inventory plugin

Current behaviour
There is no way to create additional groups from the inventory plugin.

Expected behaviour
Add constructed functionality to the plugin, so it is possible to create additional vars and groups based on Jinja2.

For example

plugin: nutanix.ncp.ntnx_prism_vm_inventory
groups:
  nutanix: true
keyed_groups:
  # group for customer name
  - prefix: ""
    separator: ''
    key: "inventory_hostname | regex_replace('([a-zA-Z0-9]+)-([a-zA-Z0-9]+)-([a-zA-Z0-9]+)', '\\1')"
  # group for service name
  - prefix: ""
    separator: ''
    key: "inventory_hostname | regex_replace('([a-zA-Z0-9]+)-([a-zA-Z0-9]+)-([a-zA-Z]+)[0-9]*', '\\3')"
  # group for environemnt name
  - prefix: ""
    separator: ''
    key: "inventory_hostname | regex_replace('([a-zA-Z0-9]+)-([a-zA-Z0-9]+)-([a-zA-Z0-9]+)', '\\2')"
  # group for customer environemnt name
  - prefix: ""
    separator: ''
    key: "inventory_hostname | regex_replace('([a-zA-Z0-9]+)-([a-zA-Z0-9]+)-([a-zA-Z0-9]+)', '\\1_\\2')"

Here is a pull request to add the requested functionality: #232

@bhati-pradeep
Copy link
Collaborator

@peshay I am looking into it. One use-case enhancement we need to add more here is the grouping using categories of vm.

@bhati-pradeep
Copy link
Collaborator

Released in v1.7.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.7 enhancement New feature or request
Projects
No open projects
1.7.0
  
Done
Development

Successfully merging a pull request may close this issue.

5 participants