Execute eval from shell module to set up environment variables

Is it possible to execute eval command from a shell module to set up environment variables ?

This is a snippet from a playbook which tries to set up environment variables by executing eval command

`
eval $(docker-machine env DEV-MACHINE)

`

This is the result of the eval command

`

export DOCKER_TLS_VERIFY=“1”
export DOCKER_HOST=“tcp://192.168.99.100:2376”
export DOCKER_CERT_PATH=“/home/user/.docker/machine/machines/DEV-MACHINE”
export DOCKER_MACHINE_NAME=“DEV-MACHINE”

`

When this is executed from an ansible playbook environment variables are not set

Best Regards to the team !

You need to put those export commands in the shell initialization files. Running export will set it just for the current session, which will close when the playbook ends.

You need to put those export commands in the shell initialization files. Running export will set it just for the current session, which will close when the playbook ends.

Adrian could you be more specific what do we call shell initialization files.