We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Missing tags and skip_tags on awx.awx.workflow_launch module
### Please confirm the following

- [X] I agree to follow this project's [code of conduct](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html).
- [X] I have checked the [current issues](https://github.com/ansible/awx/issues) for duplicates.
- [X] I understand that AWX is open source software provided for free and that I might not receive a timely response.
- [X] I am **NOT** reporting a (potential) security vulnerability. (These should be emailed to `security@ansible.com` instead.)

### Bug Summary

The UI and API support launching a workflow with `skip_tags` and `job_tags` set. This is not currently possible with the `workflow_launch` module.

### AWX version

devel

### Select the relevant components

- [ ] UI
- [ ] UI (tech preview)
- [ ] API
- [ ] Docs
- [X] Collection
- [ ] CLI
- [ ] Other

### Installation method

N/A

### Modifications

no

### Ansible version

2.15.2

### Operating system

_No response_

### Web browser

_No response_

### Steps to reproduce

<img width="1106" alt="Screenshot 2024-03-19 at 11 26 20" src="https://github.com/ansible/awx/assets/9056568/878ee7f0-57d3-4365-9353-46aa6f99d009">

Through the UI you can set job_tags or skip_tags if the relevant `ask_for_` is true.

In the collection this is not possible

### Expected results

The `skip_tags` and `tags` option should be possible as below
```
- name: Kickoff workflow
      awx.awx.workflow_launch:
        name: wf_test
        wait: false
        skip_tags:
          - sometag
        tags:
          - mytag
```

### Actual results

The options are not included on the module

### Additional information

_No response_

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `awx_collection/plugins/modules/workflow_launch.py`
Content:
```
1 #!/usr/bin/python
2 # coding: utf-8 -*-
3 
4 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5 
6 from __future__ import absolute_import, division, print_function
7 
8 __metaclass__ = type
9 
10 ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'}
11 
12 DOCUMENTATION = '''
13 ---
14 module: workflow_launch
15 author: "John Westcott IV (@john-westcott-iv)"
16 short_description: Run a workflow in Automation Platform Controller
17 description:
18     - Launch an Automation Platform Controller workflows. See
19       U(https://www.ansible.com/tower) for an overview.
20 options:
21     name:
22       description:
23         - The name of the workflow template to run.
24       required: True
25       type: str
26       aliases:
27         - workflow_template
28     organization:
29       description:
30         - Organization name, ID, or named URL the workflow job template exists in.
31         - Used to help lookup the object, cannot be modified using this module.
32         - If not provided, will lookup by name only, which does not work with duplicates.
33       type: str
34     inventory:
35       description:
36         - Inventory name, ID, or named URL to use for the job ran with this workflow, only used if prompt for inventory is set.
37       type: str
38     limit:
39       description:
40         - Limit to use for the I(job_template).
41       type: str
42     scm_branch:
43       description:
44         - A specific branch of the SCM project to run the template on.
45         - This is only applicable if your project allows for branch override.
46       type: str
47     extra_vars:
48       description:
49         - Any extra vars required to launch the job.
50       type: dict
51     wait:
52       description:
53         - Wait for the workflow to complete.
54       default: True
55       type: bool
56     interval:
57       description:
58         - The interval to request an update from the controller.
59       required: False
60       default: 2
61       type: float
62     timeout:
63       description:
64         - If waiting for the workflow to complete this will abort after this
65           amount of seconds
66       type: int
67 extends_documentation_fragment: awx.awx.auth
68 '''
69 
70 RETURN = '''
71 job_info:
72     description: dictionary containing information about the workflow executed
73     returned: If workflow launched
74     type: dict
75 '''
76 
77 
78 EXAMPLES = '''
79 - name: Launch a workflow with a timeout of 10 seconds
80   workflow_launch:
81     workflow_template: "Test Workflow"
82     timeout: 10
83 
84 - name: Launch a Workflow with extra_vars without waiting
85   workflow_launch:
86     workflow_template: "Test workflow"
87     extra_vars:
88       var1: My First Variable
89       var2: My Second Variable
90     wait: False
91 '''
92 
93 from ..module_utils.controller_api import ControllerAPIModule
94 
95 
96 def main():
97     # Any additional arguments that are not fields of the item can be added here
98     argument_spec = dict(
99         name=dict(required=True, aliases=['workflow_template']),
100         organization=dict(),
101         inventory=dict(),
102         limit=dict(),
103         scm_branch=dict(),
104         extra_vars=dict(type='dict'),
105         wait=dict(required=False, default=True, type='bool'),
106         interval=dict(required=False, default=2.0, type='float'),
107         timeout=dict(required=False, type='int'),
108     )
109 
110     # Create a module for ourselves
111     module = ControllerAPIModule(argument_spec=argument_spec)
112 
113     optional_args = {}
114     # Extract our parameters
115     name = module.params.get('name')
116     organization = module.params.get('organization')
117     inventory = module.params.get('inventory')
118     wait = module.params.get('wait')
119     interval = module.params.get('interval')
120     timeout = module.params.get('timeout')
121 
122     for field_name in (
123         'limit',
124         'extra_vars',
125         'scm_branch',
126     ):
127         field_val = module.params.get(field_name)
128         if field_val is not None:
129             optional_args[field_name] = field_val
130 
131     # Create a datastructure to pass into our job launch
132     post_data = {}
133     for arg_name, arg_value in optional_args.items():
134         if arg_value:
135             post_data[arg_name] = arg_value
136 
137     # Attempt to look up the related items the user specified (these will fail the module if not found)
138     if inventory:
139         post_data['inventory'] = module.resolve_name_to_id('inventories', inventory)
140 
141     # Attempt to look up job_template based on the provided name
142     lookup_data = {}
143     if organization:
144         lookup_data['organization'] = module.resolve_name_to_id('organizations', organization)
145     workflow_job_template = module.get_one('workflow_job_templates', name_or_id=name, data=lookup_data)
146 
147     if workflow_job_template is None:
148         module.fail_json(msg="Unable to find workflow job template")
149 
150     # The API will allow you to submit values to a jb launch that are not prompt on launch.
151     # Therefore, we will test to see if anything is set which is not prompt on launch and fail.
152     check_vars_to_prompts = {
153         'inventory': 'ask_inventory_on_launch',
154         'limit': 'ask_limit_on_launch',
155         'scm_branch': 'ask_scm_branch_on_launch',
156     }
157 
158     param_errors = []
159     for variable_name, prompt in check_vars_to_prompts.items():
160         if variable_name in post_data and not workflow_job_template[prompt]:
161             param_errors.append("The field {0} was specified but the workflow job template does not allow for it to be overridden".format(variable_name))
162     # Check if Either ask_variables_on_launch, or survey_enabled is enabled for use of extra vars.
163     if module.params.get('extra_vars') and not (workflow_job_template['ask_variables_on_launch'] or workflow_job_template['survey_enabled']):
164         param_errors.append("The field extra_vars was specified but the workflow job template does not allow for it to be overridden")
165     if len(param_errors) > 0:
166         module.fail_json(msg="Parameters specified which can not be passed into workflow job template, see errors for details", errors=param_errors)
167 
168     # Launch the job
169     result = module.post_endpoint(workflow_job_template['related']['launch'], data=post_data)
170 
171     if result['status_code'] != 201:
172         module.fail_json(msg="Failed to launch workflow, see response for details", response=result)
173 
174     module.json_output['changed'] = True
175     module.json_output['id'] = result['json']['id']
176     module.json_output['status'] = result['json']['status']
177     # This is for backwards compatability
178     module.json_output['job_info'] = {'id': result['json']['id']}
179 
180     if not wait:
181         module.exit_json(**module.json_output)
182 
183     # Invoke wait function
184     module.wait_on_url(url=result['json']['url'], object_name=name, object_type='Workflow Job', timeout=timeout, interval=interval)
185 
186     module.exit_json(**module.json_output)
187 
188 
189 if __name__ == '__main__':
190     main()
191
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/awx_collection/plugins/modules/workflow_launch.py b/awx_collection/plugins/modules/workflow_launch.py
--- a/awx_collection/plugins/modules/workflow_launch.py
+++ b/awx_collection/plugins/modules/workflow_launch.py
@@ -39,6 +39,16 @@
       description:
         - Limit to use for the I(job_template).
       type: str
+    tags:
+      description:
+        - Specific tags to apply from the I(job_template).
+      type: list
+      elements: str
+    skip_tags:
+      description:
+        - Specific tags to skip from the I(job_template).
+      type: list
+      elements: str
     scm_branch:
       description:
         - A specific branch of the SCM project to run the template on.
@@ -100,6 +110,8 @@
         organization=dict(),
         inventory=dict(),
         limit=dict(),
+        tags=dict(type='list', elements='str'),
+        skip_tags=dict(type='list', elements='str'),
         scm_branch=dict(),
         extra_vars=dict(type='dict'),
         wait=dict(required=False, default=True, type='bool'),
@@ -128,6 +140,14 @@
         if field_val is not None:
             optional_args[field_name] = field_val
 
+    # Special treatment of tags parameters
+    job_tags = module.params.get('tags')
+    if job_tags is not None:
+        optional_args['job_tags'] = ",".join(job_tags)
+    skip_tags = module.params.get('skip_tags')
+    if skip_tags is not None:
+        optional_args['skip_tags'] = ",".join(skip_tags)
+
     # Create a datastructure to pass into our job launch
     post_data = {}
     for arg_name, arg_value in optional_args.items():
@@ -152,6 +172,8 @@
     check_vars_to_prompts = {
         'inventory': 'ask_inventory_on_launch',
         'limit': 'ask_limit_on_launch',
+        'job_tags': 'ask_tags_on_launch',
+        'skip_tags': 'ask_skip_tags_on_launch',
         'scm_branch': 'ask_scm_branch_on_launch',
     }

{"golden_diff": "diff --git a/awx_collection/plugins/modules/workflow_launch.py b/awx_collection/plugins/modules/workflow_launch.py\n--- a/awx_collection/plugins/modules/workflow_launch.py\n+++ b/awx_collection/plugins/modules/workflow_launch.py\n@@ -39,6 +39,16 @@\n       description:\n         - Limit to use for the I(job_template).\n       type: str\n+    tags:\n+      description:\n+        - Specific tags to apply from the I(job_template).\n+      type: list\n+      elements: str\n+    skip_tags:\n+      description:\n+        - Specific tags to skip from the I(job_template).\n+      type: list\n+      elements: str\n     scm_branch:\n       description:\n         - A specific branch of the SCM project to run the template on.\n@@ -100,6 +110,8 @@\n         organization=dict(),\n         inventory=dict(),\n         limit=dict(),\n+        tags=dict(type='list', elements='str'),\n+        skip_tags=dict(type='list', elements='str'),\n         scm_branch=dict(),\n         extra_vars=dict(type='dict'),\n         wait=dict(required=False, default=True, type='bool'),\n@@ -128,6 +140,14 @@\n         if field_val is not None:\n             optional_args[field_name] = field_val\n \n+    # Special treatment of tags parameters\n+    job_tags = module.params.get('tags')\n+    if job_tags is not None:\n+        optional_args['job_tags'] = \",\".join(job_tags)\n+    skip_tags = module.params.get('skip_tags')\n+    if skip_tags is not None:\n+        optional_args['skip_tags'] = \",\".join(skip_tags)\n+\n     # Create a datastructure to pass into our job launch\n     post_data = {}\n     for arg_name, arg_value in optional_args.items():\n@@ -152,6 +172,8 @@\n     check_vars_to_prompts = {\n         'inventory': 'ask_inventory_on_launch',\n         'limit': 'ask_limit_on_launch',\n+        'job_tags': 'ask_tags_on_launch',\n+        'skip_tags': 'ask_skip_tags_on_launch',\n         'scm_branch': 'ask_scm_branch_on_launch',\n     }\n", "issue": "Missing tags and skip_tags on awx.awx.workflow_launch module\n### Please confirm the following\n\n- [X] I agree to follow this project's [code of conduct](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html).\n- [X] I have checked the [current issues](https://github.com/ansible/awx/issues) for duplicates.\n- [X] I understand that AWX is open source software provided for free and that I might not receive a timely response.\n- [X] I am **NOT** reporting a (potential) security vulnerability. (These should be emailed to `security@ansible.com` instead.)\n\n### Bug Summary\n\nThe UI and API support launching a workflow with `skip_tags` and `job_tags` set. This is not currently possible with the `workflow_launch` module.\n\n### AWX version\n\ndevel\n\n### Select the relevant components\n\n- [ ] UI\n- [ ] UI (tech preview)\n- [ ] API\n- [ ] Docs\n- [X] Collection\n- [ ] CLI\n- [ ] Other\n\n### Installation method\n\nN/A\n\n### Modifications\n\nno\n\n### Ansible version\n\n2.15.2\n\n### Operating system\n\n_No response_\n\n### Web browser\n\n_No response_\n\n### Steps to reproduce\n\n<img width=\"1106\" alt=\"Screenshot 2024-03-19 at 11 26 20\" src=\"https://github.com/ansible/awx/assets/9056568/878ee7f0-57d3-4365-9353-46aa6f99d009\">\r\n\r\nThrough the UI you can set job_tags or skip_tags if the relevant `ask_for_` is true.\r\n\r\nIn the collection this is not possible\n\n### Expected results\n\nThe `skip_tags` and `tags` option should be possible as below\r\n```\r\n- name: Kickoff workflow\r\n      awx.awx.workflow_launch:\r\n        name: wf_test\r\n        wait: false\r\n        skip_tags:\r\n          - sometag\r\n        tags:\r\n          - mytag\r\n```\n\n### Actual results\n\nThe options are not included on the module\n\n### Additional information\n\n_No response_\n", "before_files": [{"content": "#!/usr/bin/python\n# coding: utf-8 -*-\n\n# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)\n\nfrom __future__ import absolute_import, division, print_function\n\n__metaclass__ = type\n\nANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'}\n\nDOCUMENTATION = '''\n---\nmodule: workflow_launch\nauthor: \"John Westcott IV (@john-westcott-iv)\"\nshort_description: Run a workflow in Automation Platform Controller\ndescription:\n    - Launch an Automation Platform Controller workflows. See\n      U(https://www.ansible.com/tower) for an overview.\noptions:\n    name:\n      description:\n        - The name of the workflow template to run.\n      required: True\n      type: str\n      aliases:\n        - workflow_template\n    organization:\n      description:\n        - Organization name, ID, or named URL the workflow job template exists in.\n        - Used to help lookup the object, cannot be modified using this module.\n        - If not provided, will lookup by name only, which does not work with duplicates.\n      type: str\n    inventory:\n      description:\n        - Inventory name, ID, or named URL to use for the job ran with this workflow, only used if prompt for inventory is set.\n      type: str\n    limit:\n      description:\n        - Limit to use for the I(job_template).\n      type: str\n    scm_branch:\n      description:\n        - A specific branch of the SCM project to run the template on.\n        - This is only applicable if your project allows for branch override.\n      type: str\n    extra_vars:\n      description:\n        - Any extra vars required to launch the job.\n      type: dict\n    wait:\n      description:\n        - Wait for the workflow to complete.\n      default: True\n      type: bool\n    interval:\n      description:\n        - The interval to request an update from the controller.\n      required: False\n      default: 2\n      type: float\n    timeout:\n      description:\n        - If waiting for the workflow to complete this will abort after this\n          amount of seconds\n      type: int\nextends_documentation_fragment: awx.awx.auth\n'''\n\nRETURN = '''\njob_info:\n    description: dictionary containing information about the workflow executed\n    returned: If workflow launched\n    type: dict\n'''\n\n\nEXAMPLES = '''\n- name: Launch a workflow with a timeout of 10 seconds\n  workflow_launch:\n    workflow_template: \"Test Workflow\"\n    timeout: 10\n\n- name: Launch a Workflow with extra_vars without waiting\n  workflow_launch:\n    workflow_template: \"Test workflow\"\n    extra_vars:\n      var1: My First Variable\n      var2: My Second Variable\n    wait: False\n'''\n\nfrom ..module_utils.controller_api import ControllerAPIModule\n\n\ndef main():\n    # Any additional arguments that are not fields of the item can be added here\n    argument_spec = dict(\n        name=dict(required=True, aliases=['workflow_template']),\n        organization=dict(),\n        inventory=dict(),\n        limit=dict(),\n        scm_branch=dict(),\n        extra_vars=dict(type='dict'),\n        wait=dict(required=False, default=True, type='bool'),\n        interval=dict(required=False, default=2.0, type='float'),\n        timeout=dict(required=False, type='int'),\n    )\n\n    # Create a module for ourselves\n    module = ControllerAPIModule(argument_spec=argument_spec)\n\n    optional_args = {}\n    # Extract our parameters\n    name = module.params.get('name')\n    organization = module.params.get('organization')\n    inventory = module.params.get('inventory')\n    wait = module.params.get('wait')\n    interval = module.params.get('interval')\n    timeout = module.params.get('timeout')\n\n    for field_name in (\n        'limit',\n        'extra_vars',\n        'scm_branch',\n    ):\n        field_val = module.params.get(field_name)\n        if field_val is not None:\n            optional_args[field_name] = field_val\n\n    # Create a datastructure to pass into our job launch\n    post_data = {}\n    for arg_name, arg_value in optional_args.items():\n        if arg_value:\n            post_data[arg_name] = arg_value\n\n    # Attempt to look up the related items the user specified (these will fail the module if not found)\n    if inventory:\n        post_data['inventory'] = module.resolve_name_to_id('inventories', inventory)\n\n    # Attempt to look up job_template based on the provided name\n    lookup_data = {}\n    if organization:\n        lookup_data['organization'] = module.resolve_name_to_id('organizations', organization)\n    workflow_job_template = module.get_one('workflow_job_templates', name_or_id=name, data=lookup_data)\n\n    if workflow_job_template is None:\n        module.fail_json(msg=\"Unable to find workflow job template\")\n\n    # The API will allow you to submit values to a jb launch that are not prompt on launch.\n    # Therefore, we will test to see if anything is set which is not prompt on launch and fail.\n    check_vars_to_prompts = {\n        'inventory': 'ask_inventory_on_launch',\n        'limit': 'ask_limit_on_launch',\n        'scm_branch': 'ask_scm_branch_on_launch',\n    }\n\n    param_errors = []\n    for variable_name, prompt in check_vars_to_prompts.items():\n        if variable_name in post_data and not workflow_job_template[prompt]:\n            param_errors.append(\"The field {0} was specified but the workflow job template does not allow for it to be overridden\".format(variable_name))\n    # Check if Either ask_variables_on_launch, or survey_enabled is enabled for use of extra vars.\n    if module.params.get('extra_vars') and not (workflow_job_template['ask_variables_on_launch'] or workflow_job_template['survey_enabled']):\n        param_errors.append(\"The field extra_vars was specified but the workflow job template does not allow for it to be overridden\")\n    if len(param_errors) > 0:\n        module.fail_json(msg=\"Parameters specified which can not be passed into workflow job template, see errors for details\", errors=param_errors)\n\n    # Launch the job\n    result = module.post_endpoint(workflow_job_template['related']['launch'], data=post_data)\n\n    if result['status_code'] != 201:\n        module.fail_json(msg=\"Failed to launch workflow, see response for details\", response=result)\n\n    module.json_output['changed'] = True\n    module.json_output['id'] = result['json']['id']\n    module.json_output['status'] = result['json']['status']\n    # This is for backwards compatability\n    module.json_output['job_info'] = {'id': result['json']['id']}\n\n    if not wait:\n        module.exit_json(**module.json_output)\n\n    # Invoke wait function\n    module.wait_on_url(url=result['json']['url'], object_name=name, object_type='Workflow Job', timeout=timeout, interval=interval)\n\n    module.exit_json(**module.json_output)\n\n\nif __name__ == '__main__':\n    main()\n", "path": "awx_collection/plugins/modules/workflow_launch.py"}], "after_files": [{"content": "#!/usr/bin/python\n# coding: utf-8 -*-\n\n# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)\n\nfrom __future__ import absolute_import, division, print_function\n\n__metaclass__ = type\n\nANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'}\n\nDOCUMENTATION = '''\n---\nmodule: workflow_launch\nauthor: \"John Westcott IV (@john-westcott-iv)\"\nshort_description: Run a workflow in Automation Platform Controller\ndescription:\n    - Launch an Automation Platform Controller workflows. See\n      U(https://www.ansible.com/tower) for an overview.\noptions:\n    name:\n      description:\n        - The name of the workflow template to run.\n      required: True\n      type: str\n      aliases:\n        - workflow_template\n    organization:\n      description:\n        - Organization name, ID, or named URL the workflow job template exists in.\n        - Used to help lookup the object, cannot be modified using this module.\n        - If not provided, will lookup by name only, which does not work with duplicates.\n      type: str\n    inventory:\n      description:\n        - Inventory name, ID, or named URL to use for the job ran with this workflow, only used if prompt for inventory is set.\n      type: str\n    limit:\n      description:\n        - Limit to use for the I(job_template).\n      type: str\n    tags:\n      description:\n        - Specific tags to apply from the I(job_template).\n      type: list\n      elements: str\n    skip_tags:\n      description:\n        - Specific tags to skip from the I(job_template).\n      type: list\n      elements: str\n    scm_branch:\n      description:\n        - A specific branch of the SCM project to run the template on.\n        - This is only applicable if your project allows for branch override.\n      type: str\n    extra_vars:\n      description:\n        - Any extra vars required to launch the job.\n      type: dict\n    wait:\n      description:\n        - Wait for the workflow to complete.\n      default: True\n      type: bool\n    interval:\n      description:\n        - The interval to request an update from the controller.\n      required: False\n      default: 2\n      type: float\n    timeout:\n      description:\n        - If waiting for the workflow to complete this will abort after this\n          amount of seconds\n      type: int\nextends_documentation_fragment: awx.awx.auth\n'''\n\nRETURN = '''\njob_info:\n    description: dictionary containing information about the workflow executed\n    returned: If workflow launched\n    type: dict\n'''\n\n\nEXAMPLES = '''\n- name: Launch a workflow with a timeout of 10 seconds\n  workflow_launch:\n    workflow_template: \"Test Workflow\"\n    timeout: 10\n\n- name: Launch a Workflow with extra_vars without waiting\n  workflow_launch:\n    workflow_template: \"Test workflow\"\n    extra_vars:\n      var1: My First Variable\n      var2: My Second Variable\n    wait: False\n'''\n\nfrom ..module_utils.controller_api import ControllerAPIModule\n\n\ndef main():\n    # Any additional arguments that are not fields of the item can be added here\n    argument_spec = dict(\n        name=dict(required=True, aliases=['workflow_template']),\n        organization=dict(),\n        inventory=dict(),\n        limit=dict(),\n        tags=dict(type='list', elements='str'),\n        skip_tags=dict(type='list', elements='str'),\n        scm_branch=dict(),\n        extra_vars=dict(type='dict'),\n        wait=dict(required=False, default=True, type='bool'),\n        interval=dict(required=False, default=2.0, type='float'),\n        timeout=dict(required=False, type='int'),\n    )\n\n    # Create a module for ourselves\n    module = ControllerAPIModule(argument_spec=argument_spec)\n\n    optional_args = {}\n    # Extract our parameters\n    name = module.params.get('name')\n    organization = module.params.get('organization')\n    inventory = module.params.get('inventory')\n    wait = module.params.get('wait')\n    interval = module.params.get('interval')\n    timeout = module.params.get('timeout')\n\n    for field_name in (\n        'limit',\n        'extra_vars',\n        'scm_branch',\n    ):\n        field_val = module.params.get(field_name)\n        if field_val is not None:\n            optional_args[field_name] = field_val\n\n    # Special treatment of tags parameters\n    job_tags = module.params.get('tags')\n    if job_tags is not None:\n        optional_args['job_tags'] = \",\".join(job_tags)\n    skip_tags = module.params.get('skip_tags')\n    if skip_tags is not None:\n        optional_args['skip_tags'] = \",\".join(skip_tags)\n\n    # Create a datastructure to pass into our job launch\n    post_data = {}\n    for arg_name, arg_value in optional_args.items():\n        if arg_value:\n            post_data[arg_name] = arg_value\n\n    # Attempt to look up the related items the user specified (these will fail the module if not found)\n    if inventory:\n        post_data['inventory'] = module.resolve_name_to_id('inventories', inventory)\n\n    # Attempt to look up job_template based on the provided name\n    lookup_data = {}\n    if organization:\n        lookup_data['organization'] = module.resolve_name_to_id('organizations', organization)\n    workflow_job_template = module.get_one('workflow_job_templates', name_or_id=name, data=lookup_data)\n\n    if workflow_job_template is None:\n        module.fail_json(msg=\"Unable to find workflow job template\")\n\n    # The API will allow you to submit values to a jb launch that are not prompt on launch.\n    # Therefore, we will test to see if anything is set which is not prompt on launch and fail.\n    check_vars_to_prompts = {\n        'inventory': 'ask_inventory_on_launch',\n        'limit': 'ask_limit_on_launch',\n        'job_tags': 'ask_tags_on_launch',\n        'skip_tags': 'ask_skip_tags_on_launch',\n        'scm_branch': 'ask_scm_branch_on_launch',\n    }\n\n    param_errors = []\n    for variable_name, prompt in check_vars_to_prompts.items():\n        if variable_name in post_data and not workflow_job_template[prompt]:\n            param_errors.append(\"The field {0} was specified but the workflow job template does not allow for it to be overridden\".format(variable_name))\n    # Check if Either ask_variables_on_launch, or survey_enabled is enabled for use of extra vars.\n    if module.params.get('extra_vars') and not (workflow_job_template['ask_variables_on_launch'] or workflow_job_template['survey_enabled']):\n        param_errors.append(\"The field extra_vars was specified but the workflow job template does not allow for it to be overridden\")\n    if len(param_errors) > 0:\n        module.fail_json(msg=\"Parameters specified which can not be passed into workflow job template, see errors for details\", errors=param_errors)\n\n    # Launch the job\n    result = module.post_endpoint(workflow_job_template['related']['launch'], data=post_data)\n\n    if result['status_code'] != 201:\n        module.fail_json(msg=\"Failed to launch workflow, see response for details\", response=result)\n\n    module.json_output['changed'] = True\n    module.json_output['id'] = result['json']['id']\n    module.json_output['status'] = result['json']['status']\n    # This is for backwards compatability\n    module.json_output['job_info'] = {'id': result['json']['id']}\n\n    if not wait:\n        module.exit_json(**module.json_output)\n\n    # Invoke wait function\n    module.wait_on_url(url=result['json']['url'], object_name=name, object_type='Workflow Job', timeout=timeout, interval=interval)\n\n    module.exit_json(**module.json_output)\n\n\nif __name__ == '__main__':\n    main()\n", "path": "awx_collection/plugins/modules/workflow_launch.py"}]}