Additionally, *group_names* is a list (array) of all the groups the current host is in. This can be used in templates using Jinja2 syntax to make template source files that vary based on the group membership (or role) of the host::
...
...
@@ -265,8 +250,8 @@ This is useful, for, among other things, setting the hosts group or the user for
Example::
-----
- user: $user
hosts: $hosts
- user: '{{ user }}'
hosts: '{{ hosts }}'
tasks:
- ...
...
...
@@ -279,30 +264,19 @@ Sometimes you will want to skip a particular step on a particular host. This co
as simple as not installing a certain package if the operating system is a particular version,
or it could be something like performing some cleanup steps if a filesystem is getting full.
This is easy to do in Ansible, with the `only_if` clause, which actually is a Python expression.
This is easy to do in Ansible, with the `when` clause, which actually is a Python expression.
``with_password`` and associated macro ``$PASSWORD`` generate a random plaintext password and store it in
``with_password`` and associated lookup macro generate a random plaintext password and store it in
a file at a given filepath. Support for crypted save modes (as with vars_prompt) are pending. If the
file exists previously, ``$PASSWORD``/``with_password`` will retrieve its contents, behaving just like
``$FILE``/``with_file``. Usage of variables like "${inventory_hostname}" in the filepath can be used to set
file exists previously, it will retrieve its contents, behaving just like with_file. Usage of variables like "{{ inventory_hostname }}" in the filepath can be used to set
up random passwords per host (what simplifies password management in 'host_vars' variables).
Generated passwords contain a random mix of upper and lowercase ASCII letters, the
...
...
@@ -628,24 +516,19 @@ This length can be changed by passing an extra parameter::