Skip to content

Commit 2e0c307

Browse files
felixfonteinpatchback[bot]
authored andcommitted
Use new :ansoptref: and :ansretvalref: roles. (#3306)
(cherry picked from commit daef4fd)
1 parent c8ad7f5 commit 2e0c307

File tree

3 files changed

+38
-25
lines changed

3 files changed

+38
-25
lines changed

docs/docsite/rst/dev_guide/developing_program_flow_modules.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,16 +502,16 @@ Modules can access this parameter by using the public ``tmpdir`` property. The `
502502
The directory name is generated randomly, and the the root of the directory is determined by one of these:
503503

504504
* :ref:`DEFAULT_LOCAL_TMP`
505-
* `remote_tmp <https://docs.ansible.com/projects/ansible/latest/collections/ansible/builtin/sh_shell.html#parameter-remote_tmp>`_
506-
* `system_tmpdirs <https://docs.ansible.com/projects/ansible/latest/collections/ansible/builtin/sh_shell.html#parameter-system_tmpdirs>`_
505+
* :ansoptref:`remote_tmp <ansible.builtin.sh#shell:remote_tmp>`
506+
* :ansoptref:`system_tmpdirs <ansible.builtin.sh#shell:system_tmpdirs>`
507507

508508
As a result, using the ``ansible.cfg`` configuration file to activate or customize this setting will not guarantee that you control the full value.
509509

510510

511511
_ansible_remote_tmp
512512
^^^^^^^^^^^^^^^^^^^
513513

514-
The module's ``tmpdir`` property creates a randomized directory name in this directory if the action plugin did not set ``_ansible_tmpdir``. For more details, see the `remote_tmp <https://docs.ansible.com/projects/ansible/latest/collections/ansible/builtin/sh_shell.html#parameter-remote_tmp>`_ parameter of the shell plugin.
514+
The module's ``tmpdir`` property creates a randomized directory name in this directory if the action plugin did not set ``_ansible_tmpdir``. For more details, see the :ansoptref:`remote_tmp <ansible.builtin.sh#shell:remote_tmp>` parameter of the shell plugin.
515515

516516

517517
.. _flow_module_return_values:

docs/docsite/rst/dev_guide/style_guide/index.rst

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -251,14 +251,21 @@ Instead of ``#module``, you can also specify ``#<plugin_type>`` to reference to
251251
Adding links to module and plugin options and return values
252252
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
253253

254-
Use the ``:ansopt:`` and ``:ansretval:`` roles to reference options and return values of modules and plugins:
254+
Use the ``:ansopt:`` and ``:ansretval:`` roles to reference options and return values of modules and plugins while showing the option's resp. return value's name and optionally a value.
255+
Use the ``:ansoptref:`` and ``:ansretvalref:`` roles to reference options and return values of modules and plugins while displaying a provided title.
256+
257+
The following example shows their usage:
255258

256259
.. code-block:: rst
257260
258261
:ansopt:`ansible.builtin.file#module:path` references the ``path`` parameter of the
259262
``ansible.builtin.file`` module; :ansopt:`ansible.builtin.file#module:path=/root/.ssh/known_hosts`
260263
shows the assignment ``path=/root/.ssh/known_hosts`` as a clickable link.
261264
265+
You can :ansoptref:`provide a path <ansible.builtin.file#module:path>`
266+
to the :ansplugin:`ansible.builtin.file#module`; its value is
267+
:ansretvalref:`returned as a return value <ansible.builtin.file#module:path>`.
268+
262269
:ansretval:`ansible.builtin.stat#module:stat.exists` references the ``stat.exists`` return value
263270
of the ``ansible.builtin.stat`` module. You can also use ``=`` as for option values:
264271
:ansretval:`ansible.builtin.stat#module:stat.exists=true` shows ``stat.exists=true``.
@@ -267,21 +274,26 @@ Use the ``:ansopt:`` and ``:ansretval:`` roles to reference options and return v
267274
assignment without a link; the same is true for return values: :ansretval:`foo` and
268275
:ansretval:`foo=bar`.
269276
270-
This displays as
271-
":ansopt:`ansible.builtin.file#module:path` references the ``path`` parameter of the
272-
``ansible.builtin.file`` module; :ansopt:`ansible.builtin.file#module:path=/root/.ssh/known_hosts`
273-
shows the assignment ``path=/root/.ssh/known_hosts`` as a clickable link."
274-
and
275-
":ansretval:`ansible.builtin.stat#module:stat.exists` references the ``stat.exists`` return value
276-
of the ``ansible.builtin.stat`` module. You can also use ``=`` as for option values:
277-
:ansretval:`ansible.builtin.stat#module:stat.exists=true` shows ``stat.exists=true``."
278-
and
279-
":ansopt:`foo` and :ansopt:`foo=bar` use the same markup for an option and an option
280-
assignment without a link; the same is true for return values: :ansretval:`foo` and
281-
:ansretval:`foo=bar`.".
277+
This displays as:
278+
279+
:ansopt:`ansible.builtin.file#module:path` references the ``path`` parameter of the
280+
``ansible.builtin.file`` module; :ansopt:`ansible.builtin.file#module:path=/root/.ssh/known_hosts`
281+
shows the assignment ``path=/root/.ssh/known_hosts`` as a clickable link.
282+
283+
You can :ansoptref:`provide a path <ansible.builtin.file#module:path>`
284+
to the :ansplugin:`ansible.builtin.file#module`; its value is
285+
:ansretvalref:`returned as a return value <ansible.builtin.file#module:path>`.
286+
287+
:ansretval:`ansible.builtin.stat#module:stat.exists` references the ``stat.exists`` return value
288+
of the ``ansible.builtin.stat`` module. You can also use ``=`` as for option values:
289+
:ansretval:`ansible.builtin.stat#module:stat.exists=true` shows ``stat.exists=true``.
290+
291+
:ansopt:`foo` and :ansopt:`foo=bar` use the same markup for an option and an option
292+
assignment without a link; the same is true for return values: :ansretval:`foo` and
293+
:ansretval:`foo=bar`.
282294

283295
For both option and return values, ``.`` is used to reference suboptions and contained return values.
284-
Array stubs (``[...]``) can be used to indicate that something is a list, for example the ``:retval:``
296+
Array stubs (``[...]``) can be used to indicate that something is a list, for example the ``:ansretval:``
285297
argument ``ansible.builtin.service_facts#module:ansible_facts.services['systemd'].state`` references
286298
the ``ansible_facts.services.state`` return value of the ``ansible.builtin.service_facts`` module
287299
(:ansretval:`ansible.builtin.service_facts#module:ansible_facts.services['systemd'].state`).

docs/docsite/rst/playbook_guide/playbooks_privilege_escalation.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,9 @@ to check ``world_readable_temp`` per below.
172172
If ``ansible_common_remote_group`` is **not** set and the chown above it failed,
173173
or if ``ansible_common_remote_group`` *is* set but the :command:`chgrp` (or
174174
following group-permissions :command:`chmod`) returned a non-successful exit
175-
code, Ansible will lastly check `the world_readable_temp option`_. If this is
176-
set, Ansible will place the module file in a world-readable temporary directory,
175+
code, Ansible will lastly check
176+
:ansoptref:`the world_readable_temp option <ansible.builtin.sh#shell:world_readable_temp>`.
177+
If this is set, Ansible will place the module file in a world-readable temporary directory,
177178
with world-readable permissions to allow the ``become_user`` (and incidentally
178179
any other user on the system) to read the contents of the file. **If any of the
179180
parameters passed to the module are sensitive in nature, and you do not trust
@@ -198,8 +199,9 @@ Several ways exist to avoid the above logic flow entirely:
198199
.. warning:: Although the Solaris ZFS filesystem has filesystem ACLs, the ACLs
199200
are not POSIX.1e filesystem acls (they are NFSv4 ACLs instead). Ansible
200201
cannot use these ACLs to manage its temp file permissions so you may have
201-
to resort to `the world_readable_temp option`_ if the remote machines
202-
use ZFS.
202+
to resort to
203+
:ansoptref:`the world_readable_temp option <ansible.builtin.sh#shell:world_readable_temp>`
204+
if the remote machines use ZFS.
203205

204206
.. versionchanged:: 2.1
205207

@@ -208,13 +210,12 @@ Ansible defaults to issuing an error if it cannot execute securely with ``become
208210
If you cannot use pipelining or POSIX ACLs, must connect as an unprivileged user,
209211
must use ``become`` to execute as a different unprivileged user,
210212
and decide that your managed nodes are secure enough for the
211-
modules you want to run there to be world readable, you can turn on `the world_readable_temp option`_, which will change this from an error into
212-
a warning and allow the task to run as it did prior to 2.1.
213+
modules you want to run there to be world readable, you can turn on
214+
:ansoptref:`the world_readable_temp option <ansible.builtin.sh#shell:world_readable_temp>`,
215+
which will change this from an error into a warning and allow the task to run as it did prior to 2.1.
213216

214217
.. versionchanged:: 2.10
215218

216-
.. _the world_readable_temp option: https://docs.ansible.com/projects/ansible/latest/collections/ansible/builtin/sh_shell.html#parameter-world_readable_temp
217-
218219
Ansible 2.10 introduces the above-mentioned ``ansible_common_remote_group``
219220
fallback. As mentioned above, if enabled, it is used when ``remote_user`` and
220221
``become_user`` are both unprivileged users. Refer to the text above for details

0 commit comments

Comments
 (0)