{"id":41891,"date":"2016-10-26T15:41:30","date_gmt":"2016-10-26T10:11:30","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=41891"},"modified":"2016-10-27T10:20:29","modified_gmt":"2016-10-27T04:50:29","slug":"customer-and-environment-segregation-using-puppet","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/customer-and-environment-segregation-using-puppet\/","title":{"rendered":"Customer and Environment Segregation using Puppet"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">This blog showcases the Customer and Environment segregation at the puppet-architecture-level for customized target <a title=\"Puppet DevOps\" href=\"http:\/\/www.tothenew.com\/devops-chef-puppet-docker\">deployments of the puppet modules<\/a>. For instance, if one wants to deploy a puppet module to a specific customer and its specific environment type (Dev, Prod, Test), it is achievable by making the configuration changes in the puppet. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">Puppet is a <a title=\"Puppet automation\" href=\"http:\/\/www.tothenew.com\/devops-chef-puppet-docker\">configuration management<\/a> tool, designed for automating the administration tasks for the whole environment. System resources and their state is stored by user in Puppet\u2019s Declarative language in a file called manifests. Puppet uses this system information via a utility known as Facter and compiles the manifests into a catalog containing resources and its dependencies.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Puppet deployment of modules is managed through two key configuration files :\u00a0<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Node configuration file (Nodes.pp) : This file is used to determine which module (class) should get deployed to which server.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Puppet manifests file (Site.pp) : It is the core configuration files of puppet. All the resources are stored in this file and its by default location is \/etc\/puppet\/manifests\/site.pp<\/span><\/li>\n<\/ul>\n<p><b>Pre-requisite<\/b><br \/>\n<span style=\"font-weight: 400;\">Puppet master-agent architecture setup, with any number of agents. Please follow this post for <\/span><a href=\"http:\/\/www.tothenew.com\/blog\/installing-lastest-puppet-master-and-agent-3-7-5-setup-on-ubuntu14-04-and-testing-it-with-a-small-manifest\/\"><span style=\"font-weight: 400;\">installing-latest-puppet-master-and-agent<\/span><\/a><span style=\"font-weight: 400;\">. <\/span><\/p>\n<p><b>Use Case<\/b><br \/>\n<span style=\"font-weight: 400;\">Deployment of puppet modules should be targeted to a \u00a0specific customer or environment or both.<\/span><\/p>\n<p style=\"text-align: left;\"><strong><b>Present Puppet Architecture<\/b><\/strong><\/p>\n<p style=\"text-align: left;\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-41901 size-large\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/10\/Picture1-1024x531.png\" alt=\"Picture1\" width=\"625\" height=\"324\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2016\/10\/Picture1-1024x531.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2016\/10\/Picture1-300x155.png 300w, \/blog\/wp-ttn-blog\/uploads\/2016\/10\/Picture1-624x323.png 624w, \/blog\/wp-ttn-blog\/uploads\/2016\/10\/Picture1.png 2005w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">Master-Agent Puppet Architecture is setup as shown in figure. Modules deployment is done through a central puppet master to all the systems (agents) in the infrastructure.<\/span><\/p>\n<p><b>Segregated Environment Architecture<\/b><\/p>\n<p style=\"text-align: left;\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-41905 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/10\/Picture2.png\" alt=\"Picture2\" width=\"516\" height=\"360\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2016\/10\/Picture2.png 516w, \/blog\/wp-ttn-blog\/uploads\/2016\/10\/Picture2-300x209.png 300w\" sizes=\"(max-width: 516px) 100vw, 516px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">As shown in the above figure, the modules deployment is carried out on the basis of environment types and further segregation is done\u00a0on the basis of customers.<\/span><\/p>\n<p><b>Steps to achieve customer &amp; environment segregation<\/b><\/p>\n<p><span style=\"font-weight: 400;\">By default, puppet configuration management is done using nodes.pp and site.pp file in puppet manifests folder. Customer and environment segregation is done using the puppet-agent certificate names, from which they are connected to the Puppet master server. The steps are as follows:<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Create a separate node file : &lt;customer_name&gt;.pp for every customer that consists of customer oriented puppet modules with the environment segregation. <\/span><\/li>\n<\/ol>\n<p>[js]#customer.pp<br \/>\n\tnode \/customer.*\\-.*\\.ttn\\.cloud inherits prod<br \/>\n\t{<br \/>\n\t\tinclude module-prd1<br \/>\n\t\tinclude module-prd2<br \/>\n\t}<br \/>\n\tnode \/customer.*\\-.*\\.ttn\\.cloud inherits dev<br \/>\n\t{<br \/>\n\t\tinclude customer-module-dev1<br \/>\n\t\tinclude customer-module-dev2<br \/>\n\t}[\/js]<\/p>\n<p>2. Amend the \u00a0default manifest file i.e.nodes.pp file of puppet and make the following changes.<\/p>\n<p>[js]node default<br \/>\n{<br \/>\n#Modules listed here are targeted to whole environment<br \/>\n\tinclude global-module1<br \/>\n\tinclude global-module1<br \/>\n}<br \/>\nnode prd inherits default<br \/>\n{<br \/>\n\tinclude prd-module1<br \/>\n\tinclude prd-module1<br \/>\n}<br \/>\nnode dev inherits default<br \/>\n{<br \/>\n\tinclude dev-module1<br \/>\n\tinclude dev-module1<br \/>\n}[\/js]<\/p>\n<p>3. Restart the puppet-master service and use the targeted deployment of modules<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-41906 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/10\/Picture3.png\" alt=\"Picture3\" width=\"475\" height=\"595\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2016\/10\/Picture3.png 475w, \/blog\/wp-ttn-blog\/uploads\/2016\/10\/Picture3-239x300.png 239w\" sizes=\"(max-width: 475px) 100vw, 475px\" \/><\/p>\n<p><strong><span style=\"font-weight: 400;\">By following the above steps one can achieve the segregation of the whole infrastructure environment at puppet architecture level on the basis of customers and their environment type. This approach is helpful for designing customer or environment specific modules in puppet.<\/span><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This blog showcases the Customer and Environment segregation at the puppet-architecture-level for customized target deployments of the puppet modules. For instance, if one wants to deploy a puppet module to a specific customer and its specific environment type (Dev, Prod, Test), it is achievable by making the configuration changes in the puppet. Puppet is a [&hellip;]<\/p>\n","protected":false},"author":952,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":12},"categories":[2348,1],"tags":[248,1780,4147,1779,4166,4167],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/41891"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/952"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=41891"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/41891\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=41891"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=41891"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=41891"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}