├── AUTHORS.md ├── CHANGELOG.md ├── LICENSE.md ├── OEM_EXTENSIONS.md ├── README.md ├── inventory.yml └── playbooks ├── accounts ├── add_user.yml ├── create_output_file.yml ├── delete_user.yml ├── disable_user.yml ├── enable_user.yml ├── list_users.yml ├── update_user_password.yml └── update_user_role.yml ├── chassis ├── create_output_file.yml ├── get_chassis_inventory.yml ├── get_chassis_power.yml ├── get_chassis_thermals.yml ├── get_fan_inventory.yml ├── get_psu_inventory.yml ├── indicator_led_blink.yml ├── indicator_led_off.yml └── indicator_led_on.yml ├── manager ├── clear_logs.yml ├── create_output_file.yml ├── get_manager_logs.yml ├── get_manager_nic_inventory.yml ├── get_virtual_media.yml └── restart_manager.yml ├── sessions ├── create_output_file.yml └── get_session_information.yml ├── systems ├── create_output_file.yml ├── get_bios_attributes.yml ├── get_boot_order.yml ├── get_boot_override.yml ├── get_cpu_inventory.yml ├── get_disk_inventory.yml ├── get_memory_inventory.yml ├── get_nic_inventory.yml ├── get_storage_cont_inventory.yml ├── get_system_inventory.yml ├── get_system_inventory_all.yml ├── get_system_inventory_default.yml ├── get_system_inventory_several.yml ├── get_volume_inventory.yml ├── power_force_off.yml ├── power_force_restart.yml ├── power_graceful_restart.yml ├── power_graceful_shutdown.yml ├── power_on.yml ├── power_reboot.yml ├── set_bios_attribute.yml ├── set_default_bios_settings.yml ├── set_onetime_boot_legacy.yml ├── set_onetime_boot_next.yml └── set_onetime_boot_uefi.yml └── update ├── create_output_file.yml ├── get_firmware_inventory.yml └── get_firmware_update_methods.yml /AUTHORS.md: -------------------------------------------------------------------------------- 1 | # Original Contribution: 2 | 3 | * Jose Delarosa - Dell Inc. 4 | * Bill Dodd - Majec Systems 5 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | ## [1.0.2] - 2019-11-22 4 | - Updated playbooks to reflect functionality in Ansible 2.9 5 | 6 | ## [1.0.1] - 2019-10-25 7 | - Pulled out playbook changes that only work in the development branch for Ansible 8 | - Playbooks now work with the latest stable release of Ansible (2.8) 9 | 10 | ## [1.0.0] - 2019-10-18 11 | - Initial public release 12 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2019-2024, Contributing Member(s) of Distributed Management Task 4 | Force, Inc.. All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without modification, 7 | are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation and/or 14 | other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its contributors 17 | may be used to endorse or promote products derived from this software without 18 | specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 24 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 27 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /OEM_EXTENSIONS.md: -------------------------------------------------------------------------------- 1 | Copyright 2019 DMTF. All rights reserved. 2 | 3 | # Redfish Ansible OEM Extensions 4 | 5 | ## About 6 | 7 | This document describes an approach for extending the standard Redfish Ansible modules in order to support OEM extensions used by various vendors. 8 | 9 | ## The Approach 10 | 11 | With the current Redfish Ansible support, there are three main modules (`redfish_command.py`, `redfish_config.py` and `redfish_info.py`). These three modules are relatively thin modules that establish the commands and their parameters and then call out to a utility module, `redfish_utils.py`, that has the bulk of the logic to interact with the Redfish services. 12 | 13 | The `redfish_utils.py` module implements a `RedfishUtils` class that has many methods to perform the various Redfish operations. With this architecture, a new vendor module that needs to add a specific Oem feature can create a new class (e.g. `ContosoRedfishUtils`) that extends the existing `RedfishUtils`. New method(s) can be added to that class (or existing methods overridden) while still being able to leverage all the existing standard methods in the parent class. Then a new vendor module (e.g. `contoso_redfish_command.py`) can be written that is basically a sparse version of `redfish_command.py` that only needs to handle the new or changed vendor commands. 14 | 15 | Here is an example module that does what is described above. This example provides a non-standard `CreateBiosConfigJob` command. Here is the code: 16 | 17 | ``` 18 | DOCUMENTATION = ''' 19 | --- 20 | module: contoso_redfish_command 21 | version_added: "2.7" 22 | short_description: Manages Out-Of-Band controllers using Contoso Oem Redfish APIs 23 | description: 24 | - Builds Redfish URIs locally and sends them to remote OOB controllers to 25 | perform an action. 26 | - For use with operations that require Contoso Oem extensions 27 | options: 28 | category: 29 | required: true 30 | description: 31 | - Category to execute on OOB controller 32 | command: 33 | required: true 34 | description: 35 | - List of commands to execute on OOB controller 36 | baseuri: 37 | required: true 38 | description: 39 | - Base URI of OOB controller 40 | user: 41 | required: true 42 | description: 43 | - User for authentication with OOB controller 44 | password: 45 | required: true 46 | description: 47 | - Password for authentication with OOB controller 48 | 49 | author: "" 50 | ''' 51 | 52 | EXAMPLES = ''' 53 | - name: Create BIOS config job 54 | contoso_redfish_command: 55 | category: Systems 56 | command: CreateBiosConfigJob 57 | baseuri: "{{ baseuri }}" 58 | user: "{{ user }}" 59 | password: "{{ password }}" 60 | ''' 61 | 62 | RETURN = ''' 63 | msg: 64 | description: Message with action result or error description 65 | returned: always 66 | type: string 67 | sample: "Action was successful" 68 | ''' 69 | 70 | import re 71 | from ansible.module_utils.basic import AnsibleModule 72 | from ansible.module_utils.redfish_utils import RedfishUtils, HEADERS 73 | from ansible.module_utils._text import to_native 74 | 75 | class ContosoRedfishUtils(RedfishUtils): 76 | 77 | def create_bios_config_job(self): 78 | result = {} 79 | key = "Bios" 80 | jobs = "Jobs" 81 | 82 | # Search for 'key' entry and extract URI from it 83 | response = self.get_request(self.root_uri + self.systems_uri) 84 | if response['ret'] is False: 85 | return response 86 | result['ret'] = True 87 | data = response['data'] 88 | 89 | if key not in data: 90 | return {'ret': False, 'msg': "Key %s not found" % key} 91 | 92 | bios_uri = data[key]["@odata.id"] 93 | 94 | # Extract proper URI 95 | response = self.get_request(self.root_uri + bios_uri) 96 | if response['ret'] is False: 97 | return response 98 | result['ret'] = True 99 | data = response['data'] 100 | set_bios_attr_uri = data["@Redfish.Settings"]["SettingsObject"][ 101 | "@odata.id"] 102 | 103 | payload = {"TargetSettingsURI": set_bios_attr_uri} 104 | response = self.post_request( 105 | self.root_uri + self.manager_uri + "/" + jobs, 106 | payload, HEADERS) 107 | if response['ret'] is False: 108 | return response 109 | 110 | response_output = response['resp'].__dict__ 111 | job_id = response_output["headers"]["Location"] 112 | job_id = re.search("JID_.+", job_id).group() 113 | # Currently not passing job_id back to user but patch is coming 114 | return {'ret': True, 'msg': "Config job %s created" % job_id} 115 | 116 | 117 | CATEGORY_COMMANDS_ALL = { 118 | "Systems": ["CreateBiosConfigJob"], 119 | "Accounts": [], 120 | "Manager": [] 121 | } 122 | 123 | 124 | def main(): 125 | result = {} 126 | module = AnsibleModule( 127 | argument_spec=dict( 128 | category=dict(required=True), 129 | command=dict(required=True, type='list'), 130 | baseuri=dict(required=True), 131 | user=dict(required=True), 132 | password=dict(required=True, no_log=True) 133 | ), 134 | supports_check_mode=False 135 | ) 136 | 137 | category = module.params['category'] 138 | command_list = module.params['command'] 139 | 140 | # admin credentials used for authentication 141 | creds = {'user': module.params['user'], 142 | 'pswd': module.params['password']} 143 | 144 | # Build root URI 145 | root_uri = "https://" + module.params['baseuri'] 146 | rf_uri = "/redfish/v1/" 147 | rf_utils = ContosoRedfishUtils(creds, root_uri) 148 | 149 | # Check that Category is valid 150 | if category not in CATEGORY_COMMANDS_ALL: 151 | module.fail_json(msg=to_native("Invalid Category '%s'. Valid Categories = %s" % (category, CATEGORY_COMMANDS_ALL.keys()))) 152 | 153 | # Check that all commands are valid 154 | for cmd in command_list: 155 | # Fail if even one command given is invalid 156 | if cmd not in CATEGORY_COMMANDS_ALL[category]: 157 | module.fail_json(msg=to_native("Invalid Command '%s'. Valid Commands = %s" % (cmd, CATEGORY_COMMANDS_ALL[category]))) 158 | 159 | # Organize by Categories / Commands 160 | 161 | if category == "Systems": 162 | # execute only if we find a System resource 163 | result = rf_utils._find_systems_resource(rf_uri) 164 | if result['ret'] is False: 165 | module.fail_json(msg=to_native(result['msg'])) 166 | 167 | for command in command_list: 168 | if command == "CreateBiosConfigJob": 169 | # execute only if we find a Managers resource 170 | result = rf_utils._find_managers_resource(rf_uri) 171 | if result['ret'] is False: 172 | module.fail_json(msg=to_native(result['msg'])) 173 | result = rf_utils.create_bios_config_job() 174 | 175 | # Return data back or fail with proper message 176 | if result['ret'] is True: 177 | del result['ret'] 178 | module.exit_json(changed=True, msg='Action was successful') 179 | else: 180 | module.fail_json(msg=to_native(result['msg'])) 181 | 182 | 183 | if __name__ == '__main__': 184 | main() 185 | ``` 186 | 187 | Given this new vendor module, playbooks like this can be written that call a mix of tasks using standard and vendor modules. For example, here is a playbook that sets some BIOS attributes using a standard module and then applies the attributes using a vendor module: 188 | 189 | ``` 190 | --- 191 | - hosts: myhosts 192 | connection: local 193 | name: Set BIOS attribute - choose below 194 | gather_facts: False 195 | 196 | # Updating BIOS settings requires creating a configuration job to implement, 197 | # which then reboots the system. 198 | 199 | # BIOS attributes that have been tested 200 | # 201 | # Name Value 202 | # -------------------------------------------------- 203 | # OsWatchdogTimer Disabled / Enabled 204 | # ProcVirtualization Disabled / Enabled 205 | # MemTest Disabled / Enabled 206 | # SriovGlobalEnable Disabled / Enabled 207 | 208 | vars: 209 | - attribute_name1: SriovGlobalEnable 210 | - attribute_value1: Disabled 211 | - attribute_name2: ProcVirtualization 212 | - attribute_value2: Enabled 213 | 214 | tasks: 215 | 216 | - name: Set BIOS attribute {{ attribute_name1 }} to {{ attribute_value1 }} 217 | redfish_config: 218 | category: Systems 219 | command: SetBiosAttributes 220 | bios_attr_name: "{{ attribute_name1 }}" 221 | bios_attr_value: "{{ attribute_value1 }}" 222 | baseuri: "{{ baseuri }}" 223 | user: "{{ user }}" 224 | password: "{{ password }}" 225 | 226 | - name: Set BIOS attribute {{ attribute_name2 }} to {{ attribute_value2 }} 227 | redfish_config: 228 | category: Systems 229 | command: SetBiosAttributes 230 | bios_attr_name: "{{ attribute_name2 }}" 231 | bios_attr_value: "{{ attribute_value2 }}" 232 | baseuri: "{{ baseuri }}" 233 | user: "{{ user }}" 234 | password: "{{ password }}" 235 | 236 | - name: Schedule Config Job - Reboot 237 | contoso_redfish_command: 238 | category: Systems 239 | command: CreateBiosConfigJob 240 | baseuri: "{{ baseuri }}" 241 | user: "{{ user }}" 242 | password: "{{ password }}" 243 | ``` 244 | 245 | Note that the first 2 tasks use a standard module (`redfish_config`) and the last task uses a vendor module (`contoso_redfish_command`). 246 | 247 | And here is an example playbook to set the BIOS attributes using all standard modules: 248 | 249 | ``` 250 | --- 251 | - hosts: myhosts 252 | connection: local 253 | name: Set BIOS attribute - choose below 254 | gather_facts: False 255 | 256 | # Updating BIOS settings requires creating a configuration job to implement, 257 | # which then reboots the system. 258 | 259 | # BIOS attributes that have been tested 260 | # 261 | # Name Value 262 | # -------------------------------------------------- 263 | # OsWatchdogTimer Disabled / Enabled 264 | # ProcVirtualization Disabled / Enabled 265 | # MemTest Disabled / Enabled 266 | # SriovGlobalEnable Disabled / Enabled 267 | 268 | vars: 269 | - attribute_name1: SriovGlobalEnable 270 | - attribute_value1: Disabled 271 | - attribute_name2: ProcVirtualization 272 | - attribute_value2: Enabled 273 | 274 | tasks: 275 | 276 | - name: Set BIOS attribute {{ attribute_name1 }} to {{ attribute_value1 }} 277 | redfish_config: 278 | category: Systems 279 | command: SetBiosAttributes 280 | bios_attr_name: "{{ attribute_name1 }}" 281 | bios_attr_value: "{{ attribute_value1 }}" 282 | baseuri: "{{ baseuri }}" 283 | user: "{{ user }}" 284 | password: "{{ password }}" 285 | 286 | - name: Set BIOS attribute {{ attribute_name2 }} to {{ attribute_value2 }} 287 | redfish_config: 288 | category: Systems 289 | command: SetBiosAttributes 290 | bios_attr_name: "{{ attribute_name2 }}" 291 | bios_attr_value: "{{ attribute_value2 }}" 292 | baseuri: "{{ baseuri }}" 293 | user: "{{ user }}" 294 | password: "{{ password }}" 295 | 296 | - name: Reboot 297 | redfish_command: 298 | category: Systems 299 | command: PowerReboot 300 | baseuri: "{{ baseuri }}" 301 | user: "{{ user }}" 302 | password: "{{ password }}" 303 | ``` 304 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Copyright 2019 DMTF. All rights reserved. 2 | 3 | # Redfish Ansible Playbooks 4 | 5 | ## About 6 | 7 | This repository contains a set of example Ansible playbooks for invoking the Redfish Ansible modules. 8 | 9 | ## Prerequisites 10 | 11 | To use these playbooks, you first need to install the latest stable 2.9 release of Ansible. The Redfish Ansible modules are included in the Ansible distribution. Instructions for installing Ansible can be found here: 12 | 13 | [Ansible Installation Guide](https://docs.ansible.com/ansible/2.9/installation_guide/intro_installation.html) 14 | 15 | ## Release process 16 | 17 | The playbooks in the `2.9` branch of this repository are designed to work with the [stable 2.9 release of Ansible](https://docs.ansible.com/ansible/2.9/reference_appendices/release_and_maintenance.html). The playbooks in the `main` branch of this repository are designed to work with the [latest stable release of Ansible](https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html). 18 | 19 | ## Running the playbooks 20 | 21 | 1. [Clone](https://help.github.com/en/articles/cloning-a-repository) this repository 22 | 2. Edit the example [inventory.yml](inventory.yml) file to specify the hostname/ip and credentials of your Redfish service(s). 23 | 3. Run a playbook, for example: 24 | ``` 25 | ansible-playbook -i inventory.yml playbooks/systems/get_system_inventory.yml 26 | ``` 27 | 28 | 29 | ## Redfish Ansible modules 30 | 31 | The Redfish Ansible modules are maintained in the [stable 2.9 Ansible GitHub repository](https://github.com/ansible/ansible/tree/stable-2.9). 32 | 33 | The three Redfish modules are summarized here: 34 | 35 | 1. [redfish_command](https://docs.ansible.com/ansible/2.9/modules/redfish_command_module.html) (source: [redish_command.py](https://github.com/ansible/ansible/blob/stable-2.9/lib/ansible/modules/remote_management/redfish/redfish_command.py)) 36 | 37 | The `redfish_command` module performs Out-Of-Band (OOB) controller operations like log management, adding/deleting/modifying users, and power operations (e.g. on, off, reboot, etc.). 38 | 39 | 2. [redfish_config](https://docs.ansible.com/ansible/2.9/modules/redfish_config_module.html) (source: [redfish_config.py](https://github.com/ansible/ansible/blob/stable-2.9/lib/ansible/modules/remote_management/redfish/redfish_config.py)) 40 | 41 | The `redfish_config` module performs OOB controller operations like setting the BIOS configuration. 42 | 43 | 3. [redfish_info](https://docs.ansible.com/ansible/2.9/modules/redfish_info_module.html) (source: [redfish_info.py](https://github.com/ansible/ansible/blob/stable-2.9/lib/ansible/modules/remote_management/redfish/redfish_info.py)) 44 | 45 | The `redfish_info` module retrieves information about the OOB controller like Systems inventory and Accounts inventory. 46 | 47 | All three of the above modules use this utility module: [redfish_utils.py](https://github.com/ansible/ansible/blob/stable-2.9/lib/ansible/module_utils/redfish_utils.py) 48 | 49 | 50 | ## Contributing 51 | 52 | For the Redfish Ansible modules: File issues or submit pull requests in the [Ansible repo](https://github.com/ansible/ansible/tree/stable-2.9) following the [Ansible Community Guide](https://docs.ansible.com/ansible/2.9/community/index.html). 53 | 54 | For the Redfish Ansible playbooks: File issues or submit pull requests in this github repository. 55 | 56 | ## OEM Extensions 57 | 58 | See [OEM_EXTENSIONS.md](OEM_EXTENSIONS.md) for an outine of how to extend the standard Redfish Ansible modules to support OEM extensions. 59 | 60 | ## Acknowledgements 61 | 62 | These playbooks are based on the ones provided in https://github.com/dell/redfish-ansible-module 63 | 64 | 65 | -------------------------------------------------------------------------------- /inventory.yml: -------------------------------------------------------------------------------- 1 | # Sample inventory file for Redfish Ansible modules 2 | # 3 | # For baseuri, if specifying names instead of IP addresses, make sure 4 | # that name is fully DNS resolvable. 5 | 6 | [redfish] 7 | redfish1 baseuri=192.168.1.10 username=root password=xxxxxxxx 8 | redfish2 baseuri=192.168.1.11 username=root password=yyyyyyyy 9 | 10 | [myhosts:children] 11 | redfish 12 | 13 | [myhosts:vars] 14 | # Default credentials for OOB controller 15 | username=root 16 | password=P@$$word 17 | 18 | # Local directory where all results are placed 19 | rootdir=~/inventory_files 20 | 21 | # Shorter name for inventory_hostname 22 | # Refers to the logical inventory hostname (example: redfish1) 23 | host="{{inventory_hostname}}" 24 | 25 | # Vars for managing accounts 26 | id=3 27 | new_username=user3 28 | new_password=B1g$3cr3t 29 | roleid=Operator 30 | -------------------------------------------------------------------------------- /playbooks/accounts/add_user.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Add User 5 | gather_facts: False 6 | 7 | tasks: 8 | 9 | # When adding a user, it must be enabled afterwards 10 | - name: Add user 11 | redfish_command: 12 | category: Accounts 13 | command: AddUser 14 | baseuri: "{{ baseuri }}" 15 | username: "{{ username }}" 16 | password: "{{ password }}" 17 | id: "{{ id }}" 18 | new_username: "{{ new_username }}" 19 | new_password: "{{ new_password }}" 20 | roleid: "{{ roleid }}" 21 | -------------------------------------------------------------------------------- /playbooks/accounts/create_output_file.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Define timestamp 3 | set_fact: timestamp="{{ lookup('pipe', 'date +%Y%m%d_%H%M%S') }}" 4 | run_once: true 5 | 6 | - name: Define file to place results 7 | set_fact: template={{rootdir}}/{{host}}/{{host}}_{{datatype}}_{{timestamp}} 8 | 9 | - name: Create dropoff directory for host 10 | file: 11 | path: "{{ rootdir }}/{{ host }}" 12 | state: directory 13 | -------------------------------------------------------------------------------- /playbooks/accounts/delete_user.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Delete User 5 | gather_facts: False 6 | 7 | tasks: 8 | 9 | - name: Delete user 10 | redfish_command: 11 | category: Accounts 12 | command: DeleteUser 13 | baseuri: "{{ baseuri }}" 14 | username: "{{ username }}" 15 | password: "{{ password }}" 16 | id: "{{ id }}" 17 | -------------------------------------------------------------------------------- /playbooks/accounts/disable_user.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Disable User 5 | gather_facts: False 6 | 7 | tasks: 8 | 9 | - name: Disable user 10 | redfish_command: 11 | category: Accounts 12 | command: DisableUser 13 | baseuri: "{{ baseuri }}" 14 | username: "{{ username }}" 15 | password: "{{ password }}" 16 | id: "{{ id }}" 17 | -------------------------------------------------------------------------------- /playbooks/accounts/enable_user.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Enable User 5 | gather_facts: False 6 | 7 | tasks: 8 | 9 | - name: Enable user 10 | redfish_command: 11 | category: Accounts 12 | command: EnableUser 13 | baseuri: "{{ baseuri }}" 14 | username: "{{ username }}" 15 | password: "{{ password }}" 16 | id: "{{ id }}" 17 | -------------------------------------------------------------------------------- /playbooks/accounts/list_users.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: List Users 5 | gather_facts: False 6 | 7 | vars: 8 | datatype: UserList 9 | 10 | tasks: 11 | 12 | - name: Set output file 13 | include_tasks: create_output_file.yml 14 | 15 | - name: List all users 16 | redfish_info: 17 | category: Accounts 18 | command: ListUsers 19 | baseuri: "{{ baseuri }}" 20 | username: "{{ username }}" 21 | password: "{{ password }}" 22 | register: result 23 | 24 | - name: Copy results to output file 25 | copy: 26 | content: "{{ result | to_nice_json }}" 27 | dest: "{{ template }}.json" 28 | -------------------------------------------------------------------------------- /playbooks/accounts/update_user_password.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Update user password 5 | gather_facts: False 6 | 7 | tasks: 8 | 9 | - name: Update user password 10 | redfish_command: 11 | category: Accounts 12 | command: UpdateUserPassword 13 | baseuri: "{{ baseuri }}" 14 | username: "{{ username }}" 15 | password: "{{ password }}" 16 | id: "{{ id }}" 17 | new_password: "{{ new_password }}" 18 | -------------------------------------------------------------------------------- /playbooks/accounts/update_user_role.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Update user role 5 | gather_facts: False 6 | 7 | tasks: 8 | 9 | - name: Update user role 10 | redfish_command: 11 | category: Accounts 12 | command: UpdateUserRole 13 | baseuri: "{{ baseuri }}" 14 | username: "{{ username }}" 15 | password: "{{ password }}" 16 | id: "{{ id }}" 17 | roleid: "{{ roleid }}" 18 | -------------------------------------------------------------------------------- /playbooks/chassis/create_output_file.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Define timestamp 3 | set_fact: timestamp="{{ lookup('pipe', 'date +%Y%m%d_%H%M%S') }}" 4 | run_once: true 5 | 6 | - name: Define file to place results 7 | set_fact: template={{rootdir}}/{{host}}/{{host}}_{{datatype}}_{{timestamp}} 8 | 9 | - name: Create dropoff directory for host 10 | file: 11 | path: "{{ rootdir }}/{{ host }}" 12 | state: directory 13 | -------------------------------------------------------------------------------- /playbooks/chassis/get_chassis_inventory.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Chassis Inventory 5 | gather_facts: False 6 | 7 | vars: 8 | datatype: ChassisInventory 9 | 10 | tasks: 11 | 12 | - name: Set output file 13 | include_tasks: create_output_file.yml 14 | 15 | - name: Get chassis Inventory 16 | redfish_info: 17 | category: Chassis 18 | command: GetChassisInventory 19 | baseuri: "{{ baseuri }}" 20 | username: "{{ username }}" 21 | password: "{{ password }}" 22 | register: result 23 | 24 | - name: Copy results to output file 25 | copy: 26 | content: "{{ result | to_nice_json }}" 27 | dest: "{{ template }}.json" 28 | -------------------------------------------------------------------------------- /playbooks/chassis/get_chassis_power.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Chassis Power 5 | gather_facts: False 6 | 7 | vars: 8 | datatype: ChassisPower 9 | 10 | tasks: 11 | 12 | - name: Set output file 13 | include_tasks: create_output_file.yml 14 | 15 | - name: Get chassis power 16 | redfish_info: 17 | category: Chassis 18 | command: GetChassisPower 19 | baseuri: "{{ baseuri }}" 20 | username: "{{ username }}" 21 | password: "{{ password }}" 22 | register: result 23 | 24 | - name: Copy results to output file 25 | copy: 26 | content: "{{ result | to_nice_json }}" 27 | dest: "{{ template }}.json" 28 | -------------------------------------------------------------------------------- /playbooks/chassis/get_chassis_thermals.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Chassis Thermals 5 | gather_facts: False 6 | 7 | vars: 8 | datatype: ChassisThermals 9 | 10 | tasks: 11 | 12 | - name: Set output file 13 | include_tasks: create_output_file.yml 14 | 15 | - name: Get chassis thermals 16 | redfish_info: 17 | category: Chassis 18 | command: GetChassisThermals 19 | baseuri: "{{ baseuri }}" 20 | username: "{{ username }}" 21 | password: "{{ password }}" 22 | register: result 23 | 24 | - name: Copy results to output file 25 | copy: 26 | content: "{{ result | to_nice_json }}" 27 | dest: "{{ template }}.json" 28 | -------------------------------------------------------------------------------- /playbooks/chassis/get_fan_inventory.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Fan Inventory 5 | gather_facts: False 6 | 7 | vars: 8 | datatype: FanInventory 9 | 10 | tasks: 11 | 12 | - name: Set output file 13 | include_tasks: create_output_file.yml 14 | 15 | - name: Get fans statistics 16 | redfish_info: 17 | category: Chassis 18 | command: GetFanInventory 19 | baseuri: "{{ baseuri }}" 20 | username: "{{ username }}" 21 | password: "{{ password }}" 22 | register: result 23 | 24 | - name: Copy results to output file 25 | copy: 26 | content: "{{ result | to_nice_json }}" 27 | dest: "{{ template }}.json" 28 | -------------------------------------------------------------------------------- /playbooks/chassis/get_psu_inventory.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Power Supply (PSU) Inventory 5 | gather_facts: False 6 | 7 | vars: 8 | datatype: PsuInventory 9 | 10 | tasks: 11 | 12 | - name: Define output file 13 | include_tasks: create_output_file.yml 14 | 15 | - name: Get PSU Inventory 16 | redfish_info: 17 | category: Chassis 18 | command: GetPsuInventory 19 | baseuri: "{{ baseuri }}" 20 | username: "{{ username }}" 21 | password: "{{ password }}" 22 | register: result 23 | 24 | - name: Copy results to output file 25 | copy: 26 | content: "{{ result | to_nice_json }}" 27 | dest: "{{ template }}.json" 28 | -------------------------------------------------------------------------------- /playbooks/chassis/indicator_led_blink.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Set Indicator LED to Blink 5 | gather_facts: False 6 | 7 | tasks: 8 | 9 | - name: Blink LED 10 | redfish_command: 11 | category: Chassis 12 | command: IndicatorLedBlink 13 | baseuri: "{{ baseuri }}" 14 | username: "{{ username}}" 15 | password: "{{ password }}" 16 | -------------------------------------------------------------------------------- /playbooks/chassis/indicator_led_off.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Set Indicator LED to Off 5 | gather_facts: False 6 | 7 | tasks: 8 | 9 | - name: Turn LED off 10 | redfish_command: 11 | category: Chassis 12 | command: IndicatorLedOff 13 | baseuri: "{{ baseuri }}" 14 | username: "{{ username}}" 15 | password: "{{ password }}" 16 | -------------------------------------------------------------------------------- /playbooks/chassis/indicator_led_on.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Set Indicator LED to On 5 | gather_facts: False 6 | 7 | tasks: 8 | 9 | - name: Turn LED on 10 | redfish_command: 11 | category: Chassis 12 | command: IndicatorLedOn 13 | baseuri: "{{ baseuri }}" 14 | username: "{{ username}}" 15 | password: "{{ password }}" 16 | -------------------------------------------------------------------------------- /playbooks/manager/clear_logs.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Clear System Logs 5 | gather_facts: False 6 | 7 | tasks: 8 | 9 | - name: Clear Logs 10 | redfish_command: 11 | category: Manager 12 | command: ClearLogs 13 | baseuri: "{{ baseuri }}" 14 | username: "{{ username }}" 15 | password: "{{ password }}" 16 | -------------------------------------------------------------------------------- /playbooks/manager/create_output_file.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Define timestamp 3 | set_fact: timestamp="{{ lookup('pipe', 'date +%Y%m%d_%H%M%S') }}" 4 | run_once: true 5 | 6 | - name: Define file to place results 7 | set_fact: template={{rootdir}}/{{host}}/{{host}}_{{datatype}}_{{timestamp}} 8 | 9 | - name: Create dropoff directory for host 10 | file: 11 | path: "{{ rootdir }}/{{ host }}" 12 | state: directory 13 | -------------------------------------------------------------------------------- /playbooks/manager/get_manager_logs.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Get Manager Logs 5 | gather_facts: False 6 | 7 | vars: 8 | datatype: Logs 9 | 10 | tasks: 11 | 12 | - name: Define output file 13 | include_tasks: create_output_file.yml 14 | 15 | - name: Get Manager Logs 16 | redfish_info: 17 | category: Manager 18 | command: GetLogs 19 | baseuri: "{{ baseuri }}" 20 | username: "{{ username }}" 21 | password: "{{ password }}" 22 | register: result 23 | 24 | - name: Copy results to output file 25 | copy: 26 | content: "{{ result | to_nice_json }}" 27 | dest: "{{ template }}.json" 28 | -------------------------------------------------------------------------------- /playbooks/manager/get_manager_nic_inventory.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Get Manager NIC inventory 5 | gather_facts: False 6 | 7 | vars: 8 | datatype: ManagerNicInventory 9 | 10 | tasks: 11 | 12 | - name: Set output file 13 | include_tasks: create_output_file.yml 14 | 15 | - name: Get Manager NIC inventory 16 | redfish_info: 17 | category: Manager 18 | command: GetManagerNicInventory 19 | baseuri: "{{ baseuri }}" 20 | username: "{{ username }}" 21 | password: "{{ password }}" 22 | register: result 23 | 24 | - name: Copy results to output file 25 | copy: 26 | content: "{{ result | to_nice_json }}" 27 | dest: "{{ template }}.json" 28 | -------------------------------------------------------------------------------- /playbooks/manager/get_virtual_media.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Manager virtual media 5 | gather_facts: False 6 | 7 | vars: 8 | datatype: VirtualMedia 9 | 10 | tasks: 11 | 12 | - name: Set output file 13 | include_tasks: create_output_file.yml 14 | 15 | - name: Get Virtual Media information 16 | redfish_info: 17 | category: Manager 18 | command: GetVirtualMedia 19 | baseuri: "{{ baseuri }}" 20 | username: "{{ username }}" 21 | password: "{{ password }}" 22 | register: result 23 | 24 | - name: Copy results to output file 25 | copy: 26 | content: "{{ result | to_nice_json }}" 27 | dest: "{{ template }}.json" 28 | -------------------------------------------------------------------------------- /playbooks/manager/restart_manager.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Restart Manager 5 | gather_facts: False 6 | 7 | tasks: 8 | 9 | - name: Restart Manager gracefully 10 | redfish_command: 11 | category: Manager 12 | command: GracefulRestart 13 | baseuri: "{{ baseuri }}" 14 | username: "{{ username }}" 15 | password: "{{ password }}" 16 | -------------------------------------------------------------------------------- /playbooks/sessions/create_output_file.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Define timestamp 3 | set_fact: timestamp="{{ lookup('pipe', 'date +%Y%m%d_%H%M%S') }}" 4 | run_once: true 5 | 6 | - name: Define file to place results 7 | set_fact: template={{rootdir}}/{{host}}/{{host}}_{{datatype}}_{{timestamp}} 8 | 9 | - name: Create dropoff directory for host 10 | file: 11 | path: "{{ rootdir }}/{{ host }}" 12 | state: directory 13 | -------------------------------------------------------------------------------- /playbooks/sessions/get_session_information.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Sessions 5 | gather_facts: False 6 | 7 | vars: 8 | datatype: Sessions 9 | 10 | tasks: 11 | 12 | - name: Set output file 13 | include_tasks: create_output_file.yml 14 | 15 | - name: Get sessions 16 | redfish_info: 17 | category: Sessions 18 | command: GetSessions 19 | baseuri: "{{ baseuri }}" 20 | username: "{{ username }}" 21 | password: "{{ password }}" 22 | register: result 23 | 24 | - name: Copy results to output file 25 | copy: 26 | content: "{{ result | to_nice_json }}" 27 | dest: "{{ template }}.json" 28 | -------------------------------------------------------------------------------- /playbooks/systems/create_output_file.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Define timestamp 3 | set_fact: timestamp="{{ lookup('pipe', 'date +%Y%m%d_%H%M%S') }}" 4 | run_once: true 5 | 6 | - name: Define file to place results 7 | set_fact: template={{rootdir}}/{{host}}/{{host}}_{{datatype}}_{{timestamp}} 8 | 9 | - name: Create dropoff directory for host 10 | file: 11 | path: "{{ rootdir }}/{{ host }}" 12 | state: directory 13 | -------------------------------------------------------------------------------- /playbooks/systems/get_bios_attributes.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Get BIOS attributes 5 | gather_facts: False 6 | 7 | vars: 8 | datatype: BiosAttributes 9 | 10 | tasks: 11 | 12 | - name: Define output file 13 | include_tasks: create_output_file.yml 14 | 15 | - name: Get BIOS attributes 16 | redfish_info: 17 | category: Systems 18 | command: GetBiosAttributes 19 | baseuri: "{{ baseuri }}" 20 | username: "{{ username }}" 21 | password: "{{ password }}" 22 | register: result 23 | 24 | - name: Copy results to output file 25 | copy: 26 | content: "{{ result | to_nice_json }}" 27 | dest: "{{ template }}.json" 28 | -------------------------------------------------------------------------------- /playbooks/systems/get_boot_order.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Get boot order 5 | gather_facts: False 6 | 7 | vars: 8 | datatype: BootOrder 9 | 10 | tasks: 11 | 12 | - name: Define output file 13 | include_tasks: create_output_file.yml 14 | 15 | - name: Get device boot order 16 | redfish_info: 17 | category: Systems 18 | command: GetBootOrder 19 | baseuri: "{{ baseuri }}" 20 | username: "{{ username }}" 21 | password: "{{ password }}" 22 | register: result 23 | 24 | - name: Copy results to output file 25 | copy: 26 | content: "{{ result | to_nice_json }}" 27 | dest: "{{ template }}.json" 28 | -------------------------------------------------------------------------------- /playbooks/systems/get_boot_override.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Get Boot Override 5 | gather_facts: False 6 | 7 | vars: 8 | datatype: BootOverride 9 | 10 | tasks: 11 | 12 | - name: Define output file 13 | include_tasks: create_output_file.yml 14 | 15 | - name: Get Boot Override information 16 | redfish_info: 17 | category: Systems 18 | command: GetBootOverride 19 | baseuri: "{{ baseuri }}" 20 | username: "{{ username }}" 21 | password: "{{ password }}" 22 | register: result 23 | 24 | - name: Copy results to output file 25 | copy: 26 | content: "{{ result | to_nice_json }}" 27 | dest: "{{ template }}.json" 28 | -------------------------------------------------------------------------------- /playbooks/systems/get_cpu_inventory.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: CPU Inventory 5 | gather_facts: False 6 | 7 | vars: 8 | datatype: CpuInventory 9 | 10 | tasks: 11 | 12 | - name: Set output file 13 | include_tasks: create_output_file.yml 14 | 15 | - name: Get CPU Inventory 16 | redfish_info: 17 | category: Systems 18 | command: GetCpuInventory 19 | baseuri: "{{ baseuri }}" 20 | username: "{{ username}}" 21 | password: "{{ password }}" 22 | register: result 23 | 24 | - name: Copy results to output file 25 | copy: 26 | content: "{{ result | to_nice_json }}" 27 | dest: "{{ template }}.json" 28 | -------------------------------------------------------------------------------- /playbooks/systems/get_disk_inventory.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Get drive inventory 5 | gather_facts: False 6 | 7 | vars: 8 | datatype: DriveInventory 9 | 10 | tasks: 11 | 12 | - name: Define output file 13 | include_tasks: create_output_file.yml 14 | 15 | - name: Get drive inventory 16 | redfish_info: 17 | category: Systems 18 | command: GetDiskInventory 19 | baseuri: "{{ baseuri }}" 20 | username: "{{ username }}" 21 | password: "{{ password }}" 22 | register: result 23 | 24 | - name: Copy results to output file 25 | copy: 26 | content: "{{ result | to_nice_json }}" 27 | dest: "{{ template }}.json" 28 | -------------------------------------------------------------------------------- /playbooks/systems/get_memory_inventory.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Get memory inventory 5 | gather_facts: False 6 | 7 | vars: 8 | datatype: MemoryInventory 9 | 10 | tasks: 11 | 12 | - name: Define output file 13 | include_tasks: create_output_file.yml 14 | 15 | - name: Get memory inventory 16 | redfish_info: 17 | category: Systems 18 | command: GetMemoryInventory 19 | baseuri: "{{ baseuri }}" 20 | username: "{{ username }}" 21 | password: "{{ password }}" 22 | register: result 23 | 24 | - name: Copy results to output file 25 | copy: 26 | content: "{{ result | to_nice_json }}" 27 | dest: "{{ template }}.json" 28 | -------------------------------------------------------------------------------- /playbooks/systems/get_nic_inventory.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: NIC Inventory 5 | gather_facts: False 6 | 7 | vars: 8 | datatype: NicInventory 9 | 10 | tasks: 11 | 12 | - name: Define output file 13 | include_tasks: create_output_file.yml 14 | 15 | - name: Get NIC Information 16 | redfish_info: 17 | category: Systems 18 | command: GetNicInventory 19 | baseuri: "{{ baseuri }}" 20 | username: "{{ username }}" 21 | password: "{{ password }}" 22 | register: result 23 | 24 | - name: Copy results to output file 25 | copy: 26 | content: "{{ result | to_nice_json }}" 27 | dest: "{{ template }}.json" 28 | -------------------------------------------------------------------------------- /playbooks/systems/get_storage_cont_inventory.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Get storage controller inventory 5 | gather_facts: False 6 | 7 | vars: 8 | datatype: StorageControllerInventory 9 | 10 | tasks: 11 | 12 | - name: Define output file 13 | include_tasks: create_output_file.yml 14 | 15 | - name: Get storage controller inventory 16 | redfish_info: 17 | category: Systems 18 | command: GetStorageControllerInventory 19 | baseuri: "{{ baseuri }}" 20 | username: "{{ username }}" 21 | password: "{{ password }}" 22 | register: result 23 | 24 | - name: Copy results to output file 25 | copy: 26 | content: "{{ result | to_nice_json }}" 27 | dest: "{{ template }}.json" 28 | -------------------------------------------------------------------------------- /playbooks/systems/get_system_inventory.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: System Inventory 5 | gather_facts: False 6 | 7 | vars: 8 | datatype: SystemInventory 9 | 10 | tasks: 11 | 12 | - name: Define output file 13 | include_tasks: create_output_file.yml 14 | 15 | - name: Getting system inventory 16 | redfish_info: 17 | category: Systems 18 | command: GetSystemInventory 19 | baseuri: "{{ baseuri }}" 20 | username: "{{ username }}" 21 | password: "{{ password }}" 22 | register: result 23 | 24 | - name: Copy results to output file 25 | copy: 26 | content: "{{ result | to_nice_json }}" 27 | dest: "{{ template }}.json" 28 | -------------------------------------------------------------------------------- /playbooks/systems/get_system_inventory_all.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Inventory 5 | gather_facts: False 6 | 7 | vars: 8 | datatype: SystemAll 9 | 10 | tasks: 11 | 12 | - name: Set output file 13 | include_tasks: create_output_file.yml 14 | 15 | - name: Get Inventory 16 | redfish_info: 17 | category: Systems 18 | command: all 19 | baseuri: "{{ baseuri }}" 20 | username: "{{ username}}" 21 | password: "{{ password }}" 22 | register: result 23 | 24 | - name: Copy results to output file 25 | copy: 26 | content: "{{ result | to_nice_json }}" 27 | dest: "{{ template }}.json" 28 | -------------------------------------------------------------------------------- /playbooks/systems/get_system_inventory_default.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Inventory 5 | gather_facts: False 6 | 7 | vars: 8 | datatype: SystemInventory 9 | 10 | tasks: 11 | 12 | - name: Set output file 13 | include_tasks: create_output_file.yml 14 | 15 | - name: Get Inventory 16 | redfish_info: 17 | category: Systems 18 | baseuri: "{{ baseuri }}" 19 | username: "{{ username}}" 20 | password: "{{ password }}" 21 | register: result 22 | 23 | - name: Copy results to output file 24 | copy: 25 | content: "{{ result | to_nice_json }}" 26 | dest: "{{ template }}.json" 27 | -------------------------------------------------------------------------------- /playbooks/systems/get_system_inventory_several.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Inventory 5 | gather_facts: False 6 | 7 | vars: 8 | datatype: SystemInventory 9 | 10 | tasks: 11 | 12 | - name: Set output file 13 | include_tasks: create_output_file.yml 14 | 15 | - name: Get Inventory 16 | redfish_info: 17 | category: Systems 18 | command: GetDiskInventory,GetNicInventory 19 | baseuri: "{{ baseuri }}" 20 | username: "{{ username}}" 21 | password: "{{ password }}" 22 | register: result 23 | 24 | - name: Copy results to output file 25 | copy: 26 | content: "{{ result | to_nice_json }}" 27 | dest: "{{ template }}.json" 28 | -------------------------------------------------------------------------------- /playbooks/systems/get_volume_inventory.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Volume Inventory 5 | gather_facts: False 6 | 7 | vars: 8 | datatype: VolumeInventory 9 | 10 | tasks: 11 | 12 | - name: Define output file 13 | include_tasks: create_output_file.yml 14 | 15 | - name: Get Volume Inventory 16 | redfish_info: 17 | category: Systems 18 | command: GetVolumeInventory 19 | baseuri: "{{ baseuri }}" 20 | username: "{{ username }}" 21 | password: "{{ password }}" 22 | register: result 23 | 24 | - name: Copy results to output file 25 | copy: 26 | content: "{{ result | to_nice_json }}" 27 | dest: "{{ template }}.json" 28 | -------------------------------------------------------------------------------- /playbooks/systems/power_force_off.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Manage System Power - Force Off 5 | gather_facts: False 6 | 7 | tasks: 8 | 9 | - name: Turn system power off 10 | redfish_command: 11 | category: Systems 12 | command: PowerForceOff 13 | baseuri: "{{ baseuri }}" 14 | username: "{{ username }}" 15 | password: "{{ password }}" 16 | -------------------------------------------------------------------------------- /playbooks/systems/power_force_restart.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Manage System Power - Force restart 5 | gather_facts: False 6 | 7 | tasks: 8 | 9 | - name: Restart system power forcefully 10 | redfish_command: 11 | category: Systems 12 | command: PowerForceRestart 13 | baseuri: "{{ baseuri }}" 14 | username: "{{ username }}" 15 | password: "{{ password }}" 16 | -------------------------------------------------------------------------------- /playbooks/systems/power_graceful_restart.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Manage System Power - Graceful restart 5 | gather_facts: False 6 | 7 | tasks: 8 | 9 | - name: Restart system power gracefully 10 | redfish_command: 11 | category: Systems 12 | command: PowerGracefulRestart 13 | baseuri: "{{ baseuri }}" 14 | username: "{{ username }}" 15 | password: "{{ password }}" 16 | -------------------------------------------------------------------------------- /playbooks/systems/power_graceful_shutdown.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Manage System Power - Graceful shutdown 5 | gather_facts: False 6 | 7 | tasks: 8 | 9 | - name: Shutdown system power gracefully 10 | redfish_command: 11 | category: Systems 12 | command: PowerGracefulShutdown 13 | baseuri: "{{ baseuri }}" 14 | username: "{{ username }}" 15 | password: "{{ password }}" 16 | -------------------------------------------------------------------------------- /playbooks/systems/power_on.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Manage System Power - Turn on 5 | gather_facts: False 6 | 7 | tasks: 8 | 9 | - name: Turn system power on 10 | redfish_command: 11 | category: Systems 12 | command: PowerOn 13 | baseuri: "{{ baseuri }}" 14 | username: "{{ username }}" 15 | password: "{{ password }}" 16 | -------------------------------------------------------------------------------- /playbooks/systems/power_reboot.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Manage System Power - Reboot 5 | gather_facts: False 6 | 7 | tasks: 8 | 9 | - name: Reboot system power 10 | redfish_command: 11 | category: Systems 12 | command: PowerReboot 13 | baseuri: "{{ baseuri }}" 14 | username: "{{ username }}" 15 | password: "{{ password }}" 16 | -------------------------------------------------------------------------------- /playbooks/systems/set_bios_attribute.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Set BIOS attribute - choose below 5 | gather_facts: False 6 | 7 | # Example BIOS attributes (vendor specific) 8 | # 9 | # Name Value 10 | # -------------------------------------------------- 11 | # OsWatchdogTimer Disabled / Enabled 12 | # ProcVirtualization Disabled / Enabled 13 | # MemTest Disabled / Enabled 14 | # SriovGlobalEnable Disabled / Enabled 15 | 16 | vars: 17 | - attribute_name: SriovGlobalEnable 18 | - attribute_value: Enabled 19 | 20 | tasks: 21 | 22 | - name: Set BIOS attribute {{ attribute_name }} to {{ attribute_value }} 23 | redfish_config: 24 | category: Systems 25 | command: SetBiosAttributes 26 | bios_attribute_name: "{{ attribute_name }}" 27 | bios_attribute_value: "{{ attribute_value }}" 28 | baseuri: "{{ baseuri }}" 29 | username: "{{ username }}" 30 | password: "{{ password }}" 31 | register: bios_attribute 32 | 33 | - name: Reboot system to apply new BIOS settings 34 | redfish_command: 35 | category: Systems 36 | command: PowerReboot 37 | baseuri: "{{ baseuri }}" 38 | username: "{{ username }}" 39 | password: "{{ password }}" 40 | when: bios_attribute.changed 41 | -------------------------------------------------------------------------------- /playbooks/systems/set_default_bios_settings.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Set default BIOS settings 5 | gather_facts: False 6 | 7 | tasks: 8 | 9 | - name: Set BIOS default settings 10 | redfish_config: 11 | category: Systems 12 | command: SetBiosDefaultSettings 13 | baseuri: "{{ baseuri }}" 14 | username: "{{ username }}" 15 | password: "{{ password }}" 16 | register: bios_default 17 | 18 | - name: Reboot system to apply new BIOS settings 19 | redfish_command: 20 | category: Systems 21 | command: PowerReboot 22 | baseuri: "{{ baseuri }}" 23 | username: "{{ username }}" 24 | password: "{{ password }}" 25 | when: bios_default.changed 26 | -------------------------------------------------------------------------------- /playbooks/systems/set_onetime_boot_legacy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Set one-time boot device (legacy mode) 5 | gather_facts: False 6 | 7 | # Bootdevice options include: None, Pxe, Cd, Floppy, Hdd, BiosSetup, 8 | # Usb, Utilities, Diags, UefiShell, and SDCard. 9 | 10 | vars: 11 | - bootdevice: Pxe 12 | 13 | tasks: 14 | 15 | - name: Set one-time boot device to {{ bootdevice }} 16 | redfish_command: 17 | category: Systems 18 | command: SetOneTimeBoot 19 | bootdevice: "{{ bootdevice }}" 20 | baseuri: "{{ baseuri }}" 21 | username: "{{ username }}" 22 | password: "{{ password }}" 23 | register: onetimeboot 24 | 25 | - name: Reboot system 26 | redfish_command: 27 | category: Systems 28 | command: PowerReboot 29 | baseuri: "{{ baseuri }}" 30 | username: "{{ username }}" 31 | password: "{{ password }}" 32 | when: onetimeboot.changed 33 | -------------------------------------------------------------------------------- /playbooks/systems/set_onetime_boot_next.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Set one-time boot device (UEFI boot next mode) 5 | gather_facts: False 6 | 7 | vars: 8 | - bootdevice: UefiBootNext 9 | - boot_next: Boot0001 10 | 11 | tasks: 12 | 13 | - name: Set one-time boot device to {{ bootdevice }} 14 | redfish_command: 15 | category: Systems 16 | command: SetOneTimeBoot 17 | bootdevice: "{{ bootdevice }}" 18 | boot_next: "{{ boot_next }}" 19 | baseuri: "{{ baseuri }}" 20 | username: "{{ username }}" 21 | password: "{{ password }}" 22 | register: onetimeboot 23 | 24 | - name: Reboot system 25 | redfish_command: 26 | category: Systems 27 | command: PowerReboot 28 | baseuri: "{{ baseuri }}" 29 | username: "{{ username }}" 30 | password: "{{ password }}" 31 | when: onetimeboot.changed 32 | -------------------------------------------------------------------------------- /playbooks/systems/set_onetime_boot_uefi.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Set one-time BIOS boot device (UEFI target mode) 5 | gather_facts: False 6 | 7 | vars: 8 | - bootdevice: UefiTarget 9 | - uefi_target: "/0x31/0x33/0x01/0x01" 10 | 11 | tasks: 12 | 13 | - name: Set one-time boot device to {{ bootdevice }} 14 | redfish_command: 15 | category: Systems 16 | command: SetOneTimeBoot 17 | bootdevice: "{{ bootdevice }}" 18 | uefi_target: "{{ uefi_target }}" 19 | baseuri: "{{ baseuri }}" 20 | username: "{{ username }}" 21 | password: "{{ password }}" 22 | register: onetimeboot 23 | 24 | - name: Reboot system 25 | redfish_command: 26 | category: Systems 27 | command: PowerReboot 28 | baseuri: "{{ baseuri }}" 29 | username: "{{ username }}" 30 | password: "{{ password }}" 31 | when: onetimeboot.changed 32 | -------------------------------------------------------------------------------- /playbooks/update/create_output_file.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Define timestamp 3 | set_fact: timestamp="{{ lookup('pipe', 'date +%Y%m%d_%H%M%S') }}" 4 | run_once: true 5 | 6 | - name: Define file to place results 7 | set_fact: template={{rootdir}}/{{host}}/{{host}}_{{datatype}}_{{timestamp}} 8 | 9 | - name: Create dropoff directory for host 10 | file: 11 | path: "{{ rootdir }}/{{ host }}" 12 | state: directory 13 | -------------------------------------------------------------------------------- /playbooks/update/get_firmware_inventory.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Device Firmware Inventory 5 | gather_facts: False 6 | 7 | vars: 8 | datatype: FirmwareInventory 9 | 10 | tasks: 11 | 12 | - name: Set output file 13 | include_tasks: create_output_file.yml 14 | 15 | - name: Get Firmware Inventory 16 | redfish_info: 17 | category: Update 18 | command: GetFirmwareInventory 19 | baseuri: "{{ baseuri }}" 20 | username: "{{ username }}" 21 | password: "{{ password }}" 22 | register: result 23 | 24 | - name: Copy results to output file 25 | copy: 26 | content: "{{ result | to_nice_json }}" 27 | dest: "{{ template }}.json" 28 | -------------------------------------------------------------------------------- /playbooks/update/get_firmware_update_methods.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: myhosts 3 | connection: local 4 | name: Get Firmware Update Capabilities 5 | gather_facts: False 6 | 7 | vars: 8 | datatype: FirmwareUpdateCapabilities 9 | 10 | tasks: 11 | 12 | - name: Set output file 13 | include_tasks: create_output_file.yml 14 | 15 | - name: Get Firmware Update Capabilities 16 | redfish_info: 17 | category: Update 18 | command: GetFirmwareUpdateCapabilities 19 | baseuri: "{{ baseuri }}" 20 | username: "{{ username }}" 21 | password: "{{ password }}" 22 | register: result 23 | 24 | - name: Copy results to output file 25 | copy: 26 | content: "{{ result | to_nice_json }}" 27 | dest: "{{ template }}.json" 28 | --------------------------------------------------------------------------------