Running trellis dotenv
always returns this output:
[✘] Error templating .env file
Error running ansible-playbook: exit status 1
Info:
Manjaro
Trellis CLI 1.7.0
Tried using different python versions (3.8, 3.9, 3.10) with pyenv but no luck
trellis exec ansible --version
ansible [core 2.12.9]
config file = /home/work/Code/wordpress/xxx/trellis/ansible.cfg
configured module search path = ['/home/work/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/work/Code/wordpress/xxx/trellis/.trellis/virtualenv/lib/python3.10/site-packages/ansible
ansible collection location = /home/work/.ansible/collections:/usr/share/ansible/collections
executable location = /home/work/Code/wordpress/xxx/trellis/.trellis/virtualenv/bin/ansible
python version = 3.10.5 (main, Aug 1 2022, 07:53:20) [GCC 12.1.0]
jinja version = 3.1.2
libyaml = True
Any ideas what may be wrong?
We should add a way to debug tasks like this which internally use temporary playbooks. You have two options to see more output to help troubleshoot in the meantime:
- Change the source locally and run the locally built binary. You’d want to change this line to be:
dotenv := command.WithOptions(command.WithUiOutput(c.UI)).Cmd("ansible-playbook", []string{"dotenv.yml", "-e", "env=" + environment})
- Copy the [internal playbook file](https://github.com/roots/trellis-cli/blob/29f1171f69d4bfccfc4021cd6afed3453884e649/cmd/files/playbooks/dot_env_template.y
ml) to your project and run it manually: trellis exec ansible-playbook dotenv.yml -e "env=foo"
The second option is probably much easier to start with.
So the problem ended up being two-fold.
The first issue is that my project directory was a symlink to a directory on a drive that was mounted without executable permissions.
The second issue was that I had forgotten to place the .vault_pass
file (had done many iterations of deleting and trying things so this was an easy mistake).
Following your second option I was shown the message about vault password file being missing, which is not present in trellis dotenv
.
Thanks for the help @swalkinshaw. Seems that this is related to Feature Request: generate .vault_pass for existing sites · Issue #300 · roots/trellis-cli · GitHub
1 Like