This collection of playbooks automates common DRAC tasks. It has been tested on DRAC v5 and some newer versions.
You'll need to have ansible installed to use these playbooks.
See below for setup, a description of each, and how to run them.
In general you can run ansible-playbook
with the name of the playbook YAML file.
All commands have these common arguments (see ansible-playbook -h
for more info):
-f #
- run # threads at once (ansible default is currently 5)
-i <inventory file>
- path to ini-style inventory file (see example-hosts)
-l <group>
- group or host in inventory file to limit operations to
Example:
ansible-playbook -f 15 -i example-hosts -l google ping.yml
Enables virtual media auto-attaching (required for remote files to work).
Connects and runs a "noop" command, printing full response from the remote.
The debug playbook is useful as a quick "status" check. The tasks will almost always succeed but the output will tell you if the DRAC is responding, etc.
Limit DRAC services to ssh.
NOTE: This playbook will execute racadm racreset
at the end of a successful run. You may want to test this on a single DRAC first. :)
Tests basic pingability of the DRAC from the local system. Running the above example should result in some successful and some failed pings.
Checks to see if racadm is runnable.
Runs a racreset on each DRAC.
Sets the root password to the provided value. Run it with an additional argument like this (replace newpassword with your desired password):
ansible-playbook -e "root_password=newpassword" -i example-hosts set-root-password.yml
NOTE: Use a 20 character or less password for maximum compatibility.
Enables or disables the web UI.
If you proxy through a "bastion" (shell, jumpbox, etc.) system to access the DRACs then do the following:
cp ssh_config.example ssh_config
- change
username
to your username (or remove those lines if they match your login user) - change
bastion.*.com
andbastion.zero.com
to the actual host/wildcard that matches your configuration - uncomment the the denoted line in
ansible.cfg
At this point ansible runs should use the alternate ssh_config that tunnels connections through your bastion/jumpbox.
To add debug output to any task add the following:
register: result
- debug: var=result
See the debug.yml
playbook for a complete example.
You can also use -vvv
with the ansible-playbook command for additional debug output.
- running
exit
as a command confuses ansible-playbook when using a bastion/ssh_proxy setup (ansible ad-hoc will run it just fine though) - if you setup an ssh proxy config in a separate file (e.g. not your ~/.ssh/config) remember to also refer to that same config file via
-F <ssh_config>
when specifying the ProxyCommand (or the subsequent ssh will use your default config instead)
- add tests (need a remote drac simulator!)
- handle more failure cases
- add cipher0 check/fix
- conditionally update settings (check first, apply only if needed..maybe we can add custom drac facts?)
- find cases where we show success but actually failed still :(
- add link to RS-specific info on how to generate drac-hosts inventory