Categorie

Category cover

Automazione
18 posts

Category cover

CISO
10 posts

Category cover

Sicurezza Personale
7 posts

Category cover

Infrastruttura
4 posts

Category cover

Sicurezza
3 posts

Category cover

Libri
2 posts

Category cover

Vita
1 posts

Debug delle variabili in Ansible

Andrea Dainese
6 Ottobre 2023
Post cover

Quando lavoro su Ansible, una delle “ricette” che tengo sempre a portata, è quella relativa al debugging delle variabili. In particolar modo trovo molto utile avere una vista completa delle variabili associate ad un host, definite a livello di “facts”, ambiente, gruppo, host.

Impostando gather_facts: true possiamo accedere alle variabili tramite:

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

Per stampare le variabili in modo leggibile, è possibile usare il filtro to_nice_json.