{"id":5993,"date":"2018-03-18T09:41:41","date_gmt":"2018-03-18T09:41:41","guid":{"rendered":"http:\/\/putridparrot.com\/blog\/?p=5993"},"modified":"2018-03-18T17:07:06","modified_gmt":"2018-03-18T17:07:06","slug":"creating-an-ansible-dockerfile","status":"publish","type":"post","link":"https:\/\/putridparrot.com\/blog\/creating-an-ansible-dockerfile\/","title":{"rendered":"Creating an ansible dockerfile"},"content":{"rendered":"<p>I was trying to run the ansible docker image on Docker hub, but it kept failing, so I went through the steps listed in http:\/\/docs.ansible.com\/ansible\/latest\/intro_installation.html inside of an Ubunto docker image<\/p>\n<ul>\n<li>apt-get update<\/li>\n<li>apt-get install software-properties-common<\/li>\n<li>apt-add-repository ppa:ansible\/ansible<\/li>\n<li>apt-get update<\/li>\n<li>apt-get install ansible<\/li>\n<\/ul>\n<p>Then running <em>ansible &#8211;version<\/em> demonstrated everything was working.<\/p>\n<p>I decided to use the same commands to create a Dockerfile and hence create my own image of ansible. <\/p>\n<ul>\n<li>Create an <em>ansible<\/em> folder<\/li>\n<li>Create the file Dockerfile in the <em>ansible<\/em> folder<\/li>\n<\/ul>\n<p><em>Please note, this is not a complete implementation of a Docker image of ansible so much as a starting point for experimenting with ansible.<\/em><\/p>\n<p>Now we&#8217;ll create a fairly simple image based on ubuntu and install all the libraries etc. as above. So the Dockerfile should have the following contents<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\nFROM ubuntu:latest\r\n\r\nRUN apt-get -y update\r\nRUN apt-get -y install software-properties-common\r\nRUN apt-add-repository ppa:ansible\/ansible\r\nRUN apt-get -y update\r\nRUN apt-get -y install ansible\r\n<\/pre>\n<p>From the <em>ansible<\/em> folder run <em>sudo docker build -t ansible .<\/em>, if all goes well you&#8217;ll have an image name <em>ansible<\/em> created. Just run <em>sudo docker images<\/em> to see it listed.<\/p>\n<p>Now run <em>sudo docker run -it ansible<\/em> to run the image in interactive mode and then within the container run <em>ansible &#8211;version<\/em> to see if everything worked.<\/p>\n<p>Now we&#8217;re up and running there&#8217;s obviously more to do to really use ansible and hopefully I&#8217;ll cover some of those topics in subsequent posts on ansible.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was trying to run the ansible docker image on Docker hub, but it kept failing, so I went through the steps listed in http:\/\/docs.ansible.com\/ansible\/latest\/intro_installation.html inside of an Ubunto docker image apt-get update apt-get install software-properties-common apt-add-repository ppa:ansible\/ansible apt-get update apt-get install ansible Then running ansible &#8211;version demonstrated everything was working. I decided to use [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[208,102],"tags":[],"class_list":["post-5993","post","type-post","status-publish","format-standard","hentry","category-ansible","category-docker"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/5993","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/comments?post=5993"}],"version-history":[{"count":6,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/5993\/revisions"}],"predecessor-version":[{"id":6015,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/5993\/revisions\/6015"}],"wp:attachment":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/media?parent=5993"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/categories?post=5993"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/tags?post=5993"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}