summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Klychkov <aaklychkov@mail.ru>2020-10-09 18:53:47 +0300
committerGitHub <noreply@github.com>2020-10-09 10:53:47 -0500
commitf9ecb4fe74a990a60a3ebeb24fde7ba6833cf036 (patch)
treeef43a03490bfc4ec975a7c0413fb143c2d914405
parentc24bdfa7df19d70da108660431cf528d2f8d9e80 (diff)
downloadansible-f9ecb4fe74a990a60a3ebeb24fde7ba6833cf036.tar.gz
[2.10] Docsite backport of 72049, 72052, 72053 (#72071)
* Docsite: update user_guide/playbooks_prompts (#72049) (cherry picked from commit 3efc8b6de8222c1009eef5016902547ad174a6df) * Docsite: update user_guide/playbooks_checkmode (#72052) (cherry picked from commit c12fce3aa9524e28ba27127710f61f9a7237c623) * Docsite: update user_guide/playbooks_debugger (#72053) (cherry picked from commit 77840f886edf064101a06f9d5a5f36ba719ce520)
-rw-r--r--docs/docsite/rst/user_guide/playbooks_checkmode.rst26
-rw-r--r--docs/docsite/rst/user_guide/playbooks_debugger.rst14
-rw-r--r--docs/docsite/rst/user_guide/playbooks_prompts.rst21
3 files changed, 31 insertions, 30 deletions
diff --git a/docs/docsite/rst/user_guide/playbooks_checkmode.rst b/docs/docsite/rst/user_guide/playbooks_checkmode.rst
index 722220ee22..36b16aa8a0 100644
--- a/docs/docsite/rst/user_guide/playbooks_checkmode.rst
+++ b/docs/docsite/rst/user_guide/playbooks_checkmode.rst
@@ -31,15 +31,15 @@ If you want certain tasks to run in check mode always, or never, regardless of w
For example::
tasks:
- - name: this task will always make changes to the system
- command: /something/to/run --even-in-check-mode
+ - name: This task will always make changes to the system
+ ansible.builtin.command: /something/to/run --even-in-check-mode
check_mode: no
- - name: this task will never make changes to the system
- lineinfile:
- line: "important config"
- dest: /path/to/myconfig.conf
- state: present
+ - name: This task will never make changes to the system
+ ansible.builtin.lineinfile:
+ line: "important config"
+ dest: /path/to/myconfig.conf
+ state: present
check_mode: yes
register: changes_to_important_config
@@ -56,14 +56,14 @@ If you want to skip a task or ignore errors on a task when you run Ansible in ch
tasks:
- - name: this task will be skipped in check mode
- git:
+ - name: This task will be skipped in check mode
+ ansible.builtin.git:
repo: ssh://git@github.com/mylogin/hello.git
dest: /home/mylogin/hello
when: not ansible_check_mode
- - name: this task will ignore errors in check mode
- git:
+ - name: This task will ignore errors in check mode
+ ansible.builtin.git:
repo: ssh://git@github.com/mylogin/hello.git
dest: /home/mylogin/hello
ignore_errors: "{{ ansible_check_mode }}"
@@ -87,8 +87,8 @@ Enforcing or preventing diff mode on tasks
Because the ``--diff`` option can reveal sensitive information, you can disable it for a task by specifying ``diff: no``. For example::
tasks:
- - name: this task will not report a diff when the file changes
- template:
+ - name: This task will not report a diff when the file changes
+ ansible.builtin.template:
src: secret.conf.j2
dest: /etc/secret.conf
owner: root
diff --git a/docs/docsite/rst/user_guide/playbooks_debugger.rst b/docs/docsite/rst/user_guide/playbooks_debugger.rst
index 50148e3267..cc330cc550 100644
--- a/docs/docsite/rst/user_guide/playbooks_debugger.rst
+++ b/docs/docsite/rst/user_guide/playbooks_debugger.rst
@@ -55,7 +55,7 @@ Example of setting the ``debugger`` keyword on a task:
.. code-block:: yaml
- name: Execute a command
- command: "false"
+ ansible.builtin.command: "false"
debugger: on_failed
Example of setting the ``debugger`` keyword on a play:
@@ -67,7 +67,7 @@ Example of setting the ``debugger`` keyword on a play:
debugger: on_skipped
tasks:
- name: Execute a command
- command: "true"
+ ansible.builtin.command: "true"
when: False
Example of setting the ``debugger`` keyword at multiple levels:
@@ -80,7 +80,7 @@ Example of setting the ``debugger`` keyword at multiple levels:
debugger: never
tasks:
- name: Execute a command
- command: "false"
+ ansible.builtin.command: "false"
debugger: on_failed
In this example, the debugger is set to ``never`` at the play level and to ``on_failed`` at the task level. If the task fails, Ansible invokes the debugger, because the definition on the task overrides the definition on its parent play.
@@ -137,8 +137,8 @@ After Ansible invokes the debugger, you can use the seven :ref:`debugger command
vars:
var1: value1
tasks:
- - name: wrong variable
- ping: data={{ wrong_var }}
+ - name: Use a wrong variable
+ ansible.builtin.ping: data={{ wrong_var }}
If you run this playbook, Ansible invokes the debugger when the task fails. From the debug prompt, you can change the module arguments or the variables and run the task again.
@@ -248,8 +248,8 @@ Update args command
vars:
pkg_name: not_exist
tasks:
- - name: install package
- apt: name={{ pkg_name }}
+ - name: Install a package
+ ansible.builtin.apt: name={{ pkg_name }}
When you run the playbook, the invalid package name triggers an error, and Ansible invokes the debugger. You can fix the package name by viewing, then updating the module argument::
diff --git a/docs/docsite/rst/user_guide/playbooks_prompts.rst b/docs/docsite/rst/user_guide/playbooks_prompts.rst
index 5900a26c74..856f703773 100644
--- a/docs/docsite/rst/user_guide/playbooks_prompts.rst
+++ b/docs/docsite/rst/user_guide/playbooks_prompts.rst
@@ -16,15 +16,16 @@ Here is a most basic example::
vars_prompt:
- name: username
- prompt: "What is your username?"
+ prompt: What is your username?
private: no
- name: password
- prompt: "What is your password?"
+ prompt: What is your password?
tasks:
- - debug:
+ - name: Print a message
+ ansible.builtin.debug:
msg: 'Logging in as {{ username }}'
The user input is hidden by default but it can be made visible by setting ``private: no``.
@@ -36,8 +37,8 @@ If you have a variable that changes infrequently, you can provide a default valu
vars_prompt:
- - name: "release_version"
- prompt: "Product release version"
+ - name: release_version
+ prompt: Product release version
default: "1.0"
Encrypting values supplied by ``vars_prompt``
@@ -47,10 +48,10 @@ You can encrypt the entered value so you can use it, for instance, with the user
vars_prompt:
- - name: "my_password2"
- prompt: "Enter password2"
+ - name: my_password2
+ prompt: Enter password2
private: yes
- encrypt: "sha512_crypt"
+ encrypt: sha512_crypt
confirm: yes
salt_size: 7
@@ -96,8 +97,8 @@ Allowing special characters in ``vars_prompt`` values
Some special characters, such as ``{`` and ``%`` can create templating errors. If you need to accept special characters, use the ``unsafe`` option::
vars_prompt:
- - name: "my_password_with_weird_chars"
- prompt: "Enter password"
+ - name: my_password_with_weird_chars
+ prompt: Enter password
unsafe: yes
private: yes