How can I detect Atomic version of CentOS with Ansible facts (setup) mechanism?

57 views
Skip to first unread message

Stéphane Klein

unread,
Jun 19, 2017, 12:00:59 PM6/19/17
to Ansible Project
Hi,

I have CentOS Atomic Host (http://www.projectatomic.io/).

When I execute:

ansible -m setup my_atomic_os

I have:

"ansible_os_family": "RedHat"

I see nowhere that this is a Atomic version of RedHat / CentOS (on Atomic host I can't install package…).

How can I detect this with facts mechanism?

I need to create an Ansible issue on GitHub about this feature request?

Best regards,
Stéphane

Dick Davies

unread,
Jun 19, 2017, 12:16:37 PM6/19/17
to ansible list
Start with: how would I tell the host is an Atomic host without Ansible?

Then you can combine a command: with a register:clause,
and run set_fact with a when: .

For the effort, I'd just add a custom fact. But without knowing how to tell,
that's tricky :)
> --
> 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 post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/a3cfd3e3-cbcb-4f50-9cc0-b99288c69aaa%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Stéphane Klein

unread,
Jun 20, 2017, 5:26:33 AM6/20/17
to Ansible Project, di...@hellooperator.net
Le lundi 19 juin 2017 18:16:37 UTC+2, Dick Davies a écrit :
Start with: how would I tell the host is an Atomic host without Ansible?

Then you can combine a command: with a register:clause,
and run set_fact with a when: .

For the effort, I'd just add a custom fact. But without knowing how to tell,
that's tricky :)

Thanks

It is possible to override ansible_os_family fact?

I try that:

[all]
atomic-test-node.example.com ansible_user=root ansible_os_family=atomic
 
But it don't work :(

jean...@lenhof.eu.org

unread,
Jun 20, 2017, 10:46:32 AM6/20/17
to ansible...@googlegroups.com, di...@hellooperator.net
hi,

There's custom local fact available for this, no ?
http://docs.ansible.com/ansible/playbooks_variables.html#local-facts-facts-d

Just put some lines of python program, make the output look JSON and voilà.

Regards,

Stéphane Klein

unread,
Jun 20, 2017, 3:17:55 PM6/20/17
to ansible...@googlegroups.com, di...@hellooperator.net
2017-06-20 16:46 GMT+02:00 <jean...@lenhof.eu.org>:


20 juin 2017 11:26 "Stéphane Klein" <klein.s...@gmail.com> a écrit:
Le lundi 19 juin 2017 18:16:37 UTC+2, Dick Davies a écrit :
Start with: how would I tell the host is an Atomic host without Ansible?

Then you can combine a command: with a register:clause,
and run set_fact with a when: .

For the effort, I'd just add a custom fact. But without knowing how to tell,
that's tricky :)

Thanks

It is possible to override ansible_os_family fact?

I try that:

[all]
atomic-test-node.example.com ansible_user=root ansible_os_family=atomic

But it don't work :(

hi,

There's custom local fact available for this, no ?
http://docs.ansible.com/ansible/playbooks_variables.html#local-facts-facts-d


This don't override default Ansible facts. 
Reply all
Reply to author
Forward
0 new messages