<div dir="ltr"><div class="gmail_default" style="font-family:monospace,monospace;font-size:small">Recently, Ansible release 2.1 version with lots of new feature. One of the interesting feature</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small">is the management for docker. </div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small">Redhat also announced the Ansible Container project[0][1], which can build docker images by using</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small">Ansible Playbooks. No more write the ugly Dockerfile script. I think this will be more graceful.</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small">Here the explanation that why not use Dockerfile from ansible-container readme file.</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small"><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_default" style="font-family:monospace,monospace;font-size:small"><div class="gmail_default">A Dockerfile is not much more than a script with hand-crafted shell commands. We're well past the</div></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small"><div class="gmail_default">point where we should be managing build processes with manually maintained series of shell scripts.</div></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small"><div class="gmail_default">That's why we wrote Ansible in the first place, and this is just as applicable to containers.</div></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small"><div class="gmail_default"><br></div></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small"><div class="gmail_default">Ansible Container permits orchestration even during the build process, whereas docker build does </div></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small"><div class="gmail_default">not. For example, in a Django project, your VCS may contain a bunch of sources for static assets </div></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small"><div class="gmail_default">that need to be compiled and then collected. With Ansible Container, you can compile the static </div></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small"><div class="gmail_default">assets in your Django container and then collect them into your static file serving container.</div></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small"><div class="gmail_default"><br></div></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small"><div class="gmail_default">Many people use Docker for development environments only but then use Ansible playbooks to push </div></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small"><div class="gmail_default">out to staging or production. This allows you to use the same playbooks and roles in your Docker</div></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small"><div class="gmail_default">dev environment as in your production environments.</div></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small"><div class="gmail_default"><br></div></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small"><div class="gmail_default">Ansible Container does all of this without installing SSH, leaving Ansible artifacts on your </div></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small"><div class="gmail_default">built images, or having excess layers to the union filesystem.</div><div class="gmail_default"><br></div></div></blockquote><font face="monospace, monospace"><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;display:inline">​I also pushed a PS to implement ​almost the same thing for Kolla[3].  There many benefit for this.</div></font><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;display:inline">​1. more easy to understand. The original base/Dockerfile is too long, mixed with different base image logical</div></font></div><div><font face="monospace, monospace"><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;display:inline">   and different install type. Whereas in the new implement, it is more clearly. it is split into multi</div></font></div><div><font face="monospace, monospace"><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;display:inline">   YAML file.</div></font></div><div><span style="font-family:monospace,monospace"><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;display:inline">​2. easy to extend. We can reuse the role concept for the Ansible. For example, when you want to extend</div></span></div><div><span style="font-family:monospace,monospace"><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;display:inline">   the neutron-server container. You can write your own roles, like neutron-server-lbaas role, and just</div></span></div><div><span style="font-family:monospace,monospace"><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;display:inline">   add this to the neutron-server playbooks. In this way, we can implement the customize issue. ( this will</div></span></div><div><span style="font-family:monospace,monospace"><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;display:inline">   implement later.)</div></span></div><div><span style="font-family:monospace,monospace"><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;display:inline">3. It is also possible to change the exist data. For example, i want to change the repo url to a internal</div></span></div><div><span style="font-family:monospace,monospace"><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;display:inline">   ones. ​</div>​<div class="gmail_default" style="font-family:monospace,monospace;font-size:small;display:inline">​The user can provide a ansible variables file, which hold the new repo url and overwrite the </div></span></div><div><span style="font-family:monospace,monospace"><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;display:inline">   exist one.</div></span></div><div><span style="font-family:monospace,monospace"><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;display:inline"><br></div></span></div><div><span style="font-family:monospace,monospace"><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;display:inline">This PS is in POC stage. Post this mail to gather any advise and better ideas.</div></span></div><div><div><br></div><div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small">​[0] <a href="https://github.com/ansible/ansible-container">https://github.com/ansible/ansible-container</a></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small">[1] <a href="https://www.helpnetsecurity.com/2016/06/20/ansible-native-container-workflow-project/">https://www.helpnetsecurity.com/2016/06/20/ansible-native-container-workflow-project/</a></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small">[2] <a href="https://review.openstack.org/334208">https://review.openstack.org/334208</a></div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><span style="font-size:13px;border-collapse:collapse"><font face="monospace, monospace">Regards,</font></span></div><div><span style="font-size:13px;border-collapse:collapse"><font face="monospace, monospace">Jeffrey Zhang</font></span></div><div><span style="font-family:monospace,monospace;font-size:12.8px">Blog: </span><a href="http://xcodest.me/" style="font-family:monospace,monospace;font-size:12.8px" target="_blank">http://xcodest.me</a><font face="monospace, monospace"><br></font></div></div></div></div></div></div></div></div></div>
</div></div>