When I execute the following command to find index IDs by using an Ansible ad-hoc command:
$ ansible oamvip -i /storage/inventory/None/${myvnf}hosts --become -m shell -a "/usr/sbin/aladmin list | grep "PartitionUsage" | awk '{ print \$2 }'"
xxx.xx.xxx.xxx | CHANGED | rc=0 >>
4818b4715eb6542838023
e520bec15eb6542838023
However, when I try to execute a shell command (sh) on the results from the awk output, Ansible shows me the help menu:
$ ansible oamvip -i /storage/inventory/None/${myvnf}hosts --become -m shell -a "/usr/sbin/aladmin list | grep "PartitionUsage" | awk '{ print "aladmin show " \$2 | "sh"}'"
Usage: ansible <host-pattern> [options]
I've tried single and double quotes, backslashes, to no avail. Please advise.
$ ansible oamvip -i /storage/inventory/None/${myvnf}hosts --become -m shell -a "/usr/sbin/aladmin list | grep "PartitionUsage" | awk '{ print \"aladmin show \", \$2 | \"sh\"}'"awkjust combines the arguments toprint. With the comma they get separated byOFS(space).