mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
1st draft of include role docs
This commit is contained in:
parent
751eab187f
commit
b7d2c62f2b
1 changed files with 56 additions and 0 deletions
56
lib/ansible/modules/utilities/logic/include_role.py
Normal file
56
lib/ansible/modules/utilities/logic/include_role.py
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
# -*- mode: python -*-
|
||||||
|
# Ansible is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
DOCUMENTATION = '''
|
||||||
|
---
|
||||||
|
author:
|
||||||
|
- "Ansible Core Team (@ansible)"
|
||||||
|
module: include_role
|
||||||
|
short_description: Load and execute a role
|
||||||
|
description:
|
||||||
|
- "Loads and executes a role as a task, this frees roles from the `role:` directive and allows them to be treated more as tasks."
|
||||||
|
version_added: "2.2"
|
||||||
|
options:
|
||||||
|
name:
|
||||||
|
description:
|
||||||
|
- The name of the role to be executed.
|
||||||
|
required: True
|
||||||
|
tasks_from:
|
||||||
|
description:
|
||||||
|
- "File to load from a Role's tasks/ directory."
|
||||||
|
required: False
|
||||||
|
default: 'main'
|
||||||
|
notes:
|
||||||
|
- THIS IS EARLY PREVIEW, THINGS MAY CHANGE
|
||||||
|
- Only basic roles have been tested for now, some things might not work as expected.
|
||||||
|
- Handlers are made available to the whole play.
|
||||||
|
- Currently role variables are not pushed up to the play.
|
||||||
|
- "Things not tested (yet): loops, plugin overrides, nesting includes, role dependencies, used as handler, other stuff I did not think of when I wrote this."
|
||||||
|
'''
|
||||||
|
|
||||||
|
EXAMPLES = """
|
||||||
|
- include_role: name=myrole
|
||||||
|
|
||||||
|
- name: Run tasks/other.yml instead of 'main'
|
||||||
|
include_role:
|
||||||
|
role: myrole
|
||||||
|
tasks_from: other
|
||||||
|
|
||||||
|
- name: Pass variables to role
|
||||||
|
include_role:
|
||||||
|
name: myrole
|
||||||
|
vars:
|
||||||
|
rolevar1: 'value from task'
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
RETURN = """
|
||||||
|
# this module does not return anything except tasks to execute
|
||||||
|
"""
|
Loading…
Reference in a new issue