Hint: Read about webhook in jenkins

Note: this is a pipeline approach

ANS:

Step-1: Setup simple S3 Bucket

Step-2: here we are using Automated Pipeline Approaches

https://github.com/kushagra67414/jenkins-static-s3-deploy

It consists of Jenkins pipeline and policy required for s3 bucket to allow public access & index.html and error.html files

Prerequisite:

Git must be configured in windows OS.

Clone awslabs/git-secrets repo using git-bash

Follow the below document to configure git-secrets globally…

  1. Update your git using git-bash. Execute the following command on git-bash.
git update-git-for-windows

2. Clone the repo

Command:

git clone https://github.com/awslabs/git-secrets.git

2. open PowerShell “run as administrator”

go to the repository where we clone the above repo. In my case path is

C:\users\dell\desktop\ttn\git-secrets

3. Check the version of the git.

git --version

4. Now execute the installation script of the windows. It simplifies the setup on windows.

./install.ps1

This might show an error like :

./install.ps1 : File C:\Users\Dell\desktop\ttn\git-secrets\install.ps1…

Prerequisite:

Condition:

Conditions mean working on different scenarios different conditions are required to execute those conditions.

In ansible YAML script we use the “when” command to give the condition.

Let’s take an example of a script:

Script:

--- # My Condition Playbook
- hosts: developers
user: ansible
become: yes
connection: ssh
gather_facts: yes
tasks:
- name: installing apache2 on debian
command: apt-get -y install apache2
when: ansible_os_family == "Debian"
- name: installing httpd on linux
command: yum install httpd -y
when: ansible_os_family == "RedHat"

Commands:

vi conditions.yml // write the above YAML script

ansible-playbook conditions.yml

Prerequisite:

The playbook in Ansible is written in YAML format. It is a human-readable data serialization language and used for the configuration file.
In the playbook, we can write codes consist of Var, tasks, handler, files, templates, and roles.
Each playbook is composed of one or more modules in a list.

The playbook is divided into various sections like:
target section: defines the host agents.
Variable section: Define variables
task section: list of module that we want to run in an order

Let’s create a playbook:

A. go to the Ansible server and follow the below command.

vi target.yml

code:

Prerequisite:

node2 [172–21–32–33] node1 [172–31–42–50] server [172.31.38.62]

Host Patterns =>

Here, we check the numbers of nodes connected to our server in any pattern.

Commands:

ansible all — lists-hosts
ansible — lists-hosts
ansible [0] — lists-hosts

where
[0] means first node
[1] means second node
[-1] means last node
[-2]
means second last node
1:4] means second node to fifth node

Ansible is an open-source automation engine that automates software provisioning, configuration management, and application deployment.

Pro’s

Push-based configuration management tool.
Ansible is agentless. No need to install any services on nodes (client).

It is secure due to its agentless capabilities and open SSH Security Features.

Ansible does not need any System Administrator skills to install and use it.

Con’s

With an insufficient user interface, Ansible tower is GUI-based but still in an early development stage.
Cannot achieve full automation by ansible. Less limited support because it is a new tool.

Establish a connection between the Ansible server and two-node using…

Setup S3 Trigger with Lambda and Dynamo DB. Here, we will update the dynamo DB by fetching/triggering the new files added in the S3 bucket using the AWS lambda function which will we be complete automation.

Step-1:
Create an IAM role (having specific permissions to access the AWS services).
Go to Roles > create role > AWS services > lambda and select the policy.
Here policy, we are attaching to our role is “AmazonDynamoDBFullAccess” and move a step ahead to complete further configurations.
Add a role name, role name can be any, and click on create.
Follow the below output.

AWS Lambda is a compute service from Amazon Web Services that allows you to run code without providing or managing servers. With AWS Lambda, you can run code for almost any type of application or backend service with no need for an administrator.

Aws manages various administrator services:

  • Provisioning and capacity of the compute fleet that offers a balance of memory, CPU, network, and other resources.
  • Server and OS maintenance
  • High availability and Automatic Scaling
  • Monitoring fleet Health
  • Applying Security patches
  • Deploying your code
  • Monitoring and logging your lambda function
  • AWS Lambda runs your code on a high–availability compute infrastructure

Prerequisite => https://bansalkushagra.medium.com/what-is-bootstrapping-uploading-cookbook-in-chef-server-node-configurations-db59c1991514

Basic commands to List and delete cookbooks, roles, list of clients and nodes

1. To list cookbooks in chef-server

Ø knife cookbook list

2. To delete the cookbook from the chef-server

Ø knife cookbook delete <cookbook_name> -y

3. To list nodes in chef-server

Ø knife node list

4. To delete a node from chef-server

Ø knife node delete <Node_name> -y

5. To list Client in chef-server

Ø knife client-list

6. To delete clients from chef-server

Ø knife client delete <client_name > -y

7. To list roles in chef-server

Ø knife role list

8. To delete role form…

Prerequisite: https://medium.com/nerd-for-tech/attributes-in-chef-a56073de90ea

https://medium.com/nerd-for-tech/runlist-multiple-recipes-linux-group-users-in-chef-170afcb51fba

Step-1: Access your Amazon EC-2 machine and follow the below command:

Ø sudo su

Ø cd cookbooks

Step-2:

Create an account of chef-server. Go to https://manage.chef.io/login, create an organization for your chef-server. After some time we will see “starter-kit” download it using this we can connect our chef-workstation with different nodes.

Start-kit contains all the server files which are used to connect over the server. Follow the below output sequentially.

First, Go to https://manage.chef.io/login> sign up, and verify your account

KUSHAGRA BANSAL

DevOps Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store