Task 1 - Ansible

Task 1 - Ansible

STEPS TO DO THIS TASK :

?? Configure Docker

?? Start and enable Docker services

?? Pull the httpd server image from the Docker Hub

?? Run the httpd container and expose it to the public

?? Copy the html code in /var/www/html directory and start the webserver.

let's see how it works, for this we will need two nodes controller node and managed node, on the controller node we will run our ansible and on the managed node we will configure the docker by using ansible.

we cannot install Ansible using yum command to install ansible we need to use pip3 command and the command is pip3 install ansible and to check the ansible or the version of ansible we have a command ansible --version.

No alt text provided for this image

now we will tell our controller node about our managed node, for that we have to make an entry in the file /etc/myhosts.txt. in that file, we will give the IP, username, and password of our managed node. we can also add multiple IPs in the file if we have multiple managed nodes.

No alt text provided for this image
No alt text provided for this image

and to list all the managed nodes we have a command which will help our controller node to know how many managed nodes he has.

No alt text provided for this image

we have to do entry in the configuration file of ansible and tell the ansible about all our inventories . To run this playbook we need to give ssh permission. This can be done via host_key_checking=FASLE.

No alt text provided for this image

to check the connectivity between the controller node & managed node or to check whether they are pingable or not we have a ping command.

No alt text provided for this image

now we will create our playbook. Ansible supports YAML language to in playbook.

No alt text provided for this image
No alt text provided for this image

Now we will run our playbook

No alt text provided for this image

as you can see our playbook is successfully running, now we will go to our managed node and check whether the repository of docker has been created or not and we will also check the status of the docker.

No alt text provided for this image
No alt text provided for this image

now as our repo has been created and service is also active, we will further check whether our container has been launched or not.

No alt text provided for this image

As you can see that we have launched our container myos successfully. You can also check the ip of that container.

No alt text provided for this image

Now you can connect this IP and see the web page.

No alt text provided for this image
No alt text provided for this image

Thank You!




Aaditya Tiwari

DevOps Engineer @Amdocs

4 年

Nice explaination ?

要查看或添加评论,请登录

Srishti Jain的更多文章

  • Configuring Load Balancer on AWS using Ansible

    Configuring Load Balancer on AWS using Ansible

    Task Description: ??Provision EC2 instances through ansible. ?? Retrieve the IP Address of instances using the dynamic…

    2 条评论
  • Deploying Webserver on AWS using Ansible

    Deploying Webserver on AWS using Ansible

    This task involves the following steps: 1. Launching an EC2 instance.

    2 条评论
  • Deploying WordPress application on Kubernetes with AWS RDS using terraform

    Deploying WordPress application on Kubernetes with AWS RDS using terraform

    The Objective of the task was to 1.?Write an Infrastructure as code using terraform, which automatically deploy…

    13 条评论
  • Objectives: -

    Objectives: -

    Perform the task-1 using EFS instead of EBS service on the AWS as, Create/launch Application using Terraform 1. Create…

    2 条评论
  • Creating a VPC using NAT Gateway and Integrating it with EC2

    Creating a VPC using NAT Gateway and Integrating it with EC2

    STEPS: 1. Write an Infrastructure as code using terraform, which automatically create a VPC.

    2 条评论
  • Creating VPC and integrating it with Ec2

    Creating VPC and integrating it with Ec2

    STEPS: 1) Write a Infrastructure as code using terraform, which automatically create a VPC. 2) In that VPC we have to…

    5 条评论
  • EKS TASK

    EKS TASK

    What is EKS? Amazon Elastic Kubernetes Service (Amazon EKS) is a managed service that makes it easy for you to run…

    11 条评论
  • Multi Node Kubernetes Cluster

    Multi Node Kubernetes Cluster

    Here we are creating multi node kubernetes cluster by using one master and two slaves. Step1:- Install rhel 8 in your…

    9 条评论
  • Task 1: -

    Task 1: -

    1. Create the key and security group which allow the port 80.

    12 条评论

社区洞察

其他会员也浏览了