I am executing ansible adhoc command
ansible hosts -m shell -a 'df -P | awk '0+$5 >=30 {print}''
#ERROR! Missing target hosts
The single quotes that we use for awk print is conflicting with the -a
''
command that we use.
I tried below formats no luck.
I believe there is way to escape '
ansible hosts -m command -a 'df -P|awk '0+$5 >=30 {print}''
ansible hosts -m command -a "df -P|awk '0+$5 >=30 {print}'"
ansible hosts -m command -a 'df -P|awk "0+$5 >=30 {print}"'
Anyone has tried this before.
|
pipe..