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.

- name: Print results
       debug:
         msg:
           - "Board: {{ ansible_product_name }}"
           - "CPU: {{ ansible_processor[1] }}   Cores: {{ 
ansible_processor_cores }}   CPU Count: {{ ansible_processor_count }}"
           - "Memory: {{ ansible_memtotal_mb }}"
           - "ansible processor count: {{ ansible_processor_count }}"
           - "Log File: {{ logfile }}"
           - "{{ out.stdout.split('\n') }}"
           - "{{sel_out.stdout.split('\n') }}"
       when: sel_out is defined


fatal: [192.168.100.11]: FAILED! => {"ansible_job_id": 
"717909993947.50020", "changed": true, "cmd": "ipmitool sel list | grep -i 
ecc", "delta": "0:00:00.088089", "end": "2017-08-11 06:02:57.289040", 
"failed": true, "finished": 1, "rc": 1, "start": "2017-08-11 
06:02:57.200951", "stderr": "", "stderr_lines": [], "stdout": "", 
"stdout_lines": []}




On Thursday, August 10, 2017 at 10:32:55 PM UTC-7, Dick Visser wrote:
>
> 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 
> column as name and debug.
>
> Dick
>
> On Thu, 10 Aug 2017 at 22:55, Ryan <jrya...@gmail.com <javascript:>> 
> wrote:
>
>> 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 }}"
>>            - "Memory: {{ ansible_memtotal_mb }}"
>>            - "ansible processor count: {{ ansible_processor_count }}"
>>            - "Log File: {{ logfile }}"
>>            - "{{ out.stdout.split('\n') }}"
>>            - "{{sel_out.stdout.split('\n') }}"
>>
>>
>> Depending on the results, sometimes "register: out" and/or "register: 
>> sel_out" may not be defined, so the last two messages, will fail if not 
>> defined.  I tried using the following, but it does not like this method, so 
>> i am doing it wrong.
>>
>>      - name: Print results
>>        debug:
>>          msg:
>>            - "Board: {{ ansible_product_name }}"
>>            - "CPU: {{ ansible_processor[1] }}   Cores: {{ 
>> ansible_processor_cores }}   CPU Count: {{ ansible_processor_count }}"
>>            - "Memory: {{ ansible_memtotal_mb }}"
>>            - "ansible processor count: {{ ansible_processor_count }}"
>>            - "Log File: {{ logfile }}"
>>            - "{{ out.stdout.split('\n') }}"
>>            - "{{sel_out.stdout.split('\n') }}"
>>                when: sel_out is defined
>>
>>
>> -- 
>> 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 ansible-proje...@googlegroups.com <javascript:>.
>> To post to this group, send email to ansible...@googlegroups.com 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/9e896ba5-12df-4a8b-8cff-0dec822277bd%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/9e896ba5-12df-4a8b-8cff-0dec822277bd%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> -- 
> Dick Visser
> G√ČANT
>
> Want to join us? We're hiring: https://www.geant.org/jobs
>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6c51d662-5d79-4be5-a6b7-f63c147c0063%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to