We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
idrac_redfish_command module - requesting job_id on the output
### Summary

idrac_redfish_command CreateBiosConfigJob  command doesn't return job id now. I'm trying to check if job is completed before moving to next steps. This will ensure system is consistent state before next steps are executed.

### Issue Type

Feature Idea

### Component Name

idrac_redfish_command

### Additional Information

<!--- Paste example playbooks or commands between quotes below -->
```yaml (paste below)
- name: Create BIOS Config job
  community.general.idrac_redfish_command:
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"
    category: Systems
    command: CreateBiosConfigJob
  register: bios_job

- debug:
     msg: "{{ bios_job.job_id }}


```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `plugins/modules/idrac_redfish_command.py`
Content:
```
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 
4 # Copyright (c) 2018 Dell EMC Inc.
5 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
6 # SPDX-License-Identifier: GPL-3.0-or-later
7 
8 from __future__ import absolute_import, division, print_function
9 __metaclass__ = type
10 
11 DOCUMENTATION = '''
12 ---
13 module: idrac_redfish_command
14 short_description: Manages Out-Of-Band controllers using iDRAC OEM Redfish APIs
15 description:
16   - Builds Redfish URIs locally and sends them to remote OOB controllers to
17     perform an action.
18   - For use with Dell iDRAC operations that require Redfish OEM extensions.
19 extends_documentation_fragment:
20   - community.general.attributes
21 attributes:
22   check_mode:
23     support: none
24   diff_mode:
25     support: none
26 options:
27   category:
28     required: true
29     description:
30       - Category to execute on iDRAC.
31     type: str
32   command:
33     required: true
34     description:
35       - List of commands to execute on iDRAC.
36     type: list
37     elements: str
38   baseuri:
39     required: true
40     description:
41       - Base URI of iDRAC.
42     type: str
43   username:
44     description:
45       - Username for authenticating to iDRAC.
46     type: str
47   password:
48     description:
49       - Password for authenticating to iDRAC.
50     type: str
51   auth_token:
52     description:
53       - Security token for authenticating to iDRAC.
54     type: str
55     version_added: 2.3.0
56   timeout:
57     description:
58       - Timeout in seconds for HTTP requests to iDRAC.
59     default: 10
60     type: int
61   resource_id:
62     required: false
63     description:
64       - ID of the System, Manager or Chassis to modify.
65     type: str
66     version_added: '0.2.0'
67 
68 author: "Jose Delarosa (@jose-delarosa)"
69 '''
70 
71 EXAMPLES = '''
72   - name: Create BIOS configuration job (schedule BIOS setting update)
73     community.general.idrac_redfish_command:
74       category: Systems
75       command: CreateBiosConfigJob
76       resource_id: System.Embedded.1
77       baseuri: "{{ baseuri }}"
78       username: "{{ username }}"
79       password: "{{ password }}"
80 '''
81 
82 RETURN = '''
83 msg:
84     description: Message with action result or error description
85     returned: always
86     type: str
87     sample: "Action was successful"
88 '''
89 
90 import re
91 from ansible.module_utils.basic import AnsibleModule
92 from ansible_collections.community.general.plugins.module_utils.redfish_utils import RedfishUtils
93 from ansible.module_utils.common.text.converters import to_native
94 
95 
96 class IdracRedfishUtils(RedfishUtils):
97 
98     def create_bios_config_job(self):
99         result = {}
100         key = "Bios"
101         jobs = "Jobs"
102 
103         # Search for 'key' entry and extract URI from it
104         response = self.get_request(self.root_uri + self.systems_uris[0])
105         if response['ret'] is False:
106             return response
107         result['ret'] = True
108         data = response['data']
109 
110         if key not in data:
111             return {'ret': False, 'msg': "Key %s not found" % key}
112 
113         bios_uri = data[key]["@odata.id"]
114 
115         # Extract proper URI
116         response = self.get_request(self.root_uri + bios_uri)
117         if response['ret'] is False:
118             return response
119         result['ret'] = True
120         data = response['data']
121         set_bios_attr_uri = data["@Redfish.Settings"]["SettingsObject"][
122             "@odata.id"]
123 
124         payload = {"TargetSettingsURI": set_bios_attr_uri}
125         response = self.post_request(
126             self.root_uri + self.manager_uri + "/" + jobs, payload)
127         if response['ret'] is False:
128             return response
129 
130         response_output = response['resp'].__dict__
131         job_id = response_output["headers"]["Location"]
132         job_id = re.search("JID_.+", job_id).group()
133         # Currently not passing job_id back to user but patch is coming
134         return {'ret': True, 'msg': "Config job %s created" % job_id}
135 
136 
137 CATEGORY_COMMANDS_ALL = {
138     "Systems": ["CreateBiosConfigJob"],
139     "Accounts": [],
140     "Manager": []
141 }
142 
143 
144 def main():
145     result = {}
146     module = AnsibleModule(
147         argument_spec=dict(
148             category=dict(required=True),
149             command=dict(required=True, type='list', elements='str'),
150             baseuri=dict(required=True),
151             username=dict(),
152             password=dict(no_log=True),
153             auth_token=dict(no_log=True),
154             timeout=dict(type='int', default=10),
155             resource_id=dict()
156         ),
157         required_together=[
158             ('username', 'password'),
159         ],
160         required_one_of=[
161             ('username', 'auth_token'),
162         ],
163         mutually_exclusive=[
164             ('username', 'auth_token'),
165         ],
166         supports_check_mode=False
167     )
168 
169     category = module.params['category']
170     command_list = module.params['command']
171 
172     # admin credentials used for authentication
173     creds = {'user': module.params['username'],
174              'pswd': module.params['password'],
175              'token': module.params['auth_token']}
176 
177     # timeout
178     timeout = module.params['timeout']
179 
180     # System, Manager or Chassis ID to modify
181     resource_id = module.params['resource_id']
182 
183     # Build root URI
184     root_uri = "https://" + module.params['baseuri']
185     rf_utils = IdracRedfishUtils(creds, root_uri, timeout, module,
186                                  resource_id=resource_id, data_modification=True)
187 
188     # Check that Category is valid
189     if category not in CATEGORY_COMMANDS_ALL:
190         module.fail_json(msg=to_native("Invalid Category '%s'. Valid Categories = %s" % (category, list(CATEGORY_COMMANDS_ALL.keys()))))
191 
192     # Check that all commands are valid
193     for cmd in command_list:
194         # Fail if even one command given is invalid
195         if cmd not in CATEGORY_COMMANDS_ALL[category]:
196             module.fail_json(msg=to_native("Invalid Command '%s'. Valid Commands = %s" % (cmd, CATEGORY_COMMANDS_ALL[category])))
197 
198     # Organize by Categories / Commands
199 
200     if category == "Systems":
201         # execute only if we find a System resource
202         result = rf_utils._find_systems_resource()
203         if result['ret'] is False:
204             module.fail_json(msg=to_native(result['msg']))
205 
206         for command in command_list:
207             if command == "CreateBiosConfigJob":
208                 # execute only if we find a Managers resource
209                 result = rf_utils._find_managers_resource()
210                 if result['ret'] is False:
211                     module.fail_json(msg=to_native(result['msg']))
212                 result = rf_utils.create_bios_config_job()
213 
214     # Return data back or fail with proper message
215     if result['ret'] is True:
216         del result['ret']
217         module.exit_json(changed=True, msg='Action was successful')
218     else:
219         module.fail_json(msg=to_native(result['msg']))
220 
221 
222 if __name__ == '__main__':
223     main()
224
```
--- 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/plugins/modules/idrac_redfish_command.py b/plugins/modules/idrac_redfish_command.py
--- a/plugins/modules/idrac_redfish_command.py
+++ b/plugins/modules/idrac_redfish_command.py
@@ -85,6 +85,14 @@
     returned: always
     type: str
     sample: "Action was successful"
+return_values:
+    description: Dictionary containing command-specific response data from the action.
+    returned: on success
+    type: dict
+    version_added: 6.6.0
+    sample: {
+        "job_id": "/redfish/v1/Managers/iDRAC.Embedded.1/Jobs/JID_471269252011"
+    }
 '''
 
 import re
@@ -128,10 +136,9 @@
             return response
 
         response_output = response['resp'].__dict__
-        job_id = response_output["headers"]["Location"]
-        job_id = re.search("JID_.+", job_id).group()
-        # Currently not passing job_id back to user but patch is coming
-        return {'ret': True, 'msg': "Config job %s created" % job_id}
+        job_id_full = response_output["headers"]["Location"]
+        job_id = re.search("JID_.+", job_id_full).group()
+        return {'ret': True, 'msg': "Config job %s created" % job_id, 'job_id': job_id_full}
 
 
 CATEGORY_COMMANDS_ALL = {
@@ -143,6 +150,7 @@
 
 def main():
     result = {}
+    return_values = {}
     module = AnsibleModule(
         argument_spec=dict(
             category=dict(required=True),
@@ -210,11 +218,13 @@
                 if result['ret'] is False:
                     module.fail_json(msg=to_native(result['msg']))
                 result = rf_utils.create_bios_config_job()
+                if 'job_id' in result:
+                    return_values['job_id'] = result['job_id']
 
     # Return data back or fail with proper message
     if result['ret'] is True:
         del result['ret']
-        module.exit_json(changed=True, msg='Action was successful')
+        module.exit_json(changed=True, msg='Action was successful', return_values=return_values)
     else:
         module.fail_json(msg=to_native(result['msg']))

{"golden_diff": "diff --git a/plugins/modules/idrac_redfish_command.py b/plugins/modules/idrac_redfish_command.py\n--- a/plugins/modules/idrac_redfish_command.py\n+++ b/plugins/modules/idrac_redfish_command.py\n@@ -85,6 +85,14 @@\n     returned: always\n     type: str\n     sample: \"Action was successful\"\n+return_values:\n+    description: Dictionary containing command-specific response data from the action.\n+    returned: on success\n+    type: dict\n+    version_added: 6.6.0\n+    sample: {\n+        \"job_id\": \"/redfish/v1/Managers/iDRAC.Embedded.1/Jobs/JID_471269252011\"\n+    }\n '''\n \n import re\n@@ -128,10 +136,9 @@\n             return response\n \n         response_output = response['resp'].__dict__\n-        job_id = response_output[\"headers\"][\"Location\"]\n-        job_id = re.search(\"JID_.+\", job_id).group()\n-        # Currently not passing job_id back to user but patch is coming\n-        return {'ret': True, 'msg': \"Config job %s created\" % job_id}\n+        job_id_full = response_output[\"headers\"][\"Location\"]\n+        job_id = re.search(\"JID_.+\", job_id_full).group()\n+        return {'ret': True, 'msg': \"Config job %s created\" % job_id, 'job_id': job_id_full}\n \n \n CATEGORY_COMMANDS_ALL = {\n@@ -143,6 +150,7 @@\n \n def main():\n     result = {}\n+    return_values = {}\n     module = AnsibleModule(\n         argument_spec=dict(\n             category=dict(required=True),\n@@ -210,11 +218,13 @@\n                 if result['ret'] is False:\n                     module.fail_json(msg=to_native(result['msg']))\n                 result = rf_utils.create_bios_config_job()\n+                if 'job_id' in result:\n+                    return_values['job_id'] = result['job_id']\n \n     # Return data back or fail with proper message\n     if result['ret'] is True:\n         del result['ret']\n-        module.exit_json(changed=True, msg='Action was successful')\n+        module.exit_json(changed=True, msg='Action was successful', return_values=return_values)\n     else:\n         module.fail_json(msg=to_native(result['msg']))\n", "issue": "idrac_redfish_command module - requesting job_id on the output\n### Summary\n\nidrac_redfish_command CreateBiosConfigJob  command doesn't return job id now. I'm trying to check if job is completed before moving to next steps. This will ensure system is consistent state before next steps are executed.\n\n### Issue Type\n\nFeature Idea\n\n### Component Name\n\nidrac_redfish_command\n\n### Additional Information\n\n<!--- Paste example playbooks or commands between quotes below -->\r\n```yaml (paste below)\r\n- name: Create BIOS Config job\r\n  community.general.idrac_redfish_command:\r\n    baseuri: \"{{ baseuri }}\"\r\n    username: \"{{ username }}\"\r\n    password: \"{{ password }}\"\r\n    category: Systems\r\n    command: CreateBiosConfigJob\r\n  register: bios_job\r\n\r\n- debug:\r\n     msg: \"{{ bios_job.job_id }}\r\n\r\n\r\n```\r\n\n\n### Code of Conduct\n\n- [X] I agree to follow the Ansible Code of Conduct\n", "before_files": [{"content": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\n# Copyright (c) 2018 Dell EMC Inc.\n# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)\n# SPDX-License-Identifier: GPL-3.0-or-later\n\nfrom __future__ import absolute_import, division, print_function\n__metaclass__ = type\n\nDOCUMENTATION = '''\n---\nmodule: idrac_redfish_command\nshort_description: Manages Out-Of-Band controllers using iDRAC OEM Redfish APIs\ndescription:\n  - Builds Redfish URIs locally and sends them to remote OOB controllers to\n    perform an action.\n  - For use with Dell iDRAC operations that require Redfish OEM extensions.\nextends_documentation_fragment:\n  - community.general.attributes\nattributes:\n  check_mode:\n    support: none\n  diff_mode:\n    support: none\noptions:\n  category:\n    required: true\n    description:\n      - Category to execute on iDRAC.\n    type: str\n  command:\n    required: true\n    description:\n      - List of commands to execute on iDRAC.\n    type: list\n    elements: str\n  baseuri:\n    required: true\n    description:\n      - Base URI of iDRAC.\n    type: str\n  username:\n    description:\n      - Username for authenticating to iDRAC.\n    type: str\n  password:\n    description:\n      - Password for authenticating to iDRAC.\n    type: str\n  auth_token:\n    description:\n      - Security token for authenticating to iDRAC.\n    type: str\n    version_added: 2.3.0\n  timeout:\n    description:\n      - Timeout in seconds for HTTP requests to iDRAC.\n    default: 10\n    type: int\n  resource_id:\n    required: false\n    description:\n      - ID of the System, Manager or Chassis to modify.\n    type: str\n    version_added: '0.2.0'\n\nauthor: \"Jose Delarosa (@jose-delarosa)\"\n'''\n\nEXAMPLES = '''\n  - name: Create BIOS configuration job (schedule BIOS setting update)\n    community.general.idrac_redfish_command:\n      category: Systems\n      command: CreateBiosConfigJob\n      resource_id: System.Embedded.1\n      baseuri: \"{{ baseuri }}\"\n      username: \"{{ username }}\"\n      password: \"{{ password }}\"\n'''\n\nRETURN = '''\nmsg:\n    description: Message with action result or error description\n    returned: always\n    type: str\n    sample: \"Action was successful\"\n'''\n\nimport re\nfrom ansible.module_utils.basic import AnsibleModule\nfrom ansible_collections.community.general.plugins.module_utils.redfish_utils import RedfishUtils\nfrom ansible.module_utils.common.text.converters import to_native\n\n\nclass IdracRedfishUtils(RedfishUtils):\n\n    def create_bios_config_job(self):\n        result = {}\n        key = \"Bios\"\n        jobs = \"Jobs\"\n\n        # Search for 'key' entry and extract URI from it\n        response = self.get_request(self.root_uri + self.systems_uris[0])\n        if response['ret'] is False:\n            return response\n        result['ret'] = True\n        data = response['data']\n\n        if key not in data:\n            return {'ret': False, 'msg': \"Key %s not found\" % key}\n\n        bios_uri = data[key][\"@odata.id\"]\n\n        # Extract proper URI\n        response = self.get_request(self.root_uri + bios_uri)\n        if response['ret'] is False:\n            return response\n        result['ret'] = True\n        data = response['data']\n        set_bios_attr_uri = data[\"@Redfish.Settings\"][\"SettingsObject\"][\n            \"@odata.id\"]\n\n        payload = {\"TargetSettingsURI\": set_bios_attr_uri}\n        response = self.post_request(\n            self.root_uri + self.manager_uri + \"/\" + jobs, payload)\n        if response['ret'] is False:\n            return response\n\n        response_output = response['resp'].__dict__\n        job_id = response_output[\"headers\"][\"Location\"]\n        job_id = re.search(\"JID_.+\", job_id).group()\n        # Currently not passing job_id back to user but patch is coming\n        return {'ret': True, 'msg': \"Config job %s created\" % job_id}\n\n\nCATEGORY_COMMANDS_ALL = {\n    \"Systems\": [\"CreateBiosConfigJob\"],\n    \"Accounts\": [],\n    \"Manager\": []\n}\n\n\ndef main():\n    result = {}\n    module = AnsibleModule(\n        argument_spec=dict(\n            category=dict(required=True),\n            command=dict(required=True, type='list', elements='str'),\n            baseuri=dict(required=True),\n            username=dict(),\n            password=dict(no_log=True),\n            auth_token=dict(no_log=True),\n            timeout=dict(type='int', default=10),\n            resource_id=dict()\n        ),\n        required_together=[\n            ('username', 'password'),\n        ],\n        required_one_of=[\n            ('username', 'auth_token'),\n        ],\n        mutually_exclusive=[\n            ('username', 'auth_token'),\n        ],\n        supports_check_mode=False\n    )\n\n    category = module.params['category']\n    command_list = module.params['command']\n\n    # admin credentials used for authentication\n    creds = {'user': module.params['username'],\n             'pswd': module.params['password'],\n             'token': module.params['auth_token']}\n\n    # timeout\n    timeout = module.params['timeout']\n\n    # System, Manager or Chassis ID to modify\n    resource_id = module.params['resource_id']\n\n    # Build root URI\n    root_uri = \"https://\" + module.params['baseuri']\n    rf_utils = IdracRedfishUtils(creds, root_uri, timeout, module,\n                                 resource_id=resource_id, data_modification=True)\n\n    # Check that Category is valid\n    if category not in CATEGORY_COMMANDS_ALL:\n        module.fail_json(msg=to_native(\"Invalid Category '%s'. Valid Categories = %s\" % (category, list(CATEGORY_COMMANDS_ALL.keys()))))\n\n    # Check that all commands are valid\n    for cmd in command_list:\n        # Fail if even one command given is invalid\n        if cmd not in CATEGORY_COMMANDS_ALL[category]:\n            module.fail_json(msg=to_native(\"Invalid Command '%s'. Valid Commands = %s\" % (cmd, CATEGORY_COMMANDS_ALL[category])))\n\n    # Organize by Categories / Commands\n\n    if category == \"Systems\":\n        # execute only if we find a System resource\n        result = rf_utils._find_systems_resource()\n        if result['ret'] is False:\n            module.fail_json(msg=to_native(result['msg']))\n\n        for command in command_list:\n            if command == \"CreateBiosConfigJob\":\n                # execute only if we find a Managers resource\n                result = rf_utils._find_managers_resource()\n                if result['ret'] is False:\n                    module.fail_json(msg=to_native(result['msg']))\n                result = rf_utils.create_bios_config_job()\n\n    # Return data back or fail with proper message\n    if result['ret'] is True:\n        del result['ret']\n        module.exit_json(changed=True, msg='Action was successful')\n    else:\n        module.fail_json(msg=to_native(result['msg']))\n\n\nif __name__ == '__main__':\n    main()\n", "path": "plugins/modules/idrac_redfish_command.py"}], "after_files": [{"content": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\n# Copyright (c) 2018 Dell EMC Inc.\n# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)\n# SPDX-License-Identifier: GPL-3.0-or-later\n\nfrom __future__ import absolute_import, division, print_function\n__metaclass__ = type\n\nDOCUMENTATION = '''\n---\nmodule: idrac_redfish_command\nshort_description: Manages Out-Of-Band controllers using iDRAC OEM Redfish APIs\ndescription:\n  - Builds Redfish URIs locally and sends them to remote OOB controllers to\n    perform an action.\n  - For use with Dell iDRAC operations that require Redfish OEM extensions.\nextends_documentation_fragment:\n  - community.general.attributes\nattributes:\n  check_mode:\n    support: none\n  diff_mode:\n    support: none\noptions:\n  category:\n    required: true\n    description:\n      - Category to execute on iDRAC.\n    type: str\n  command:\n    required: true\n    description:\n      - List of commands to execute on iDRAC.\n    type: list\n    elements: str\n  baseuri:\n    required: true\n    description:\n      - Base URI of iDRAC.\n    type: str\n  username:\n    description:\n      - Username for authenticating to iDRAC.\n    type: str\n  password:\n    description:\n      - Password for authenticating to iDRAC.\n    type: str\n  auth_token:\n    description:\n      - Security token for authenticating to iDRAC.\n    type: str\n    version_added: 2.3.0\n  timeout:\n    description:\n      - Timeout in seconds for HTTP requests to iDRAC.\n    default: 10\n    type: int\n  resource_id:\n    required: false\n    description:\n      - ID of the System, Manager or Chassis to modify.\n    type: str\n    version_added: '0.2.0'\n\nauthor: \"Jose Delarosa (@jose-delarosa)\"\n'''\n\nEXAMPLES = '''\n  - name: Create BIOS configuration job (schedule BIOS setting update)\n    community.general.idrac_redfish_command:\n      category: Systems\n      command: CreateBiosConfigJob\n      resource_id: System.Embedded.1\n      baseuri: \"{{ baseuri }}\"\n      username: \"{{ username }}\"\n      password: \"{{ password }}\"\n'''\n\nRETURN = '''\nmsg:\n    description: Message with action result or error description\n    returned: always\n    type: str\n    sample: \"Action was successful\"\nreturn_values:\n    description: Dictionary containing command-specific response data from the action.\n    returned: on success\n    type: dict\n    version_added: 6.6.0\n    sample: {\n        \"job_id\": \"/redfish/v1/Managers/iDRAC.Embedded.1/Jobs/JID_471269252011\"\n    }\n'''\n\nimport re\nfrom ansible.module_utils.basic import AnsibleModule\nfrom ansible_collections.community.general.plugins.module_utils.redfish_utils import RedfishUtils\nfrom ansible.module_utils.common.text.converters import to_native\n\n\nclass IdracRedfishUtils(RedfishUtils):\n\n    def create_bios_config_job(self):\n        result = {}\n        key = \"Bios\"\n        jobs = \"Jobs\"\n\n        # Search for 'key' entry and extract URI from it\n        response = self.get_request(self.root_uri + self.systems_uris[0])\n        if response['ret'] is False:\n            return response\n        result['ret'] = True\n        data = response['data']\n\n        if key not in data:\n            return {'ret': False, 'msg': \"Key %s not found\" % key}\n\n        bios_uri = data[key][\"@odata.id\"]\n\n        # Extract proper URI\n        response = self.get_request(self.root_uri + bios_uri)\n        if response['ret'] is False:\n            return response\n        result['ret'] = True\n        data = response['data']\n        set_bios_attr_uri = data[\"@Redfish.Settings\"][\"SettingsObject\"][\n            \"@odata.id\"]\n\n        payload = {\"TargetSettingsURI\": set_bios_attr_uri}\n        response = self.post_request(\n            self.root_uri + self.manager_uri + \"/\" + jobs, payload)\n        if response['ret'] is False:\n            return response\n\n        response_output = response['resp'].__dict__\n        job_id_full = response_output[\"headers\"][\"Location\"]\n        job_id = re.search(\"JID_.+\", job_id_full).group()\n        return {'ret': True, 'msg': \"Config job %s created\" % job_id, 'job_id': job_id_full}\n\n\nCATEGORY_COMMANDS_ALL = {\n    \"Systems\": [\"CreateBiosConfigJob\"],\n    \"Accounts\": [],\n    \"Manager\": []\n}\n\n\ndef main():\n    result = {}\n    return_values = {}\n    module = AnsibleModule(\n        argument_spec=dict(\n            category=dict(required=True),\n            command=dict(required=True, type='list', elements='str'),\n            baseuri=dict(required=True),\n            username=dict(),\n            password=dict(no_log=True),\n            auth_token=dict(no_log=True),\n            timeout=dict(type='int', default=10),\n            resource_id=dict()\n        ),\n        required_together=[\n            ('username', 'password'),\n        ],\n        required_one_of=[\n            ('username', 'auth_token'),\n        ],\n        mutually_exclusive=[\n            ('username', 'auth_token'),\n        ],\n        supports_check_mode=False\n    )\n\n    category = module.params['category']\n    command_list = module.params['command']\n\n    # admin credentials used for authentication\n    creds = {'user': module.params['username'],\n             'pswd': module.params['password'],\n             'token': module.params['auth_token']}\n\n    # timeout\n    timeout = module.params['timeout']\n\n    # System, Manager or Chassis ID to modify\n    resource_id = module.params['resource_id']\n\n    # Build root URI\n    root_uri = \"https://\" + module.params['baseuri']\n    rf_utils = IdracRedfishUtils(creds, root_uri, timeout, module,\n                                 resource_id=resource_id, data_modification=True)\n\n    # Check that Category is valid\n    if category not in CATEGORY_COMMANDS_ALL:\n        module.fail_json(msg=to_native(\"Invalid Category '%s'. Valid Categories = %s\" % (category, list(CATEGORY_COMMANDS_ALL.keys()))))\n\n    # Check that all commands are valid\n    for cmd in command_list:\n        # Fail if even one command given is invalid\n        if cmd not in CATEGORY_COMMANDS_ALL[category]:\n            module.fail_json(msg=to_native(\"Invalid Command '%s'. Valid Commands = %s\" % (cmd, CATEGORY_COMMANDS_ALL[category])))\n\n    # Organize by Categories / Commands\n\n    if category == \"Systems\":\n        # execute only if we find a System resource\n        result = rf_utils._find_systems_resource()\n        if result['ret'] is False:\n            module.fail_json(msg=to_native(result['msg']))\n\n        for command in command_list:\n            if command == \"CreateBiosConfigJob\":\n                # execute only if we find a Managers resource\n                result = rf_utils._find_managers_resource()\n                if result['ret'] is False:\n                    module.fail_json(msg=to_native(result['msg']))\n                result = rf_utils.create_bios_config_job()\n                if 'job_id' in result:\n                    return_values['job_id'] = result['job_id']\n\n    # Return data back or fail with proper message\n    if result['ret'] is True:\n        del result['ret']\n        module.exit_json(changed=True, msg='Action was successful', return_values=return_values)\n    else:\n        module.fail_json(msg=to_native(result['msg']))\n\n\nif __name__ == '__main__':\n    main()\n", "path": "plugins/modules/idrac_redfish_command.py"}]}