Docker Deployment - Errno 2

47 views
Skip to first unread message

Dave Gilmore

unread,
Sep 25, 2020, 9:05:05 AM9/25/20
to Ansible Project
Hi Folks,

I am having some issues deploying containers to a remote host, specifically reading in a env_file.

The error message I get is:

[Errno 2] No such file or directory: \"['/usr/local/hg/defaults.env', '/var/lib/data/hg/config.env']

But I can see the files *are* deployed to the remote host via Ansible template, i've even opened up all the permissions in frustration!

/usr/local/hg/

-rwxrwxrwx 1 root root 29 Sep 25 12:38 defaults.env

/var/lib/data/hg/

-rwxrwxrwx 1 root root  273 Sep 25 12:38 config.env

These files DO NOT exist on the control node, but I don't think they need to as Docs state that it's a file on target - https://docs.ansible.com/ansible/latest/collections/community/general/docker_container_module.html#parameter-env_file

This is driving me round the bend a little now, and it's the last thing i need to finish to meet a deliverable, so close tho the finish line!

I've asked on #ansible but nothing fruitful so far.

I am using the docker-py pip module.

Dave.

Idan Melamed

unread,
Sep 25, 2020, 9:16:07 AM9/25/20
to Ansible Project
That error looks to me like it is looking for a file named "['/usr/local/hg/defaults.env', '/var/lib/data/hg/config.env']".
Maybe you can only use one env file?

Felix Fontein

unread,
Sep 25, 2020, 9:34:33 AM9/25/20
to ansible...@googlegroups.com
Hi,

> That error looks to me like it is looking for a file named
> "['/usr/local/hg/defaults.env', '/var/lib/data/hg/config.env']".
> Maybe you can only use one env file?

that's correct. The documentation states that the option accepts a
path, and not a list of paths. (If you pass a list, that list is
converted to a string.)

Cheers,
Felix


Dave Gilmore

unread,
Sep 25, 2020, 9:41:37 AM9/25/20
to ansible...@googlegroups.com
This is EXACTLY the issue!

Thank you!

I have some shared ENV variables between the 2 containers, but not all ENVs are applicable to the 2nd container, so that's why I tried to use 2 files.

Was trying to keep my env files DRY.

Think it's worth a PR ?

Just updating my code....

--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/0ovqOc6iFbc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/6eb978ac-104f-4423-8f2e-bc1100c317fen%40googlegroups.com.

Idan Melamed

unread,
Sep 25, 2020, 1:55:37 PM9/25/20
to Ansible Project
Hi Dave,
Maybe you can combine the two files and then pass the new combined file to env_file?

Felix Fontein

unread,
Sep 25, 2020, 2:47:05 PM9/25/20
to ansible...@googlegroups.com
Hi,

> Think it's worth a PR ?

if you think this is needed, feel free to create one.

Cheers,
Felix


Reply all
Reply to author
Forward
0 new messages