how to use an pipe like < < in ansible ?

i want to use a command like:

read CURRENT_LOG CURRENT_POS < <( mysql -BNe “SHOW MASTER STATUS”); echo CURRENT_LOG=$CURRENT_LOG CURRENT_POS=$CURRENT_POS

(credits: https://dba.stackexchange.com/questions/34934/how-to-retrieve-master-log-position-and-master-log-file-in-shell-script)

But ansible dont unterstand “< <”

What can i do ?

Use the shell module.

no. this doesnt work, because the shell command only support one “<”

Without an error message I'm not sure whether I'm looking at the same
thing but this looks like a portability problem with the shell script
you are attempting to use.

In /bin/sh (implemented by bash), I get the following error:

$ /bin/sh *[stable-2.7] (10:54:10)
sh-4.4$ read HELLO_WORLD <<(/bin/expr 1 + 1) ; echo $HELLO_WORLD
sh: syntax error near unexpected token `('

Similarly /bin/bash:

$ /bin/bash *[stable-2.7] (10:54:31)
[badger@peru:16 stable-2.7]$ read HELLO_WORLD <<(/bin/expr 1 + 1) ;
echo $HELLO_WORLD
bash: syntax error near unexpected token `('

In /bin/zsh, I can get it to work, though:
$ /bin/zsh *[stable-2.7] (10:54:36)
[pts/16@peru /srv/ansible/stable-2.7]$ read HELLO_WORLD <<(/bin/expr 1
+ 1) ; echo $HELLO_WORLD
2

So if you have zsh installed, you could write your ansible command like this:
$ ansible localhost -m shell -a 'executable=/bin/zsh read HELLO_WORLD
<<(/bin/expr 1 + 1) ; echo $HELLO_WORLD'
localhost | CHANGED | rc=0 >>
2

And the equivalent playbook:

Try using ‘tee -a …’ in the pipeline.

Dave