Hi,
have started evaluating ansible playbook functionality to perform
simple config management tasks.
I have experienced several problems. Tried to get some help on irc,
and through web searches, but.. well. I'm here
I'm running the following playbook:
-------8<-------
# test.yml
Hello Cosimo
Indeed it looks as if facts aren't being gathered, which is kind of
odd, since it should happen by default. By then each play should
contain the following at the start.
TASK [setup] *******************************************************************
ok: [localhost.localdomain]
Any chance that your ansible.cfg has a non-default value for the
gathering[1] option? Such as it being set to explicit?
// Andreas
[1]: https://docs.ansible.com/ansible/intro_configuration.html#gathering
Indeed it looks as if facts aren't being gathered, which is kind of
odd, since it should happen by default. By then each play should
contain the following at the start.
TASK [setup]
*******************************************************************
ok: [localhost.localdomain]
I found no indication of this in my run log, so facts gathering was
not happening.
Any chance that your ansible.cfg has a non-default value for the
gathering[1] option? Such as it being set to explicit?
That's right. I had "gathering=explicit" in my configuration file,
since I had used ansible only for command execution, and obviously
gathering facts was wasting lots of time for those kind of tasks.
Thanks, that clears it.
I tried overriding my configuration file from the command line:
ansible-playbook -v -l <hostname> -e gather_facts=true ./playbook.yml
and:
ansible-playbook -v -l <hostname> -e gathering=implicit ./playbook.yml
but none worked.
Changing the playbook file by adding "gather_facts: true" worked
instead.
Not sure if that's an accepted practice. Opinions?
I'm still unsure about this error message when the facts gathering is
not
happening:
"Could not detect which package manager to use. Try gathering facts or
setting the \"use\" option."
what is the "use" option?
Thanks,
ons 2017-01-04 klockan 13:25 +0100 skrev Cosimo Streppone:
...
I'm still unsure about this error message when the facts gathering is
not happening:
"Could not detect which package manager to use. Try gathering facts
or setting the \"use\" option."
what is the "use" option?
See https://docs.ansible.com/ansible/package_module.html
- package:
name: emacs
use: apt
... which is a bit of a pointless exercise. What might make more sense
then is something along these lines.
- package:
name: emacs
use: "{{ host_alt_group_variable }}"
// Andreas
gather_facts and gathering is a directive not a variables, so thats why -e didn't work.
gather_facts can only be used in a play.