Hi, I have problems with global configuration playbook.
what is the correct setting?
- hosts: all
roles:
- role: debian_stock_config
when: ansible_facts[‘os_family’]|lower == ‘debian’
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
roles:
- role: debian_stock_config
^ here
Any suggestions?
try
- hosts: all
roles:
- role: debian_stock_config
when: ansible_facts[‘os_family’]|lower == ‘debian’
racke
(Stefan Hornburg)
August 27, 2021, 4:37am
3
try
*- hosts: all
roles:
- role: debian_stock_config
when: ansible_facts['os_family']|lower == 'debian'*
That condition is overcomplicated.
when: ansible\_os\_family == 'Debian'
should do the trick.
Regards
Racke
Also keep in mind that ansible_os_family will be Debian for Ubuntu as well.
If you need to target Debian specifically use ansible_distribution.
That’s more a sideways step than an improvement; using ansible_facts is better than relying on the top-level injection of vars (which can be disabled.)