{"id":29,"date":"2015-11-09T06:36:07","date_gmt":"2015-11-09T06:36:07","guid":{"rendered":"http:\/\/cloudkul.com\/blog\/?p=29"},"modified":"2017-04-13T08:20:50","modified_gmt":"2017-04-13T08:20:50","slug":"lamp-automation-with-puppet","status":"publish","type":"post","link":"https:\/\/cloudkul.com\/blog\/lamp-automation-with-puppet\/","title":{"rendered":"LAMP automation with puppet"},"content":{"rendered":"<p>Today\u2019s system engineers and still stuck with managing configurations using bash scripts??<\/p>\n<p>Well, it does not sound good. Go and get everything puppetized !!<\/p>\n<p>So first of all, why a configuration automation system and how does puppet play an important role in this context?<\/p>\n<p>One of our web developers came to me and asked, \u201cHow can I quickly model a PHP application without having to bother you for a development environment?\u201d<\/p>\n<p>I thought it for a while and came to the conclusion that from developer\u2019s point of view it is not feasible to ask for a new environment every time to do the work and being a system engineer i could think that the whole process of managing configurations manually is quite cumbersome task. Luckily, it does not have to be !! Here comes the existence of puppet with which i could get everything solved.<\/p>\n<p>Puppet is a configuration management tool that is extremely powerful in deploying, configuring, managing, maintaining, a server machine.<\/p>\n<p>So here you are : LAMP automation with puppet !!<\/p>\n<p>Using this puppet module, any system engineer, or anyone for that matter, can quickly launch a LAMP environment in minutes to get them going on with applications at developer\u2019s end.<\/p>\n<p><strong>BEFORE YOU BEGIN :<\/strong><\/p>\n<p>Before you go ahead with this module, make sure that you have puppet master and agent installed on your host machines and agent contains a certificate signed by the puppet master. All you need to do is to get this module installed either from github or puppetforge.<\/p>\n<p><strong>Puppet version &gt;=3.4.0<\/strong> &amp; <strong>Ubuntu 14.04\/12.04<\/strong> is recommended for the following configurations.<\/p>\n<p><strong>PUPPET MASTER :<\/strong><\/p>\n<p>MANIFEST FILE : (The location where your puppet code is written.They are standard text files saved with .pp extensions )<\/p>\n<p>Path =&gt; [\/etc\/puppet\/modules\/lamp\/manifests\/init.pp]<\/p>\n<pre class=\"lang:sh decode:true \">class lamp {\r\n\r\n#execute \u2018apt-get update\u2019\r\n\r\nexec { \u2018apt-update\u2019 :\r\n\r\ncommand =&gt; \u2018\/usr\/bin\/apt-get update\u2019,\r\n\r\nbefore =&gt; Package[\u2018apache2\u2019],\r\n\r\n}\r\n\r\n#install apache2 package\r\n\r\npackage { \u2018apache2\u2019 :\r\n\r\nensure =&gt; latest,\r\n\r\nrequire =&gt; exec[\u2018apt-update\u2019],\r\n\r\n}\r\n\r\n#ensure apache2 service is running\r\n\r\nservice { \u2018apache2\u2019 :\r\n\r\nensure =&gt; running,\r\n\r\nrequire =&gt; Package[\u2018apache2\u2019],\r\n\r\n}\r\n\r\n#install mysql-server package\r\n\r\npackage { \u2018mysql-server\u2019 :\r\n\r\nensure =&gt; latest,\r\n\r\n}\r\n\r\n#ensure mysql service is running\r\n\r\nservice { \u2018mysql\u2019 :\r\n\r\nensure =&gt; running,\r\n\r\nrequire =&gt; Package[\u2018mysql-server\u2019],\r\n\r\n}\r\n\r\n# install php5 package\r\n\r\npackage { \u2018php5\u2019 :\r\n\r\nensure =&gt; latest,\r\n\r\n}\r\n\r\n# ensure info.php file exists\r\n\r\nfile { \u2018\/var\/www\/html\/info.php\u2019:\r\n\r\nensure =&gt; file,\r\n\r\ncontent =&gt; \u2018&lt;?php phpinfo(); ?&gt;\u2019,\r\n\r\nrequire =&gt; Package[\u2018apache2\u2019],\r\n\r\n}\r\n}<\/pre>\n<p><span style=\"line-height: 1.5\">Now, you just need to include this file into your main manifests.<\/span><\/p>\n<p>Path =&gt; \/etc\/puppet\/manifests\/site.pp<\/p>\n<pre class=\"brush:shell\">node default {\r\n\r\ninclude lamp\r\n\r\n}<\/pre>\n<p>The above code signifies that lamp module containing the puppet code should be included for all the requesting puppet-clients. If you want to include your lamp module only for some specific nodes, you need to replace \u2018default\u2019 with the hostname of the requesting nodes.<\/p>\n<p>To install the entire module from puppetforge :-<\/p>\n<p><a href=\"https:\/\/forge.puppetlabs.com\/webkul\/lamp\">https:\/\/forge.puppetlabs.com\/webkul\/lamp<\/a><\/p>\n<p>For reference :-<\/p>\n<p><a href=\"https:\/\/github.com\/nainajohari\/puppet-lamp\">https:\/\/github.com\/nainajohari\/puppet-lamp<\/a><\/p>\n<p>Now, you have to restart the service using the following command :-<\/p>\n<pre class=\"brush:shell\">service puppetmaster restart<\/pre>\n<p><strong>PUPPET AGENT :<\/strong><\/p>\n<p>First of all, you must ensure that puppet client is aware of its respective puppet master.To introduce a client machine to the puppet server,make an entry in client\u2019s main configuration file as mentioned below :-<\/p>\n<p>Path -&gt; \/etc\/puppet\/puppet.conf<\/p>\n<pre class=\"brush:shell\">server = puppetm<\/pre>\n<p>where, puppetm is the hostname of the respective puppet master.<\/p>\n<p>Now, puppet agent can send a request to puppet master using the following command :-<\/p>\n<pre class=\"brush:shell\">puppet agent --test<\/pre>\n<div class=\"panel panel-info\">\n<div class=\"panel-heading\">Note<\/div>\n<div class=\"panel-body\">\n<p>Here, we have assumed that puppet agent contains a certificate signed by the puppet master.<\/p>\n<\/div>\n<\/div>\n<p>By simply running this single command, the entire puppet code of master\u2019s main manifests will be executed on puppet client.<\/p>\n<p>Repeat the same for multiple puppet clients.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><strong><a href=\"http:\/\/cloudkul.com\/contact\/\" target=\"_blank\">FOR ANY TYPE OF QUERY OR HELP, KINDLY CONTACT US<\/a><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today\u2019s system engineers and still stuck with managing configurations using bash scripts?? Well, it does <a class=\"text-primary\" title=\"read more\" href=\"https:\/\/cloudkul.com\/blog\/lamp-automation-with-puppet\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":5,"featured_media":334,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[1],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>LAMP automation with puppet - Cloudkul<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cloudkul.com\/blog\/lamp-automation-with-puppet\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"LAMP automation with puppet - Cloudkul\" \/>\n<meta property=\"og:description\" content=\"Today\u2019s system engineers and still stuck with managing configurations using bash scripts?? Well, it does [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudkul.com\/blog\/lamp-automation-with-puppet\/\" \/>\n<meta property=\"og:site_name\" content=\"Cloudkul\" \/>\n<meta property=\"article:published_time\" content=\"2015-11-09T06:36:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-04-13T08:20:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2015\/11\/Check-Memcached.png\" \/>\n\t<meta property=\"og:image:width\" content=\"848\" \/>\n\t<meta property=\"og:image:height\" content=\"422\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Naina Johari\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cloudkul.com\/blog\/lamp-automation-with-puppet\/\",\"url\":\"https:\/\/cloudkul.com\/blog\/lamp-automation-with-puppet\/\",\"name\":\"LAMP automation with puppet - Cloudkul\",\"isPartOf\":{\"@id\":\"https:\/\/cloudkul.com\/blog\/#website\"},\"datePublished\":\"2015-11-09T06:36:07+00:00\",\"dateModified\":\"2017-04-13T08:20:50+00:00\",\"author\":{\"@id\":\"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/38f7cddff574c7fe989d6ca2df61fc57\"},\"breadcrumb\":{\"@id\":\"https:\/\/cloudkul.com\/blog\/lamp-automation-with-puppet\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cloudkul.com\/blog\/lamp-automation-with-puppet\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cloudkul.com\/blog\/lamp-automation-with-puppet\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cloudkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"LAMP automation with puppet\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/cloudkul.com\/blog\/#website\",\"url\":\"https:\/\/cloudkul.com\/blog\/\",\"name\":\"Cloudkul\",\"description\":\"Host your eCommerce Store on AWS with Optimized Performance\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/cloudkul.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/38f7cddff574c7fe989d6ca2df61fc57\",\"name\":\"Naina Johari\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c7a0be3afff58963975900f809e57046?s=96&d=https%3A%2F%2Fs.gravatar.com%2Favatar%2F6148c37469011bc2f8e491ca8f5de495%3Fs%3D80&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c7a0be3afff58963975900f809e57046?s=96&d=https%3A%2F%2Fs.gravatar.com%2Favatar%2F6148c37469011bc2f8e491ca8f5de495%3Fs%3D80&r=g\",\"caption\":\"Naina Johari\"},\"url\":\"https:\/\/cloudkul.com\/blog\/author\/naina-johari379\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"LAMP automation with puppet - Cloudkul","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:\/\/cloudkul.com\/blog\/lamp-automation-with-puppet\/","og_locale":"en_US","og_type":"article","og_title":"LAMP automation with puppet - Cloudkul","og_description":"Today\u2019s system engineers and still stuck with managing configurations using bash scripts?? Well, it does [...]","og_url":"https:\/\/cloudkul.com\/blog\/lamp-automation-with-puppet\/","og_site_name":"Cloudkul","article_published_time":"2015-11-09T06:36:07+00:00","article_modified_time":"2017-04-13T08:20:50+00:00","og_image":[{"width":848,"height":422,"url":"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2015\/11\/Check-Memcached.png","type":"image\/png"}],"author":"Naina Johari","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/cloudkul.com\/blog\/lamp-automation-with-puppet\/","url":"https:\/\/cloudkul.com\/blog\/lamp-automation-with-puppet\/","name":"LAMP automation with puppet - Cloudkul","isPartOf":{"@id":"https:\/\/cloudkul.com\/blog\/#website"},"datePublished":"2015-11-09T06:36:07+00:00","dateModified":"2017-04-13T08:20:50+00:00","author":{"@id":"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/38f7cddff574c7fe989d6ca2df61fc57"},"breadcrumb":{"@id":"https:\/\/cloudkul.com\/blog\/lamp-automation-with-puppet\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cloudkul.com\/blog\/lamp-automation-with-puppet\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/cloudkul.com\/blog\/lamp-automation-with-puppet\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cloudkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"LAMP automation with puppet"}]},{"@type":"WebSite","@id":"https:\/\/cloudkul.com\/blog\/#website","url":"https:\/\/cloudkul.com\/blog\/","name":"Cloudkul","description":"Host your eCommerce Store on AWS with Optimized Performance","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cloudkul.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/38f7cddff574c7fe989d6ca2df61fc57","name":"Naina Johari","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c7a0be3afff58963975900f809e57046?s=96&d=https%3A%2F%2Fs.gravatar.com%2Favatar%2F6148c37469011bc2f8e491ca8f5de495%3Fs%3D80&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c7a0be3afff58963975900f809e57046?s=96&d=https%3A%2F%2Fs.gravatar.com%2Favatar%2F6148c37469011bc2f8e491ca8f5de495%3Fs%3D80&r=g","caption":"Naina Johari"},"url":"https:\/\/cloudkul.com\/blog\/author\/naina-johari379\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/posts\/29"}],"collection":[{"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/comments?post=29"}],"version-history":[{"count":6,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/posts\/29\/revisions"}],"predecessor-version":[{"id":551,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/posts\/29\/revisions\/551"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/media\/334"}],"wp:attachment":[{"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/media?parent=29"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/categories?post=29"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/tags?post=29"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}