How to check settings

I’m not sure this is the right place for it, I’m also looking at the doc site and we have some of this there, but not all.

There are many cases in which people report ‘X’ is not working event though I configured/set/pass this option, 95% of cases this is due to a conflicting setting with higher precedence.

  • The CLI tool ansible-config dump -t all --only-changed , this will dump the configuration for ‘base and all plugins’, but only those items that are not using defaults. and you can even grep for your the exact key |grep DEFAULT_BECOME
  • The config lookup, this is useful as it will also pick up more of the in task context {{ q("config", "DEFAULT_BECOME", show_origin=True)}}
  • The ‘vars’ and ‘varnames’ lookups, which will add the most details variable context {{ q("varnames", "ansible_become", "ansible_sudo")) }} will tell us if they are set and {{ q("vars", "ansible_become", "ansible_sudo") }} will tell us their values.

A common pattern that was used in older versions was just to look at ansible_user or other variables of that type which were ‘sometimes’ set and sometimes even to the correct value! This is not and was never reliable, the config plugin should be used instead.

One issue the config plugin has is the lack of host/variable context, which is something I’m working on adding so it can become a ‘one stop shop’ to find out what is really set when your task executes.

4 Likes

Thanks @bcoca I’ve pinned this topic for the next month. We can also use the dawgs-meeting tag to flag this for discussion. Sounds like we should probably incorporate some details in the docsite and make things more visible.

1 Like

It could be moved to the Guides, FAQs & Howtos subcategory if you think it warrants that @oranod?

1 Like