summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSandra McCann <samccann@redhat.com>2022-08-25 16:33:03 -0400
committerGitHub <noreply@github.com>2022-08-25 13:33:03 -0700
commita55ffb8d17197edc1c10562941d3aaf4ea83b533 (patch)
tree8a6a3315cf229ac8e271315aa571a109d360bf47
parent8071f014f6c3a91c69a5c783a303bd0b79be06c5 (diff)
downloadansible-a55ffb8d17197edc1c10562941d3aaf4ea83b533.tar.gz
Backportapalooza 08 25 (#78647)
* fix adhoc dev example (#78593) (cherry picked from commit 5ac40b358d7d64e4169813e400c19f869b17183c) * Docs: fix issue-76133-apt-repository (#78586) (cherry picked from commit 3b9f1871e512ffc4106348cadb2ea369eb8b4fd0) * Fixes parameter name in expect module examples (#78635) (cherry picked from commit 81813b7f23f6c33d9bec52f04d0d061bd5f1755e) * doc: Correct mixed up commentary and task name (#78610) Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com> (cherry picked from commit 87ba1e29d3ca1aec2d05782e0fe9a33c82701e62) Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com> Co-authored-by: Arnold Kamanzi <kamstan6@gmail.com> Co-authored-by: gmdmi <gmdmi@ya.ru> Co-authored-by: rawtaz <rawtaz@users.noreply.github.com>
-rw-r--r--docs/docsite/rst/dev_guide/developing_modules_general.rst4
-rw-r--r--lib/ansible/modules/apt_repository.py1
-rw-r--r--lib/ansible/modules/expect.py4
-rw-r--r--lib/ansible/modules/replace.py2
4 files changed, 6 insertions, 5 deletions
diff --git a/docs/docsite/rst/dev_guide/developing_modules_general.rst b/docs/docsite/rst/dev_guide/developing_modules_general.rst
index 3f1f27fd06..abffcf191c 100644
--- a/docs/docsite/rst/dev_guide/developing_modules_general.rst
+++ b/docs/docsite/rst/dev_guide/developing_modules_general.rst
@@ -80,13 +80,13 @@ The simplest way is to use ``ansible`` adhoc command:
.. code:: shell
- ansible -m library/my_test.py -a 'name=hello new=true' remotehost
+ ANSIBLE_LIBRARY=./library ansible -m my_test -a 'name=hello new=true' remotehost
If your module does not need to target a remote host, you can quickly and easily exercise your code locally like this:
.. code:: shell
- ansible -m library/my_test.py -a 'name=hello new=true' localhost
+ ANSIBLE_LIBRARY=./library ansible -m my_test -a 'name=hello new=true' localhost
- If for any reason (pdb, using print(), faster iteration, etc) you want to avoid going through Ansible,
another way is to create an arguments file, a basic JSON config file that passes parameters to your module so that you can run it.
diff --git a/lib/ansible/modules/apt_repository.py b/lib/ansible/modules/apt_repository.py
index ec5a52739f..1a1116470e 100644
--- a/lib/ansible/modules/apt_repository.py
+++ b/lib/ansible/modules/apt_repository.py
@@ -99,6 +99,7 @@ version_added: "0.7"
requirements:
- python-apt (python 2)
- python3-apt (python 3)
+ - apt-key or gpg
'''
EXAMPLES = '''
diff --git a/lib/ansible/modules/expect.py b/lib/ansible/modules/expect.py
index 89459225a2..99ffe9f263 100644
--- a/lib/ansible/modules/expect.py
+++ b/lib/ansible/modules/expect.py
@@ -90,7 +90,7 @@ author: "Matt Martz (@sivel)"
EXAMPLES = r'''
- name: Case insensitive password string match
ansible.builtin.expect:
- ansible.builtin.command: passwd username
+ command: passwd username
responses:
(?i)password: "MySekretPa$$word"
# you don't want to show passwords in your logs
@@ -98,7 +98,7 @@ EXAMPLES = r'''
- name: Generic question with multiple different responses
ansible.builtin.expect:
- ansible.builtin.command: /path/to/custom/command
+ command: /path/to/custom/command
responses:
Question:
- response1
diff --git a/lib/ansible/modules/replace.py b/lib/ansible/modules/replace.py
index 6dfd677927..4b8f74f562 100644
--- a/lib/ansible/modules/replace.py
+++ b/lib/ansible/modules/replace.py
@@ -110,7 +110,7 @@ notes:
'''
EXAMPLES = r'''
-- name: Before Ansible 2.3, option 'dest', 'destfile' or 'name' was used instead of 'path'
+- name: Replace old hostname with new hostname (requires Ansible >= 2.4)
ansible.builtin.replace:
path: /etc/hosts
regexp: '(\s+)old\.host\.name(\s+.*)?$'