Doubt

29 views
Skip to first unread message

Luiz Guilherme Nunes Fernandes

unread,
Aug 26, 2021, 2:52:50 PM8/26/21
to ansible...@googlegroups.com
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?

--
<<<<<<<<<<<<<<<<<<<------------------------------------------------------------------->>>>>>>>>>>>>>>>>>>
                                                                    Att.
                                        ♪ ♫  Luiz Guilherme Nunes Fernandes  ♫ ♪
<<<<<<<<<<<<<<<<<<<<------------------------------------------------------------------->>>>>>>>>>>>>>>>>>>

Doug Hunley

unread,
Aug 26, 2021, 3:27:17 PM8/26/21
to ansible...@googlegroups.com
try
- hosts: all
  roles:
    - role: debian_stock_config
      when: ansible_facts['os_family']|lower == 'debian'

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAD%2BmhWLwvX3OSdfXt3vmdn%3D3D%3DaThzzfa9hHtD5%2BiLO%3DbZXcyQ%40mail.gmail.com.

Stefan Hornburg (Racke)

unread,
Aug 27, 2021, 12:37:39 AM8/27/21
to ansible...@googlegroups.com
On 26/08/2021 21:26, Doug Hunley wrote:
> 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



>
> On Thu, Aug 26, 2021 at 2:52 PM Luiz Guilherme Nunes Fernandes <naruto...@gmail.com <mailto:naruto...@gmail.com>> wrote:
>
> 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?
>
> --
> <<<<<<<<<<<<<<<<<<<------------------------------------------------------------------->>>>>>>>>>>>>>>>>>>
>                                   Att.
>       ♪ ♫  Luiz Guilherme Nunes Fernandes  ♫ ♪
> <<<<<<<<<<<<<<<<<<<<------------------------------------------------------------------->>>>>>>>>>>>>>>>>>>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAD%2BmhWLwvX3OSdfXt3vmdn%3D3D%3DaThzzfa9hHtD5%2BiLO%3DbZXcyQ%40mail.gmail.com <https://groups.google.com/d/msgid/ansible-project/CAD%2BmhWLwvX3OSdfXt3vmdn%3D3D%3DaThzzfa9hHtD5%2BiLO%3DbZXcyQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAMiM3L1OTeiMg4sxgGe7F7QPgMuGXHn2%2BuhADXh5AHYf1xYWmg%40mail.gmail.com <https://groups.google.com/d/msgid/ansible-project/CAMiM3L1OTeiMg4sxgGe7F7QPgMuGXHn2%2BuhADXh5AHYf1xYWmg%40mail.gmail.com?utm_medium=email&utm_source=footer>.


--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration.

Dick Visser

unread,
Aug 27, 2021, 12:48:47 AM8/27/21
to ansible...@googlegroups.com
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.


To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/f5aadd65-3033-b96c-95fa-0da70ebf35dd%40linuxia.de.

--
Sent from a mobile device - please excuse the brevity, spelling and punctuation.

flowerysong

unread,
Aug 27, 2021, 1:45:08 AM8/27/21
to Ansible Project
On Friday, August 27, 2021 at 12:37:39 AM UTC-4 ra...@linuxia.de wrote:
On 26/08/2021 21:26, Doug Hunley wrote:
> try
> *- hosts: all
>   roles:
>     - role: debian_stock_config
>       when: ansible_facts['os_family']|lower == 'debian'

That condition is overcomplicated.

      when: ansible_os_family == 'Debian'

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.)
Reply all
Reply to author
Forward
0 new messages