{"id":15657,"date":"2017-01-06T12:15:57","date_gmt":"2017-01-06T10:15:57","guid":{"rendered":"http:\/\/www.webcodegeeks.com\/?p=15657"},"modified":"2017-01-03T17:58:35","modified_gmt":"2017-01-03T15:58:35","slug":"packer-ansible-docker-part-3-multiple-roles","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/","title":{"rendered":"Packer, Ansible and Docker Part 3: Multiple Roles"},"content":{"rendered":"<p><a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/blog.james-carr.org\/packer-ansible-and-docker-part-2-using-roles-363cbf5dcc7d#.6aw1irdgx\" target=\"_blank\" data-href=\"https:\/\/blog.james-carr.org\/packer-ansible-and-docker-part-2-using-roles-363cbf5dcc7d#.6aw1irdgx\">Previously<\/a> we modified our setup to use a role from ansible galaxy to install and configure redis. One key thing lacking here is that one rarely needs to just use a role from ansible galaxy by itself so next up we\u2019ll modify our playbook to define the server as a role that uses the redis role.<\/p>\n<h2>Creating Our\u00a0Role<\/h2>\n<p>First up we\u2019ll create a role directory containing our role and a few subdirectories we\u2019ll use later.<\/p>\n<pre class=\"brush:bash\">mkdir -p roles\/redis\/{meta,tasks,defaults}<\/pre>\n<p>Next up, we\u2019ll move the <code>geerlingguy.redis<\/code> role into a dependency for this new role in <code>roles\/meta\/main.yml.<\/code><\/p>\n<pre class=\"brush:bash\">---\r\ndependencies:\r\n  - role: geerlingguy.redis<\/pre>\n<p>We also change the <code>playbook.yml<\/code> to reference this new role and remove the <code>Hello World<\/code> task we added in part one.<\/p>\n<pre class=\"brush:bash\">---\r\n- name: A demo to run ansible in a docker container\r\n  hosts: all\r\n  roles:\r\n    - redis<\/pre>\n<p>That\u2019s all for now. We\u2019ll run <code>packer build template.json<\/code> one more time before we move on to make sure everything is working fine. If it\u2019s not, check out the current directory structure at <a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/github.com\/jamescarr\/pad-tutorial\/tree\/part-3-a\" target=\"_blank\" rel=\"nofollow\" data-href=\"https:\/\/github.com\/jamescarr\/pad-tutorial\/tree\/part-3-a\">https:\/\/github.com\/jamescarr\/pad-tutorial\/tree\/part-3-a<\/a>.<\/p>\n<h2>Making It\u00a0Dynamic<\/h2>\n<p>This has been nice and all but now we\u2019ve reached a point where we need to create more server roles. We could just copy and paste the existing <code>template.json<\/code> and change a few bits but that will become a headache, won\u2019t it? What we should do is use a variable in packer to dynamically change which role we use.<br \/>\nThe good news is that we already have a packer variable named <code>ansible_role<\/code> that we can repurpose for this need. We previously set it to <code>default<\/code> but we\u2019re going to change it to specify the role to run. With this in mind, we modify our <code>playbook.yml<\/code> to use the <code>ansible_host<\/code> variable as the role that is included.<\/p>\n<pre class=\"brush:bash\">---\r\n- name: A demo to run ansible in a docker container\r\n  hosts: all\r\n  roles:\r\n    - \"{{ ansible_host }}\"<\/pre>\n<p>While we\u2019re at it, let\u2019s also change the docker image name and add a variable for the version number too. Add a <code>version<\/code> variable to the variables section of <code>template.json<\/code> and default it to <code>latest<\/code>.<\/p>\n<pre class=\"brush:bash\">\"variables\": {\r\n    \"ansible_host\": \"\",\r\n    \"version\": \"latest\",\r\n    \"ansible_connection\": \"docker\",\r\n    \"ansible_roles_path\": \"galaxy\"\r\n  },<\/pre>\n<p>We also update the <code>post-processor<\/code> section to use the <code>ansible_host<\/code> and <code>version.<\/code><\/p>\n<pre class=\"brush:bash\">\"post-processors\": [\r\n    [\r\n      {\r\n        \"type\": \"docker-tag\",\r\n        \"repository\": \"jamescarr\/{{ user `ansible_host` }}\",\r\n        \"tag\": \"{{ user `version` }}\"\r\n      }\r\n    ]<\/pre>\n<p>Now we can run packer again but this time we specify the <code>ansible_host<\/code>. We\u2019ll just build a docker image with the <code>latest<\/code> tag but if we wanted to override it we could specify the <code>version<\/code> too.<\/p>\n<pre class=\"brush:bash\">&gt; $ packer build -var 'ansible_host=redis' template.json<\/pre>\n<p>Now we can create separate roles for any new docker image we want to build with this template and can include any cross cutting, \u201call images get this\u201d tasks to the <code>playbook.yml<\/code> but it is good to keep them all encapsulated in a single role.<\/p>\n<h2>Add Another\u00a0Role<\/h2>\n<p>With all this snazzy dynamic pieces in place, let\u2019s add one more role to build a docker image for. For fun, we\u2019ll select <a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/www.rabbitmq.com\/\" target=\"_blank\" data-href=\"https:\/\/www.rabbitmq.com\/\">RabbitMQ<\/a>. A quick google makes it appear that <a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/github.com\/Mayeu\/ansible-playbook-rabbitmq\" target=\"_blank\" data-href=\"https:\/\/github.com\/Mayeu\/ansible-playbook-rabbitmq\">Mayeu.RabbitMQ<\/a> is the role to use so let\u2019s run with that and add it to our <code>requirements.yml<\/code>.<\/p>\n<pre class=\"brush:bash\">---\r\n- src: geerlingguy.redis\r\n  version: 1.1.5\r\n- src: https:\/\/github.com\/jamescarr\/ansible-playbook-rabbitmq\/archive\/e303777.tar.gz\r\n  name: Mayeu.RabbitMQ<\/pre>\n<p>In this case, I actually discovered a defect in the latest release of the role that I was able to easily fix so I instead reference the git commit hash of my fork. Thankfully <code>anisble-galaxy<\/code> is flexible like that.<br \/>\nSince we\u2019ll probably find ourselves changing this often, let\u2019s add a <code><a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/www.packer.io\/docs\/provisioners\/shell-local.html\" target=\"_blank\" data-href=\"https:\/\/www.packer.io\/docs\/provisioners\/shell-local.html\">shell-local<\/a><\/code> provisioner to packer under the <code>provisioners<\/code> section to run <code>ansible-galaxy<\/code> all the time as the first step.<\/p>\n<pre class=\"brush:bash\">{\r\n   \"type\": \"shell-local\",\r\n   \"command\": \"ansible-galaxy install -p galaxy -r requirements.yml\"\r\n}<\/pre>\n<p>Next up we\u2019ll create the role structure for our RabbitMQ role.<\/p>\n<pre class=\"brush:bash\">&gt; $ mkdir -p roles\/rabbitmq\/{meta,tasks,defaults}<\/pre>\n<p>This time around we won\u2019t just use the galaxy role, we\u2019ll also configure it to our likings. For our needs we want to configure RabbitMQ with a host of plugins and define a default vhost with one user that can write to any exchange (but not configure or read from queues) and one user that is the administrator. With this in mind we add the following to <code>roles\/rabbitmq\/meta\/main.yml<\/code>.<\/p>\n<pre class=\"brush:bash\">---\r\ndependencies:\r\n  - role: Mayeu.RabbitMQ \r\n    rabbitmq_ssl: false\r\n    rabbitmq_plugins:\r\n      - rabbitmq_management\r\n      - rabbitmq_management_agent\r\n      - rabbitmq_shovel\r\n      - rabbitmq_federation\r\n      - rabbitmq_shovel_management\r\n    rabbitmq_vhost_definitions:\r\n      - name: \"{{ main_vhost }}\"\r\n    rabbitmq_users_definitions:\r\n      - vhost:    \"{{ main_vhost }}\"\r\n        user:     user1\r\n        password: password\r\n        configure_priv: \"^$\"\r\n        read_priv: \"^$\" # Disallow reading.\r\n        write_priv: \".*\" # allow writing.\r\n      - vhost:    \"{{ main_vhost }}\"\r\n        user:     admin\r\n        password: password\r\n        force:    no\r\n        tags:\r\n        - administrator<\/pre>\n<p>We also use the same vhost name multiple times so rather than duplicate it all over we define a variable for it in <code>roles\/rabbitmq\/defaults\/main.yml.<\/code><\/p>\n<pre class=\"brush:bash\">---\r\nmain_vhost: \/faxanadu<\/pre>\n<p>With all of these bits in place, let\u2019s run packer to build out our new rabbitmq docker image!<\/p>\n<pre class=\"brush:bash\">&gt; $ packer build -var 'ansible_host=rabbitmq' template.json<\/pre>\n<p>When this is done, we should have a docker image that can run rabbitmq with our expected configuration details!<\/p>\n<pre class=\"brush:bash\">jamescarr@Jamess-MacBook-Pro-2 ~\/Projects\/docker-ansible                                                                                                                        [11:47:53]\r\n&gt; $ docker run -it -p 15672:15672 -p 5672:5672 jamescarr\/rabbitmq:latest rabbitmq-server\r\n\u2b216.2.2 [\u00b1master \u25cf]\r\nRabbitMQ 3.6.6. Copyright (C) 2007-2016 Pivotal Software, Inc.\r\n  ##  ##      Licensed under the MPL.  See http:\/\/www.rabbitmq.com\/\r\n  ##  ##\r\n  ##########  Logs: \/var\/log\/rabbitmq\/rabbit@730b08abceab.log\r\n  ######  ##        \/var\/log\/rabbitmq\/rabbit@730b08abceab-sasl.log\r\n  ##########\r\n              Starting broker...\r\n completed with 9 plugins.<\/pre>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/01\/1-O2P7vs56VJh7LwnN1O8YhQ.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-15658\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/01\/1-O2P7vs56VJh7LwnN1O8YhQ.png\" alt=\"\" width=\"800\" height=\"473\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/01\/1-O2P7vs56VJh7LwnN1O8YhQ.png 800w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/01\/1-O2P7vs56VJh7LwnN1O8YhQ-300x177.png 300w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/01\/1-O2P7vs56VJh7LwnN1O8YhQ-768x454.png 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/a><br \/>\nLooks good! You can see the latest state of the project at <a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/github.com\/jamescarr\/pad-tutorial\/tree\/efc9e035eaa0a27ba2d6066ed04a37f5efa4bf42\" target=\"_blank\" rel=\"nofollow\" data-href=\"https:\/\/github.com\/jamescarr\/pad-tutorial\/tree\/efc9e035eaa0a27ba2d6066ed04a37f5efa4bf42\">https:\/\/github.com\/jamescarr\/pad-tutorial\/tree\/efc9e035eaa0a27ba2d6066ed04a37f5efa4bf42<\/a>.<\/p>\n<h2>Next<\/h2>\n<p>Unfortunately when we try to login to the rabbitmq management console we\u2019ll notice that none of our configured users work. That\u2019s because they were created under the hood by <code>rabbitmqctl<\/code> and not persisted. In the next post we\u2019ll modify our little build system we have going here to run a subset of tasks on container start!<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td><span class=\"reference\">Reference: <\/span><\/td>\n<td><a href=\"https:\/\/blog.james-carr.org\/packer-ansible-and-docker-part-3-multiple-roles-121828f79b95#.gyz79vd0i\">Packer, Ansible and Docker Part 3: Multiple Roles<\/a> from our <a href=\"http:\/\/www.webcodegeeks.com\/join-us\/wcg\/\">WCG partner<\/a>\u00a0James Carr at the <a href=\"http:\/\/blog.james-carr.org\/\">James Carr<\/a> blog.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Previously we modified our setup to use a role from ansible galaxy to install and configure redis. One key thing lacking here is that one rarely needs to just use a role from ansible galaxy by itself so next up we\u2019ll modify our playbook to define the server as a role that uses the redis &hellip;<\/p>\n","protected":false},"author":209,"featured_media":10356,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[422,217,421],"class_list":["post-15657","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","tag-ansible","tag-docker","tag-packer"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Packer, Ansible and Docker Part 3: Multiple Roles - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"Previously we modified our setup to use a role from ansible galaxy to install and configure redis. One key thing lacking here is that one rarely needs to\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Packer, Ansible and Docker Part 3: Multiple Roles - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"Previously we modified our setup to use a role from ansible galaxy to install and configure redis. One key thing lacking here is that one rarely needs to\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2017-01-06T10:15:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"James Carr\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"James Carr\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/\"},\"author\":{\"name\":\"James Carr\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/3fee9c530d4d22d6ac8ba305fb88e575\"},\"headline\":\"Packer, Ansible and Docker Part 3: Multiple Roles\",\"datePublished\":\"2017-01-06T10:15:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/\"},\"wordCount\":767,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg\",\"keywords\":[\"Ansible\",\"Docker\",\"Packer\"],\"articleSection\":[\"DevOps\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/\",\"name\":\"Packer, Ansible and Docker Part 3: Multiple Roles - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg\",\"datePublished\":\"2017-01-06T10:15:57+00:00\",\"description\":\"Previously we modified our setup to use a role from ansible galaxy to install and configure redis. One key thing lacking here is that one rarely needs to\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DevOps\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/devops\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Packer, Ansible and Docker Part 3: Multiple Roles\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/3fee9c530d4d22d6ac8ba305fb88e575\",\"name\":\"James Carr\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/751c55f22a64fa5ac630c3bddaf1a4f4e11c442aaa9fc308004564cdca64b900?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/751c55f22a64fa5ac630c3bddaf1a4f4e11c442aaa9fc308004564cdca64b900?s=96&d=mm&r=g\",\"caption\":\"James Carr\"},\"sameAs\":[\"http:\/\/blog.james-carr.org\/\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/james-carr\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Packer, Ansible and Docker Part 3: Multiple Roles - Web Code Geeks - 2026","description":"Previously we modified our setup to use a role from ansible galaxy to install and configure redis. One key thing lacking here is that one rarely needs to","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/","og_locale":"en_US","og_type":"article","og_title":"Packer, Ansible and Docker Part 3: Multiple Roles - Web Code Geeks - 2026","og_description":"Previously we modified our setup to use a role from ansible galaxy to install and configure redis. One key thing lacking here is that one rarely needs to","og_url":"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_published_time":"2017-01-06T10:15:57+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg","type":"image\/jpeg"}],"author":"James Carr","twitter_card":"summary_large_image","twitter_creator":"@webcodegeeks","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"James Carr","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/"},"author":{"name":"James Carr","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/3fee9c530d4d22d6ac8ba305fb88e575"},"headline":"Packer, Ansible and Docker Part 3: Multiple Roles","datePublished":"2017-01-06T10:15:57+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/"},"wordCount":767,"commentCount":0,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg","keywords":["Ansible","Docker","Packer"],"articleSection":["DevOps"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/","url":"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/","name":"Packer, Ansible and Docker Part 3: Multiple Roles - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg","datePublished":"2017-01-06T10:15:57+00:00","description":"Previously we modified our setup to use a role from ansible galaxy to install and configure redis. One key thing lacking here is that one rarely needs to","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/devops\/packer-ansible-docker-part-3-multiple-roles\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"DevOps","item":"https:\/\/www.webcodegeeks.com\/category\/devops\/"},{"@type":"ListItem","position":3,"name":"Packer, Ansible and Docker Part 3: Multiple Roles"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/3fee9c530d4d22d6ac8ba305fb88e575","name":"James Carr","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/751c55f22a64fa5ac630c3bddaf1a4f4e11c442aaa9fc308004564cdca64b900?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/751c55f22a64fa5ac630c3bddaf1a4f4e11c442aaa9fc308004564cdca64b900?s=96&d=mm&r=g","caption":"James Carr"},"sameAs":["http:\/\/blog.james-carr.org\/"],"url":"https:\/\/www.webcodegeeks.com\/author\/james-carr\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/15657","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/209"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=15657"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/15657\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/10356"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=15657"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=15657"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=15657"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}