I'm trying to run a command using the Ansible shell module, but having some 
trouble.  Basically, with this command, I want to list all postgres 
databases on a server, then run the psql -c '\dx' command against them to 
find out what extensions are installed in each database in the cluster.

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

I've tried enclosing the whole 'for... done' command in double-quotes, etc, 
but no luck :(

-- 
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/97962ea8-9fd7-49c0-b3f8-c230c4e1670a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to