I faced the same thing, and I solved this by putting my config files or data in in a host directory and mounted this as a data volume (https://docs.docker.com/engine/tutorials/dockervolumes/). I run Ansible from my desktop, run a playbook and template out or copy the necessary files to the server, in a host dir that is accessible for the Docker container.You can rebuild the container or just stop and start it again, to reread the files or configs.
On Tuesday, November 8, 2016 at 2:26:16 AM UTC+1, Steven Truong wrote: > > Hi Greg, > > I already use Ansible-Container but I believe that it is more for building > the containers. The situations I have encountered are when I run the > container and depending on the situations I might need to replace some > variables here and there before starting the main process in the container. > Currently, I've used sed to replace the values for these variables but > that is not as powerful as using Ansible modules. Please correct me if I > am wrong in the ways I use Ansible-Container or dealing with these > situations when starting the containers. > > Thank you, > Steven. > > On Monday, November 7, 2016 at 5:20:02 PM UTC-8, Greg DeKoenigsberg wrote: >> >> You might want to take a look at Ansible Container: >> >> https://github.com/ansible/ansible-container >> >> On Mon, Nov 7, 2016 at 8:18 PM, Steven Truong <[email protected]> >> wrote: >> > Hi all, >> > >> > Am I being too picky here or just being naive in the ways I approach my >> > works with Docker? There are times when I build a Docker image and >> then >> > when I run the container with some environment variables then my >> start/entry >> > point scripts still have to replace some config files some where with >> the >> > environment variables' values. The most common practice for this type >> of >> > situation is to use sed or some sort of shell capabilities to take care >> > these. Honestly I hate going this way. >> > >> > I wish I could just use Ansible for this type of situation but adding >> > Ansible and dependencies to the container image increases the size and >> it is >> > not ideal to have full Ansible functionalities in the container. So is >> it >> > possible to create a core Ansible package aiming for the container >> situation >> > that includes some of the base modules or at least just the base >> modules? >> > Or do we have ways to assemble Ansible based on what the users might >> need >> > to reduce size in the container? >> > >> > Or just forget about it and add Ansible and its dependencies and call >> it a >> > day.... >> > >> > Please point me to some documents or information if what I just asked >> have >> > been written about. >> > >> > Thank you so much. >> > >> > -- >> > You received this message because you are subscribed to the Google >> Groups >> > "Ansible Project" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> an >> > email to [email protected]. >> > To post to this group, send email to [email protected]. >> > To view this discussion on the web visit >> > >> https://groups.google.com/d/msgid/ansible-project/df2286fc-d02c-4f21-b82c-a16170cca5d4%40googlegroups.com. >> >> >> > For more options, visit https://groups.google.com/d/optout. >> >> >> >> -- >> Greg DeKoenigsberg >> Ansible Community Guy >> > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/d523f8ef-69d7-43dc-8a2f-f58f59634049%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
