On 19. april 2016 23:09, Chris D wrote:
Unfortunately, I haven't been able to find the right combination of
quotes/single quotes to get the command to run successfully.

Example: host1 has 3 postgres databases on it: db1, db2, and db3

ansible 'host1' -m shell -a 'for database in $(psql -l | grep '^ db' | awk
'{print $1}'); do psql -c '\dx'; done

This is not tested, but should work:

ansible 'host1' -m shell -a "for database in \$(psql -l | grep '^ db' | awk '{print \$1}'); do psql -c \"\dx \$database\"; done"


--
Kai Stian Olstad

--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/aacaa613-9532-0f46-35f3-adf4ff0e8d32%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to