Debug all variables with Ansible
2024-3-11 22:31:58 Author: www.adainese.it(查看原文) 阅读量:19 收藏

Post cover

When working with Ansible , one of the “recipes” that I always keep handy is related to debugging variables. I find it particularly useful to have a comprehensive view of the variables associated with a host, defined at the “facts”, environment, group, and host levels.

By setting gather_facts: true, we can access the variables through:

  • Module: vars
  • Environment: environment
  • Group names: group_names
  • Groups: groups
  • Hosts: hostvars

To print the variables in a readable format, the to_nice_json filter can be used.


文章来源: https://www.adainese.it/blog/2023/10/06/debug-all-variables-with-ansible/
如有侵权请联系:admin#unsafe.sh