From 5bab327c2d2fc7434fcc35fad8702261e800b398 Mon Sep 17 00:00:00 2001 From: Yolanda Robla Date: Fri, 26 Feb 2016 00:24:06 +0100 Subject: [PATCH] Add playbook to manage power state of ironic servers The playbook accepts target and power_state as arguments. Change-Id: I60abd75b3605098fbcca8bcf1b6406a886a5996a --- playbooks/infracloud/manage_power.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 playbooks/infracloud/manage_power.yml diff --git a/playbooks/infracloud/manage_power.yml b/playbooks/infracloud/manage_power.yml new file mode 100755 index 0000000000..046b6656e8 --- /dev/null +++ b/playbooks/infracloud/manage_power.yml @@ -0,0 +1,16 @@ +# This playbook will allow to manage power state of the baremetal group +# power_state setting needs to be passed, with on/off values +# Following settings are available (can be passed with -e flag): +# - target: group or host where to run the play. -etarget=baremetal will run +# this play in all servers managed by bifrost. +# - power_state: It will take off/on values, and will set the servers to +# this power state. +--- +- hosts: "{{ target }}" + connection: local + gather_facts: true + tasks: + - name: 'Manage power state of the given host' + shell: "ironic node-set-power-state '{{ inventory_hostname }}' '{{ power_state }}'" + failed_when: ( power_state != 'on' ) and ( power_state != 'off' ) +