How to add trusted fact extension to inventory
greyhair-atx opened this issue · 0 comments
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