I'd like to use the templating for a simple tasks, but what variables are
there (outside the one you can setup in a playbook) for me to use? I
installed facter, but there should be a few ansible_XXXX variables right?
Is there a way to produce a list to see what I can reference?
Easiest way to do this is:
ansible hostname -m setup
It will show you all of the variables that are available. Ansible
provides a ton of it's own facts, so you do not need facter or ohai
unless you just remember what facts they provide or they provide
something we don't (though we'd really like to add those things you
find
missing, if any)
One day I want to be able to do those things (Currently do not even know what it means) I’ve only recently started learning python. (Which is also how I discovered ansible)…
> Thank you for the answer, and to jump straight in: I seem to be
missing a
> domain variable, could that be correct?
>
Yeah, we should add that. Want to send me a pull request to the
library/setup module to add one?
One day I want to be able to do those things (Currently do not even know
what it means) I've only recently started learning python. (Which is
also how I discovered ansible)....
Pull request is a git or rather github term - basically a way to hand
over a patch to code.
If you have a look at library/setup in ansible, you will see the python
that builds the various facts, and in get_platform_facts there is the
basic stuff like hostname etc.
Serge got a version of domainname contributed just before I did - see https://github.com/ansible/ansible/pull/1466
For those starting python (or at least for me) the only peculiar thing
in there is that the join method applies to a string and not to the
list, so giving:-
self.facts['domainname'] = '.'.join(self.facts['fqdn'].split('.')[1:])