From 744810e5c945b2cf27a0781021bec40fb1c60816 Mon Sep 17 00:00:00 2001 From: sujeet Kumar <99119279+sk0990670@users.noreply.github.com> Date: Thu, 22 Aug 2024 12:54:31 +0530 Subject: [PATCH 01/10] Add files via upload setting up a Puppet master-agent configuration to automate the installation of Nginx and the creation of a status file on the agent node. Below is a step-by-step guide for this --- README.md | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/README.md b/README.md index 4458f2c..2bd5434 100644 --- a/README.md +++ b/README.md @@ -164,3 +164,77 @@ Congratulations! Your Puppet Master and Puppet Agent are now set up and running. Happy learning! + +### script and instructions for setting up a Puppet manifest on the Master node and applying it on the Slave node. Here's a cleaned-up version of your instructions: + +### Master Node: +## 1.Navigate to the Puppet directory: +``` +cd /etc/puppetlabs +``` +## 2.List the contents: +``` +ls +``` +## 3.Navigate to the code directory: +``` +cd code +``` +## 4.List the contents: +``` +ls +``` +## 5.Create the necessary directories: +``` +sudo mkdir -p environments/production/manifests/ +``` +## 6.Create the necessary directories: +``` +cd environments/production/manifests/ +``` +## 7.Create a new manifest file (`new_site.pp`): +``` +sudo nano new_site.pp +``` +## 8.Add the following content to the new_site.pp file: +``` +node default { + # 1st resource: Install Nginx + package {'nginx': + ensure => installed, + } + + # 2nd resource: Create a status file + file{ '/tmp/status.txt': + content => 'Nginx has been installed successfully', + mode => '0644', + } +} +``` +## 9.Add the following content to the new_site.pp file: +# .Press Ctrl + X to exit. +# .Press Y to confirm saving. +# .Press Enter to save the file with the same name. + +### Slave Node: +## 1.Apply the Puppet catalog: +``` +sudo /opt/puppetlabs/bin/puppet agent --test +``` +## 2.Verify Nginx installation: +# .Copy the public IP of the slave node. +# .Open a web browser and paste the IP. +# .Hit `Enter` to check if it shows the Nginx default page. +## 3.Check the content of the status file: +``` +cat /tmp/status.txt +``` +# .On the slave node, run: +``` +cat /tmp/status.txt +``` +# .It should display: Nginx has been installed successfully. +# This should guide you through setting up your Puppet manifest and verifying its application on the slave node. + + + From 7880626e3e9f2922401fbdaa5db240bf3f8e6740 Mon Sep 17 00:00:00 2001 From: sujeet Kumar <99119279+sk0990670@users.noreply.github.com> Date: Thu, 22 Aug 2024 12:56:20 +0530 Subject: [PATCH 02/10] Update README.md --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2bd5434..7bcca4f 100644 --- a/README.md +++ b/README.md @@ -222,19 +222,19 @@ node default { sudo /opt/puppetlabs/bin/puppet agent --test ``` ## 2.Verify Nginx installation: -# .Copy the public IP of the slave node. -# .Open a web browser and paste the IP. -# .Hit `Enter` to check if it shows the Nginx default page. +### .Copy the public IP of the slave node. +### .Open a web browser and paste the IP. +### .Hit `Enter` to check if it shows the Nginx default page. ## 3.Check the content of the status file: ``` cat /tmp/status.txt ``` -# .On the slave node, run: +### .On the slave node, run: ``` cat /tmp/status.txt ``` -# .It should display: Nginx has been installed successfully. -# This should guide you through setting up your Puppet manifest and verifying its application on the slave node. +### .It should display: Nginx has been installed successfully. +### This should guide you through setting up your Puppet manifest and verifying its application on the slave node. From 109d04b6d30d4263cbc52c4a53714d45dac60d68 Mon Sep 17 00:00:00 2001 From: sujeet Kumar <99119279+sk0990670@users.noreply.github.com> Date: Thu, 22 Aug 2024 17:20:49 +0530 Subject: [PATCH 03/10] Update README.md --- README.md | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 7bcca4f..78cebe1 100644 --- a/README.md +++ b/README.md @@ -162,10 +162,7 @@ Congratulations! Your Puppet Master and Puppet Agent are now set up and running. ![chef-vs-puppet-vs-ansible-what-are-the-differences-it-infographic](https://github.com/vishal815/Puppet_Master_and_Puppet_slave_setup_on_AWS/assets/83393190/f3cf14d2-e39e-49ad-b514-634a8b475099) -Happy learning! - - -### script and instructions for setting up a Puppet manifest on the Master node and applying it on the Slave node. Here's a cleaned-up version of your instructions: +# script and instructions for setting up a Puppet manifest on the Master node and applying it on the Slave node. Here's a cleaned-up version of your instructions: ### Master Node: ## 1.Navigate to the Puppet directory: @@ -212,12 +209,12 @@ node default { } ``` ## 9.Add the following content to the new_site.pp file: -# .Press Ctrl + X to exit. -# .Press Y to confirm saving. -# .Press Enter to save the file with the same name. +### .Press Ctrl + X to exit. +### .Press Y to confirm saving. +### .Press Enter to save the file with the same name. -### Slave Node: -## 1.Apply the Puppet catalog: +## Slave Node: +### 1.Apply the Puppet catalog: ``` sudo /opt/puppetlabs/bin/puppet agent --test ``` From 92c5a8a0e60900adc068c1800f11fed1d458278e Mon Sep 17 00:00:00 2001 From: sujeet Kumar <99119279+sk0990670@users.noreply.github.com> Date: Tue, 27 Aug 2024 12:45:53 +0530 Subject: [PATCH 04/10] an example of a simple Puppet module that manages the installation and configuration of the Apache web server on a Linux system. --- README.md | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/README.md b/README.md index 78cebe1..3c16deb 100644 --- a/README.md +++ b/README.md @@ -233,5 +233,110 @@ cat /tmp/status.txt ### .It should display: Nginx has been installed successfully. ### This should guide you through setting up your Puppet manifest and verifying its application on the slave node. +an example of a simple Puppet module that manages the installation and configuration of the Apache web server on a Linux system. + +### On the Puppet Master Server + +1. **Create the Module Directory Structure**: + ```bash + sudo mkdir -p /etc/puppetlabs/code/environments/production/modules/apache_example/{manifests,templates} + ``` + +2. **Create the `init.pp` Manifest**: + ```bash + sudo nano /etc/puppetlabs/code/environments/production/modules/apache_example/manifests/init.pp + ``` + + Add the following content: + ```puppet + class apache_example { + package { 'apache2': + ensure => 'installed', + } + + service { 'apache2': + ensure => 'running', + enable => true, + require => Package['apache2'], + } + + file { '/var/www/html/index.html': + ensure => 'file', + content => template('apache_example/index.html.erb'), + require => Package['apache2'], + } + } + ``` + +3. **Create the `index.html.erb` Template**: + ```bash + sudo nano /etc/puppetlabs/code/environments/production/modules/apache_example/templates/index.html.erb + ``` + + Add the following content: + ```html + + + Welcome to Apache on <%= @hostname %> + + +

Hello from Puppet-managed Apache on <%= @hostname %>!

+ + + ``` + +4. **Edit the Site Manifest (`site.pp`)**: + ```bash + sudo nano /etc/puppetlabs/code/environments/production/manifests/site.pp + ``` + + Add the following node definition: + ```puppet + node 'your_slave_node_fqdn' { + include apache_example + } + ``` + + Replace `your_slave_node_fqdn` with the actual FQDN of your Puppet Agent (Slave) node. + +### On the Puppet Agent (Slave) Server + +1. **Run Puppet Agent to Apply Configuration**: + After making changes on the Puppet Master, SSH into the Puppet Agent (Slave) node and run: + + ```bash + sudo /opt/puppetlabs/bin/puppet agent --test + ``` + + This command will: + - Connect the agent to the Puppet Master. + - Fetch the catalog that includes the `apache_example` module. + - Apply the configuration, which includes installing Apache, starting the Apache service, and creating a custom `index.html` file. + +### Verification + +1. **Check the Apache Service**: + Ensure that Apache is running on the Puppet Agent node: + + ```bash + sudo systemctl status apache2 + ``` + +2. **Verify the Web Page**: + Open a web browser and navigate to the IP address or domain of the Puppet Agent node (e.g., `http://`). You should see the custom welcome page with the message "Hello from Puppet-managed Apache on [hostname]!". + +### Summary of Commands + +- **Master Server**: + - Create directories: `sudo mkdir -p /etc/puppetlabs/code/environments/production/modules/apache_example/{manifests,templates}` + - Create and edit `init.pp`: `sudo nano /etc/puppetlabs/code/environments/production/modules/apache_example/manifests/init.pp` + - Create and edit template: `sudo nano /etc/puppetlabs/code/environments/production/modules/apache_example/templates/index.html.erb` + - Edit `site.pp`: `sudo nano /etc/puppetlabs/code/environments/production/manifests/site.pp` + +- **Agent (Slave) Server**: + - Run Puppet agent: `sudo /opt/puppetlabs/bin/puppet agent --test` + +Let me know if you need any further assistance! + From 1ee1da0e628bc50c457aa8d3f3d34355960cd535 Mon Sep 17 00:00:00 2001 From: sujeet Kumar <99119279+sk0990670@users.noreply.github.com> Date: Tue, 27 Aug 2024 12:46:36 +0530 Subject: [PATCH 05/10] an example of a simple Puppet module that manages the installation and configuration of the Apache web server on a Linux system. --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 3c16deb..50e0fb9 100644 --- a/README.md +++ b/README.md @@ -233,6 +233,18 @@ cat /tmp/status.txt ### .It should display: Nginx has been installed successfully. ### This should guide you through setting up your Puppet manifest and verifying its application on the slave node. + + + + + + + + + + + + an example of a simple Puppet module that manages the installation and configuration of the Apache web server on a Linux system. ### On the Puppet Master Server From ff4d8d6e5dcba37551f4de96f63d87f94084b578 Mon Sep 17 00:00:00 2001 From: sujeet Kumar <99119279+sk0990670@users.noreply.github.com> Date: Tue, 27 Aug 2024 12:47:43 +0530 Subject: [PATCH 06/10] an example of a simple Puppet module that manages the installation and configuration of the Apache web server on a Linux system. --- README.md | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/README.md b/README.md index 50e0fb9..ba662d6 100644 --- a/README.md +++ b/README.md @@ -233,19 +233,7 @@ cat /tmp/status.txt ### .It should display: Nginx has been installed successfully. ### This should guide you through setting up your Puppet manifest and verifying its application on the slave node. - - - - - - - - - - - - -an example of a simple Puppet module that manages the installation and configuration of the Apache web server on a Linux system. +# an example of a simple Puppet module that manages the installation and configuration of the Apache web server on a Linux system. ### On the Puppet Master Server From f262b7ea6b247bd461abd937909f8ea88702d213 Mon Sep 17 00:00:00 2001 From: sujeet Kumar <99119279+sk0990670@users.noreply.github.com> Date: Thu, 29 Aug 2024 15:13:57 +0530 Subject: [PATCH 07/10] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ba662d6..61cc80e 100644 --- a/README.md +++ b/README.md @@ -189,9 +189,9 @@ sudo mkdir -p environments/production/manifests/ ``` cd environments/production/manifests/ ``` -## 7.Create a new manifest file (`new_site.pp`): +## 7.Create a new manifest file (`site.pp`): ``` -sudo nano new_site.pp +sudo nano site.pp ``` ## 8.Add the following content to the new_site.pp file: ``` From 3b5838ec41b4bdfef13199f49bd9e185732ecf64 Mon Sep 17 00:00:00 2001 From: sujeet Kumar <99119279+sk0990670@users.noreply.github.com> Date: Thu, 29 Aug 2024 15:15:23 +0530 Subject: [PATCH 08/10] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 61cc80e..d328e9c 100644 --- a/README.md +++ b/README.md @@ -193,7 +193,7 @@ cd environments/production/manifests/ ``` sudo nano site.pp ``` -## 8.Add the following content to the new_site.pp file: +## 8.Add the following content to the site.pp file: ``` node default { # 1st resource: Install Nginx @@ -208,7 +208,7 @@ node default { } } ``` -## 9.Add the following content to the new_site.pp file: +## 9.Add the following content to the site.pp file: ### .Press Ctrl + X to exit. ### .Press Y to confirm saving. ### .Press Enter to save the file with the same name. From 9311f888fd217cba818d5ebc37aae2b4e66d52f2 Mon Sep 17 00:00:00 2001 From: sujeet Kumar <99119279+sk0990670@users.noreply.github.com> Date: Wed, 4 Sep 2024 23:53:56 +0530 Subject: [PATCH 09/10] Update README.md --- README.md | 152 +++++++++++++++++++++++++++--------------------------- 1 file changed, 75 insertions(+), 77 deletions(-) diff --git a/README.md b/README.md index d328e9c..749ba41 100644 --- a/README.md +++ b/README.md @@ -162,76 +162,85 @@ Congratulations! Your Puppet Master and Puppet Agent are now set up and running. ![chef-vs-puppet-vs-ansible-what-are-the-differences-it-infographic](https://github.com/vishal815/Puppet_Master_and_Puppet_slave_setup_on_AWS/assets/83393190/f3cf14d2-e39e-49ad-b514-634a8b475099) -# script and instructions for setting up a Puppet manifest on the Master node and applying it on the Slave node. Here's a cleaned-up version of your instructions: +script and instructions for setting up a Puppet manifest on the Master node and applying it on the Slave node. Here's a cleaned-up version of your instructions: ### Master Node: -## 1.Navigate to the Puppet directory: -``` -cd /etc/puppetlabs -``` -## 2.List the contents: -``` -ls -``` -## 3.Navigate to the code directory: -``` -cd code -``` -## 4.List the contents: -``` -ls -``` -## 5.Create the necessary directories: -``` -sudo mkdir -p environments/production/manifests/ -``` -## 6.Create the necessary directories: -``` -cd environments/production/manifests/ -``` -## 7.Create a new manifest file (`site.pp`): -``` -sudo nano site.pp -``` -## 8.Add the following content to the site.pp file: -``` -node default { - # 1st resource: Install Nginx - package {'nginx': - ensure => installed, - } - # 2nd resource: Create a status file - file{ '/tmp/status.txt': - content => 'Nginx has been installed successfully', - mode => '0644', - } -} -``` -## 9.Add the following content to the site.pp file: -### .Press Ctrl + X to exit. -### .Press Y to confirm saving. -### .Press Enter to save the file with the same name. +1. **Navigate to the Puppet directory:** + ```bash + cd /etc/puppetlabs + ``` -## Slave Node: -### 1.Apply the Puppet catalog: -``` -sudo /opt/puppetlabs/bin/puppet agent --test -``` -## 2.Verify Nginx installation: -### .Copy the public IP of the slave node. -### .Open a web browser and paste the IP. -### .Hit `Enter` to check if it shows the Nginx default page. -## 3.Check the content of the status file: -``` -cat /tmp/status.txt -``` -### .On the slave node, run: -``` -cat /tmp/status.txt -``` -### .It should display: Nginx has been installed successfully. -### This should guide you through setting up your Puppet manifest and verifying its application on the slave node. +2. **List the contents:** + ```bash + ls + ``` + +3. **Navigate to the code directory:** + ```bash + cd code + ``` + +4. **List the contents:** + ```bash + ls + ``` + +5. **Create the necessary directories:** + ```bash + sudo mkdir -p environments/production/manifests/ + ``` + +6. **Navigate to the manifests directory:** + ```bash + cd environments/production/manifests/ + ``` + +7. **Create a new manifest file (`site.pp`):** + ```bash + sudo nano site.pp + ``` + +8. **Add the following content to the `site.pp` file:** + ```puppet + node default { + # 1st resource: Install Nginx + package { 'nginx': + ensure => installed, + } + + # 2nd resource: Create a status file + file { '/tmp/status.txt': + content => 'Nginx has been installed successfully', + mode => '0644', + } + } + ``` + +9. **Save and exit the editor:** + - Press `Ctrl + X` to exit. + - Press `Y` to confirm saving. + - Press `Enter` to save the file with the same name. + +### Slave Node: + +1. **Apply the Puppet catalog:** + ```bash + sudo /opt/puppetlabs/bin/puppet agent --test + ``` + +2. **Verify Nginx installation:** + - Copy the public IP of the slave node. + - Open a web browser and paste the IP. + - Hit `Enter` to check if it shows the Nginx default page. + +3. **Check the content of the status file:** + ```bash + cat /tmp/status.txt + ``` + - It should display: `Nginx has been installed successfully`. + +This should guide you through setting up your Puppet manifest and verifying its application on the slave node. # an example of a simple Puppet module that manages the installation and configuration of the Apache web server on a Linux system. @@ -325,18 +334,7 @@ cat /tmp/status.txt 2. **Verify the Web Page**: Open a web browser and navigate to the IP address or domain of the Puppet Agent node (e.g., `http://`). You should see the custom welcome page with the message "Hello from Puppet-managed Apache on [hostname]!". -### Summary of Commands - -- **Master Server**: - - Create directories: `sudo mkdir -p /etc/puppetlabs/code/environments/production/modules/apache_example/{manifests,templates}` - - Create and edit `init.pp`: `sudo nano /etc/puppetlabs/code/environments/production/modules/apache_example/manifests/init.pp` - - Create and edit template: `sudo nano /etc/puppetlabs/code/environments/production/modules/apache_example/templates/index.html.erb` - - Edit `site.pp`: `sudo nano /etc/puppetlabs/code/environments/production/manifests/site.pp` - -- **Agent (Slave) Server**: - - Run Puppet agent: `sudo /opt/puppetlabs/bin/puppet agent --test` -Let me know if you need any further assistance! From 8d5f1af612773b104838e865cd2b893b74768d71 Mon Sep 17 00:00:00 2001 From: sujeet Kumar <99119279+sk0990670@users.noreply.github.com> Date: Wed, 4 Sep 2024 23:57:14 +0530 Subject: [PATCH 10/10] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 749ba41..77b5086 100644 --- a/README.md +++ b/README.md @@ -162,7 +162,7 @@ Congratulations! Your Puppet Master and Puppet Agent are now set up and running. ![chef-vs-puppet-vs-ansible-what-are-the-differences-it-infographic](https://github.com/vishal815/Puppet_Master_and_Puppet_slave_setup_on_AWS/assets/83393190/f3cf14d2-e39e-49ad-b514-634a8b475099) -script and instructions for setting up a Puppet manifest on the Master node and applying it on the Slave node. Here's a cleaned-up version of your instructions: +# script and instructions for setting up a Puppet manifest on the Master node and applying it on the Slave node. Here's a cleaned-up version of your instructions: ### Master Node: