Skip to content

Commit 20209c5

Browse files
authored
docs: update module development docs (#70594)
Update module development docs for flattened modules directory. Fixes: #70261 (at least partially) Signed-off-by: Abhijeet Kasurde <[email protected]>
1 parent 38ccfb4 commit 20209c5

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

docs/docsite/rst/dev_guide/developing_modules_general.rst

+12-10
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Starting a new module
5151

5252
To create a new module:
5353

54-
1. Navigate to the correct directory for your new module: ``$ cd lib/ansible/modules/cloud/azure/``
54+
1. Navigate to the correct directory for your new module: ``$ cd lib/ansible/modules/``
5555
2. Create your new module file: ``$ touch my_test.py``
5656
3. Paste the content below into your new module file. It includes the :ref:`required Ansible format and documentation <developing_modules_documenting>` and some example code.
5757
4. Modify and extend the code to do what you want your new module to do. See the :ref:`programming tips <developing_modules_best_practices>` and :ref:`Python 3 compatibility <developing_python_3>` pages for pointers on writing clean, concise module code.
@@ -62,8 +62,10 @@ To create a new module:
6262
6363
# Copyright: (c) 2018, Terry Jones <[email protected]>
6464
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
65+
from __future__ import (absolute_import, division, print_function)
66+
__metaclass__ = type
6567
66-
DOCUMENTATION = '''
68+
DOCUMENTATION = r'''
6769
---
6870
module: my_test
6971
@@ -72,19 +74,19 @@ To create a new module:
7274
version_added: "2.4"
7375
7476
description:
75-
- "This is my longer description explaining my test module"
77+
- "This is my longer description explaining my test module."
7678
7779
options:
7880
name:
7981
description:
80-
- This is the message to send to the test module
81-
type: str
82+
- This is the message to send to the test module.
8283
required: true
84+
type: str
8385
new:
8486
description:
85-
- Control to demo if the result of this module is changed or not
86-
type: bool
87+
- Control to demo if the result of this module is changed or not.
8788
required: false
89+
type: bool
8890
8991
extends_documentation_fragment:
9092
- azure
@@ -93,7 +95,7 @@ To create a new module:
9395
- Your Name (@yourhandle)
9496
'''
9597
96-
EXAMPLES = '''
98+
EXAMPLES = r'''
9799
# Pass in a message
98100
- name: Test with a message
99101
my_test:
@@ -111,7 +113,7 @@ To create a new module:
111113
name: fail me
112114
'''
113115
114-
RETURN = '''
116+
RETURN = r'''
115117
original_message:
116118
description: The original name param that was passed in
117119
type: str
@@ -210,7 +212,7 @@ If your module does not need to target a remote host, you can quickly and easily
210212
development) activate it: ``$ . venv/bin/activate``
211213
- Setup the environment for development: ``$ . hacking/env-setup``
212214
- Run your test module locally and directly:
213-
``$ python -m ansible.modules.cloud.azure.my_test /tmp/args.json``
215+
``$ python -m ansible.modules.my_test /tmp/args.json``
214216

215217
This should return output like this:
216218

0 commit comments

Comments
 (0)