I’m looking to write a playbook that powers on my servers. I need to do the following things:
- For each server, first connect to two PDUs and turn on the outlet for each of the server’s PSU (each server has 2 PSUs, connected to two different PDUs). This is done by a simple “command: curl http://{{ pdu_fqdn }}/outlet?{{ outlet_num }}=ON” ( later I may write a module to make this “dli_wps: outlet={{ outlet_num }} state=on” )
- Then use “command: ipmitool …” to connect to the BMC and power on the server
I’m wondering what pattern is recommended for respecting the relationship between the servers and the PDUs. In other words, should I:
- simply create a flat playbook that issues commands to turn on the outlets and then the servers
- create a pdu role and a server role, an inventory that contains a pdus group and a servers group, and a playbook that first executes on the pdu group then the server group
- create a server role and an inventory file that supplies pdu information as variables for each server either in the inventory or in a vars file (e.g., psu1_fqdn=fqdn psu1_outlet=4 psu2=fqdn2 psu2_outlet=7), and have the server role include the command to turn on the the pdu outlets
?
Of course, in all cases, since the server is powered off and the PDUs are fairly dumb devices, I need to delegate these tasks to a Linux system (likely a jump host local to the network), so there is a third actor with a relationship.
I know I /could/ do this any of the ways above; I’m wondering what the collective experience has been in identifying good patterns for this, looking for the intersection of reusability, flexibility, and pragmatism.
Thanks all,
-Matt