@ -144,7 +146,9 @@ You can confirm the file has been successfully sourced by running a simple comma
The OpenStack command line clients are required to run the `nova list` command. For more information on how to install them, please refer to `Install the OpenStack command-line clients <https://docs.openstack.org/user-guide/common/cli_install_openstack_command_line_clients.html>`_.
The OpenStack command line clients are required to run the `nova list` command. For more information on how to install them, please refer to `Install the OpenStack command-line clients <https://docs.openstack.org/user-guide/common/cli_install_openstack_command_line_clients.html>`_.
You can test the OpenStack dynamic inventory script manually to confirm it is working as expected::
You can test the OpenStack dynamic inventory script manually to confirm it is working as expected:
@ -27,7 +27,9 @@ Lookups and action plugins both use a special 'search magic' to find things, tak
Using this magic, relative paths get attempted first with a 'files|templates|vars' appended (if not already present), depending on action being taken, 'files' is the default. (in other words, include_vars will use vars/). The paths will be searched from most specific to most general (in other words, role before play).
Using this magic, relative paths get attempted first with a 'files|templates|vars' appended (if not already present), depending on action being taken, 'files' is the default. (in other words, include_vars will use vars/). The paths will be searched from most specific to most general (in other words, role before play).
dependent roles WILL be traversed (in other words, task is in role2, role2 is a dependency of role1, role2 will be looked at first, then role1, then play).
dependent roles WILL be traversed (in other words, task is in role2, role2 is a dependency of role1, role2 will be looked at first, then role1, then play).
i.e ::
i.e :
..code-block:: text
role search path is rolename/{files|vars|templates}/, rolename/tasks/.
role search path is rolename/{files|vars|templates}/, rolename/tasks/.
play search path is playdir/{files|vars|templates}/, playdir/.
play search path is playdir/{files|vars|templates}/, playdir/.
@ -37,7 +37,9 @@ A playbook runs in order from top to bottom. Within each play, tasks also run in
In Ansible 2.10 and later, we recommend you use the fully-qualified collection name in your playbooks to ensure the correct module is selected, because multiple collections can contain modules with the same name (for example, ``user``). See :ref:`collections_using_playbook`.
In Ansible 2.10 and later, we recommend you use the fully-qualified collection name in your playbooks to ensure the correct module is selected, because multiple collections can contain modules with the same name (for example, ``user``). See :ref:`collections_using_playbook`.
In this example, the first play targets the web servers; the second play targets the database servers::
In this example, the first play targets the web servers; the second play targets the database servers.
..code-block:: yaml
---
---
- name: Update web servers
- name: Update web servers
@ -91,7 +93,9 @@ Most Ansible modules check whether the desired final state has already been achi
Running playbooks
Running playbooks
-----------------
-----------------
To run your playbook, use the :ref:`ansible-playbook` command::
To run your playbook, use the :ref:`ansible-playbook` command.
@ -23,7 +23,9 @@ In Python3, those methods return a :ref:`dictionary view <python3:dict-views>` o
string representation that Jinja2 returns for dictionary views cannot be parsed back
string representation that Jinja2 returns for dictionary views cannot be parsed back
into a list by Ansible. It is, however, easy to make this portable by
into a list by Ansible. It is, however, easy to make this portable by
using the :func:`list <jinja2:jinja-filters.list>` filter whenever using :meth:`dict.keys`,
using the :func:`list <jinja2:jinja-filters.list>` filter whenever using :meth:`dict.keys`,
:meth:`dict.values`, or :meth:`dict.items`::
:meth:`dict.values`, or :meth:`dict.items`.
..code-block:: yaml+jinja
vars:
vars:
hosts:
hosts:
@ -44,7 +46,9 @@ dict.iteritems()
Python2 dictionaries have :meth:`~dict.iterkeys`, :meth:`~dict.itervalues`, and :meth:`~dict.iteritems` methods.
Python2 dictionaries have :meth:`~dict.iterkeys`, :meth:`~dict.itervalues`, and :meth:`~dict.iteritems` methods.
Python3 dictionaries do not have these methods. Use :meth:`dict.keys`, :meth:`dict.values`, and :meth:`dict.items` to make your playbooks and templates compatible with both Python2 and Python3::
Python3 dictionaries do not have these methods. Use :meth:`dict.keys`, :meth:`dict.values`, and :meth:`dict.items` to make your playbooks and templates compatible with both Python2 and Python3.