I am collecting some output from ansible_facts
and writing them to a file on remote server with the help of copy module (content and dest)
I need to write as NONE if some item is not available on server (say disk sdb is not present on server).
How can I write NONE if disk sdb
is not found?
My playbook is as below
- copy:
content: |
Memory = {{ ansible_memtotal_mb }}
Size of disk sda = {{ ansible_devices.sda.size }}
dest: /tmp/test
but if disk sdb is not available on the server how to check and write a custom message like below
Size of disk sdb = NONE