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

How to add trusted fact extension to inventory #794

Open
greyhair-atx opened this issue Mar 5, 2023 · 0 comments
Open

How to add trusted fact extension to inventory #794

greyhair-atx opened this issue Mar 5, 2023 · 0 comments

Comments

@greyhair-atx
Copy link

greyhair-atx commented Mar 5, 2023

I'm trying to add a trusted fact to the inventory page. As an example, I want "pp_role" to show on the inventory page.
Output from the "facts" page
trusted :
{
"domain": "example.org",
"certname": "test.server.example.org",
"external": {},
"hostname": "test",
"extensions": {
"pp_role": "server",

being clueless I've tried adding the following in the "settings.py" section:

INVENTORY_FACTS =
...,
('Role', 'role'),
...,
INVENTORY_FACT_TEMPLATES =
...,
'role': "{{ value.trusted['extensions']['pp_role'] }}",
...,

Other things i've tried:
'role': "{{ value.trusted.extensions.pp_role' }}",
'role': "{{ value.pp_role' }}",

Any advice/help/Guidance is appreciated.

EDIT: whoops corrected for 'role"

I added:
INVENTORY_FACTS = [('Hostname', 'trusted'),
...,
('Role', 'trusted'),
...,
INVENTORY_FACT_TEMPLATES =
'trusted': (
...,
"""{{value.hostname}}"""
...,
'trusted': "{{ value.extensions.pp_role }}",

Now both "hostname and role" have the same value -> the role value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant