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-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/9e896ba5-12df-4a8b-8cff-0dec822277bd%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.