mirror of
https://github.com/ansible/ansible.git
synced 2026-08-03 08:03:05 +02:00
Docs: changed :: to code-block:: in 9 files (#75994)
* Fixed 9 files in user guide
This commit is contained in:
@@ -120,7 +120,9 @@ You can use the inventory script explicitly (by passing the `-i openstack_invent
|
||||
Explicit use of OpenStack inventory script
|
||||
------------------------------------------
|
||||
|
||||
Download the latest version of the OpenStack dynamic inventory script and make it executable::
|
||||
Download the latest version of the OpenStack dynamic inventory script and make it executable.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
wget https://raw.githubusercontent.com/openstack/ansible-collections-openstack/master/scripts/inventory/openstack_inventory.py
|
||||
chmod +x openstack_inventory.py
|
||||
@@ -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>`_.
|
||||
|
||||
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:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
./openstack_inventory.py --list
|
||||
|
||||
|
||||
@@ -728,7 +728,9 @@ called :file:`inventory_staging`:
|
||||
|
||||
To apply a playbook called :file:`site.yml`
|
||||
to all the app servers in the test environment, use the
|
||||
following command::
|
||||
following command:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ansible-playbook -i inventory_test -l appservers site.yml
|
||||
|
||||
|
||||
@@ -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).
|
||||
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/.
|
||||
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 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
|
||||
@@ -91,7 +93,9 @@ Most Ansible modules check whether the desired final state has already been achi
|
||||
Running playbooks
|
||||
-----------------
|
||||
|
||||
To run your playbook, use the :ref:`ansible-playbook` command::
|
||||
To run your playbook, use the :ref:`ansible-playbook` command.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ansible-playbook playbook.yml -f 10
|
||||
|
||||
|
||||
@@ -11,7 +11,9 @@ Lookup plugins retrieve data from outside sources such as files, databases, key/
|
||||
Using lookups in variables
|
||||
==========================
|
||||
|
||||
You can populate variables using lookups. Ansible evaluates the value each time it is executed in a task (or template)::
|
||||
You can populate variables using lookups. Ansible evaluates the value each time it is executed in a task (or template).
|
||||
|
||||
.. code-block:: yaml+jinja
|
||||
|
||||
vars:
|
||||
motd_value: "{{ lookup('file', '/etc/motd') }}"
|
||||
|
||||
@@ -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
|
||||
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`,
|
||||
:meth:`dict.values`, or :meth:`dict.items`::
|
||||
:meth:`dict.values`, or :meth:`dict.items`.
|
||||
|
||||
.. code-block:: yaml+jinja
|
||||
|
||||
vars:
|
||||
hosts:
|
||||
@@ -44,7 +46,9 @@ dict.iteritems()
|
||||
|
||||
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.
|
||||
|
||||
.. code-block:: yaml+jinja
|
||||
|
||||
vars:
|
||||
hosts:
|
||||
|
||||
@@ -366,7 +366,9 @@ The first two methods above only work when the host has access to the internet.
|
||||
When a host does not have internet access, the module must first be installed
|
||||
using the methods above on another host with internet access and then copied
|
||||
across. To save a module to a local filepath, the following PowerShell cmdlet
|
||||
can be run::
|
||||
can be run:
|
||||
|
||||
.. code-block:: powershell
|
||||
|
||||
Save-Module -Name xWebAdministration -Path C:\temp
|
||||
|
||||
|
||||
@@ -199,7 +199,9 @@ of ``Win32-OpenSSH`` from the GitHub Releases page when using it with Ansible
|
||||
on Windows hosts.
|
||||
|
||||
To use SSH as the connection to a Windows host, set the following variables in
|
||||
the inventory::
|
||||
the inventory:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
ansible_connection=ssh
|
||||
|
||||
|
||||
@@ -402,7 +402,9 @@ The YAML specification considers the following `escape sequences <https://yaml.o
|
||||
|
||||
* ``\U........`` -- 8-digit hex escape
|
||||
|
||||
Here are some examples on how to write Windows paths::
|
||||
Here are some examples on how to write Windows paths:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
# GOOD
|
||||
tempdir: C:\Windows\Temp
|
||||
@@ -423,7 +425,9 @@ This is an example which will fail:
|
||||
# FAILS
|
||||
tempdir: "C:\Windows\Temp"
|
||||
|
||||
This example shows the use of single quotes when they are required::
|
||||
This example shows the use of single quotes when they are required:
|
||||
|
||||
.. code-block:: yaml+jinja
|
||||
|
||||
---
|
||||
- name: Copy tomcat config
|
||||
|
||||
Reference in New Issue
Block a user