*contents of input.yml*
---
computeserver1:
- name: compute4
ipaddress: 192.168.211.251
console: 192.168.211.10
consoleuser: administrator
consolepassword: 1
computeserver2:
- name: compute5
ipaddress: 192.168.211.253
console: 192.168.211.11
consoleuser: administrator
consolepassword: 1
with out register: everything works but i want to take action based on the
result returned by ipmi.So i am trying register: to save result of ipmi and
then based on the result ,sending ipmi reset/ON for a set of servers.
On Wednesday, August 5, 2015 at 9:03:36 AM UTC+5:30, Igor Cicimov wrote:
>
> Can you share the structure of the "computeserver1" or even better the
> content of the input.yml file?
>
> I guess you have confirmed that executing the same ipmi command from the
> Ansible station manually works properly?
>
> On Tuesday, August 4, 2015 at 3:06:49 AM UTC+10, kevin parker wrote:
>>
>> i am trying to use "ipmitools" to check power status and based on the
>> result i will start/reset the server.But i am not able to continue as
>> register: and looping are not working .Is there any alternate approach for
>> achieving below?
>>
>>
>>
>> ---
>> - hosts: compute
>> gather_facts: no
>> vars_files:
>> - input.yml
>>
>> tasks:
>>
>> - name: check Power status of target
>> local_action: command ipmitool -I lanplus -H {{item.console}} -U
>> {{item.consoleuser}} -P {{item.consolepassword}} power status
>> with_items:
>> - "{{ computeserver1 }}"
>> when: item.console and item.consoleuser and item.consolepassword is
>> defined
>> register: power
>>
>> - name: check Debug
>> debug: var=power.stdout
>>
>> - name: Power Reset
>> local_action: command ipmitool -I lanplus -H {{item.console}} -U
>> {{item.consoleuser}} -P {{item.consolepassword}} power reset
>> with_items:
>> - "{{ computeserver1 }}"
>> when: item.console and item.consoleuser and item.consolepassword is
>> defined and power.stdout.find('Chassis Power is on') != -1
>>
>> - name: Power On
>> local_action: command ipmitool -I lanplus -H {{item.console}} -U
>> {{item.consoleuser}} -P {{item.consolepassword}} power on
>> with_items:
>> - "{{ computeserver1 }}"
>> when: item.console and item.consoleuser and item.consolepassword is
>> defined and power.stdout.find('Chassis Power is off') != -1
>>
>> Thanks for any help
>>
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/839cbd57-f1ee-4ac8-aed0-dbbd7f711c9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.