# Doubt

**URL:** <https://forum.ansible.com/t/doubt/35681>\
**Category:** Ansible Project\
**Created:** [August 26, 2021, 6:52pm UTC](https://forum.ansible.com/t/doubt/35681 "2021-08-26T18:52:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luiz\_Guilherme\_Nunes](https://avatars.discourse-cdn.com/v4/letter/l/90ced4/32.png) [@Luiz\_Guilherme\_Nunes](https://forum.ansible.com/u/Luiz_Guilherme_Nunes)\
**Post date:** [August 26, 2021, 6:52pm UTC](https://forum.ansible.com/t/doubt/35681/1 "2021-08-26T18:52:31Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Doug\_Hunley](https://avatars.discourse-cdn.com/v4/letter/d/dbc845/32.png) [@Doug\_Hunley](https://forum.ansible.com/u/Doug_Hunley)\
**Post date:** [August 26, 2021, 7:26pm UTC](https://forum.ansible.com/t/doubt/35681/2 "2021-08-26T19:26:55Z")

</div>

try  
**- hosts: all**  
**roles:**  
**- role: debian\_stock\_config**  
**when: ansible\_facts[‘os\_family’]|lower == ‘debian’**

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [August 27, 2021, 4:37am UTC](https://forum.ansible.com/t/doubt/35681/3 "2021-08-27T04:37:09Z")

</div>

> try  
> \*- hosts: all  
> roles:  
> - role: debian\_stock\_config  
> when: ansible\_facts['os\_family']|lower == 'debian'\*

That condition is overcomplicated.

```
   when: ansible\_os\_family == &#39;Debian&#39;

```

should do the trick.

Regards

```
       Racke

```

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [August 27, 2021, 4:48am UTC](https://forum.ansible.com/t/doubt/35681/4 "2021-08-27T04:48:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![flowerysong1](https://avatars.discourse-cdn.com/v4/letter/f/ecae2f/32.png) [@flowerysong1](https://forum.ansible.com/u/flowerysong1)\
**Post date:** [August 27, 2021, 5:45am UTC](https://forum.ansible.com/t/doubt/35681/5 "2021-08-27T05:45:08Z")

</div>

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.)
