1. Navigate to the correct directory for your new module: ``$ cd lib/ansible/modules/cloud/azure/``
1. Navigate to the correct directory for your new module: ``$ cd lib/ansible/modules/cloud/azure/``
2. Create your new module file: ``$ touch my_new_test_module.py``
2. Create your new module file: ``$ touch my_test.py``
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.
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.
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.
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.
@ -71,19 +71,19 @@ To create a new module:
DOCUMENTATION = '''
DOCUMENTATION = '''
---
---
module: my_sample_module
module: my_test
short_description: This is my sample module
short_description: This is my test module
version_added: "2.4"
version_added: "2.4"
description:
description:
- "This is my longer description explaining my sample module"
- "This is my longer description explaining my test module"
options:
options:
name:
name:
description:
description:
- This is the message to send to the sample module
- This is the message to send to the test module
required: true
required: true
new:
new:
description:
description:
@ -100,18 +100,18 @@ To create a new module:
EXAMPLES = '''
EXAMPLES = '''
# Pass in a message
# Pass in a message
- name: Test with a message
- name: Test with a message
my_new_test_module:
my_test:
name: hello world
name: hello world
# pass in a message and have changed true
# pass in a message and have changed true
- name: Test with a message and changed output
- name: Test with a message and changed output
my_new_test_module:
my_test:
name: hello world
name: hello world
new: true
new: true
# fail the module
# fail the module
- name: Test failure of the module
- name: Test failure of the module
my_new_test_module:
my_test:
name: fail me
name: fail me
'''
'''
@ -121,7 +121,7 @@ To create a new module:
type: str
type: str
returned: always
returned: always
message:
message:
description: The output message that the sample module generates
description: The output message that the test module generates
type: str
type: str
returned: always
returned: always
'''
'''
@ -214,7 +214,7 @@ If your module does not need to target a remote host, you can quickly and easily