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

Add now inventory vars column option #358

Open
miyuk opened this issue May 14, 2024 · 1 comment
Open

Add now inventory vars column option #358

miyuk opened this issue May 14, 2024 · 1 comment
Labels
type/enhancement New feature or request wontfix This will not be worked on

Comments

@miyuk
Copy link

miyuk commented May 14, 2024

SUMMARY

Add vars_column option for now inventory plugin for defining host_vars.

I want to realize the feature like a NetBox Inventory plugin config_context.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

servicenow.itsm.now

ADDITIONAL INFORMATION

As a promise, defined u_host_vars string column in ServiceNow.
(maybe this column is as customed one)
u_host_vars column contains host_vars data formatted JSON string.

inventory plugin will get this column, and parse JSON and flatten variables.

now.yml
---
plugin: servicenow.itsm.now
vars_column: u_host_vars
~~~
api
{
  "name": "XXXX",
  "u_host_vars": "{\"ansible_network_os\": \"cisco.ios\", \"ansible_connection\": \"network_cli\"}"
}
rendered inventory
all:
  hosts:
    XXXX:
      ansible_network_os: cisco.ios
      ansible_connection: network_cli
@tupyy tupyy added the type/enhancement New feature or request label May 15, 2024
@mhjacks
Copy link
Collaborator

mhjacks commented Jul 1, 2024

We've discussed this a fair bit internally, and we are inclined not to do this. The main reason for this is that SNOW already supports the idea of adding multiple configuration columns, and we support using multiple configuration columns to the inventory this way.

Meanwhile, embedding JSON in a column this way would be fragile. What should happen, for example, if invalid JSON is stored in the column? Should that host be excluded from inventory? Should inventory fail overall? Further, the JSON support would could provide would be limited to a single level of nesting.

We'll leave this open for a bit if you have more feedback, especially if we have misunderstood the intent here or you think we have missed something.

@mhjacks mhjacks added the wontfix This will not be worked on label Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants