Ansible-vault not decrypting on 2nd node in parallel environment

python
circle.yml

#1

I’m attempting to run tests with 2x parallelism using Django. I’m setting up environment variables with ansible-vault in a circle.yml step as such.

test:
  pre:
    - bash ${HOME}/ginger/ci-add-aws-ips.sh us-east-1 sg-f87ddb87 5439
    - ansible-vault decrypt ${HOME}/ginger/config/settings/.env_vault --vault-password-file ${HOME}/ginger/ansible/.vault_pass --output ${HOME}/ginger/config/settings/.env
  override:
    - bash ${HOME}/ginger/circleci-testrunner.sh:
        parallel: true

My testrunner is of the simple manual type and looks like this

case "$CIRCLE_NODE_INDEX" in
0) coverage run --source='.' manage.py test --keepdb --settings=config.settings.test --verbosity 2 --tag=search
  ;;
1) coverage run --source='.' manage.py test --keepdb --settings=config.settings.test --verbosity 2 --exclude-tag=search
  ;;
esac

It seems that in the second container, my .env file does not get decrypted. The step does say Decryption successful, however, the file is not located in the directory. It does work on the first node, however. Also, if I ssh into the 2nd container manually, I am able to run the command successfully.

What do I not understand about Circle parallelism that my ansible-decrypt command works on the first node, but not on the 2nd?


#2

I missed the line in the docs that states that parallel

It defaults to true for commands in the machine, checkout, dependencies and database build phases, and it defaults to false for commands in the test phases.

https://circleci.com/docs/1.0/parallel-manual-setup/#a-simple-example

Changing my test commands to all parallel: true fixed my issue.


#3