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/``
2. Create your new module file: ``$ touch my_test.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.
@ -62,8 +62,10 @@ To create a new module:
# Copyright: (c) 2018, Terry Jones <terry.jones@example.org>
# Copyright: (c) 2018, Terry Jones <terry.jones@example.org>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
DOCUMENTATION = r'''
---
---
module: my_test
module: my_test
@ -72,19 +74,19 @@ To create a new module:
version_added: "2.4"
version_added: "2.4"
description:
description:
- "This is my longer description explaining my test module"
- "This is my longer description explaining my test module."
options:
options:
name:
name:
description:
description:
- This is the message to send to the test module
- This is the message to send to the test module.
type: str
required: true
required: true
type: str
new:
new:
description:
description:
- Control to demo if the result of this module is changed or not
- Control to demo if the result of this module is changed or not.
type: bool
required: false
required: false
type: bool
extends_documentation_fragment:
extends_documentation_fragment:
- azure
- azure
@ -93,7 +95,7 @@ To create a new module:
- Your Name (@yourhandle)
- Your Name (@yourhandle)
'''
'''
EXAMPLES = '''
EXAMPLES = r'''
# Pass in a message
# Pass in a message
- name: Test with a message
- name: Test with a message
my_test:
my_test:
@ -111,7 +113,7 @@ To create a new module:
name: fail me
name: fail me
'''
'''
RETURN = '''
RETURN = r'''
original_message:
original_message:
description: The original name param that was passed in
description: The original name param that was passed in
type: str
type: str
@ -210,7 +212,7 @@ If your module does not need to target a remote host, you can quickly and easily