[ansible-project] Add conditionals to debug msg

2017-08-10 Thread Ryan
How do I add a conditionals to debug msg lists? - name: Print results debug: msg: - "Board: {{ ansible_product_name }}" - "CPU: {{ ansible_processor[1] }} Cores: {{ ansible_processor_cores }} CPU Count: {{ ansible_processor_count }}" - "Me

Re: [ansible-project] Add conditionals to debug msg

2017-08-10 Thread Dick Visser
Not sure what you mean by 'it doesn't like this method'? I'm guessing you're getting an error - which would have been helpful in diagnosing the issue. So again, guessing, and hard to see from this message, but it looks like the indentation of the when statement is way off. It should be at the same

Re: [ansible-project] Add conditionals to debug msg

2017-08-10 Thread Ryan
Sorry, I will attache the error next time. I tried indenting it to the same column as name and debug, but it still failed. If I change the command to something that returns a value for sel_out, the debug msg returns the expected output. The error only comes when sel_out is not defined. - na

Re: [ansible-project] Add conditionals to debug msg

2017-08-10 Thread Ryan
There seems to be a paste formatting issue. Under vim name and debug are in the same column. They were not when I pasted them in the last reply. On Thursday, August 10, 2017 at 11:25:52 PM UTC-7, Ryan wrote: > > > Sorry, I will attache the error next time. > > I tried indenting it to the same

Re: [ansible-project] Add conditionals to debug msg

2017-08-11 Thread Kai Stian Olstad
On 11. aug. 2017 08:25, Ryan wrote: Sorry, I will attache the error next time. But you didn't include all relevant output. I tried indenting it to the same column as name and debug, but it still failed. If I change the command to something that returns a value for sel_out, the debug msg re

Re: [ansible-project] Add conditionals to debug msg

2017-08-11 Thread Ryan
I tried adding "changed_when" for when sel_out is not defined, but it gives me an error, so I am not sure how to use "changed_when" in this case. What's the correct usage? - name: Check for ECC's shell: ipmitool sel list | grep -i ecc register: sel_out changed_when: se

Re: [ansible-project] Add conditionals to debug msg

2017-08-12 Thread Kai Stian Olstad
On 12. aug. 2017 04:09, Ryan wrote: I tried adding "changed_when" for when sel_out is not defined, but it gives me an error, so I am not sure how to use "changed_when" in this case. I'm sorry, i meant to write failed_when and not changed_when, but the usage is the same. What's the correc

Re: [ansible-project] Add conditionals to debug msg

2017-08-14 Thread Ryan
Thanks for the detailed reply. - name: Check for ECC's shell: ipmitool sel list | grep -i ecc register: sel_out failed_when: sel_out.rc > 1 async: 3 poll: 2 TASK [Check for ECC's] ***

Re: [ansible-project] Add conditionals to debug msg

2017-08-14 Thread Kai Stian Olstad
On 14. aug. 2017 23:58, Ryan wrote: Thanks for the detailed reply. - name: Check for ECC's shell: ipmitool sel list | grep -i ecc register: sel_out failed_when: sel_out.rc > 1 async: 3 poll: 2 TASK [Check for ECC's]

Re: [ansible-project] Add conditionals to debug msg

2017-08-15 Thread Ryan
If i remove async and poll your solution does work. I was using them because depending on the platform the playbook is executed on, the time to complete can vary a lot. I will play around with not using the async and poll and see what the result is, as I am still new to Ansible obviously. Tha