How to re-enable gather_facts later in a playbook

48 views
Skip to first unread message

Emmanuel Lacour

unread,
Sep 17, 2015, 4:32:54 AM9/17/15
to Ansible Project
Dear ansible users,

I have a playbook that install a VM, so at the beginning og the playbook I use "gather_facts: no" because the VM is not yet ready, then I install the vm on the cluster using delegate_to, then once the vm is up I would like to continue some tasks on the vm but I need facts now.

Is this possible?

David Karban

unread,
Sep 17, 2015, 4:54:21 AM9/17/15
to ansible...@googlegroups.com
Hi, 

you can either use gather_facts: yes if you provision VM in another play, or just call an setup module like:

- name: Get VM facts
  setup:



David Karban
Linux server specialist/Specialista na správu linuxových serverů
www.karban.eu

--
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/eb37b2c6-b715-4fd4-a31b-099e584cf6c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Emmanuel Lacour

unread,
Sep 17, 2015, 12:09:12 PM9/17/15
to Ansible Project


Le jeudi 17 septembre 2015 10:54:21 UTC+2, David Karban a écrit :
Hi, 

you can either use gather_facts: yes if you provision VM in another play, or just call an setup module like:

- name: Get VM facts
  setup:


I just tried, but it doesn't works:

 error while evaluating conditional: ansible_os_family == "Debian"

If I split the playbook and put tasks that needs fact in the second one with gather_facts yes, it works. I'll go this way. Thanks for your help!
Reply all
Reply to author
Forward
0 new messages