Deployment of Webserver on Docker Using Ansible

Concepts Used :

  1. Ansible : It is simple open source IT engine which automates application deployment, intra service orchestration, cloud provisioning and many other IT tools.
  2. Ansible-Playbook : A playbook is a file where users write Ansible code, an organized collection of scripts defining the work of a server configuration.
  3. Docker : It is an open-source project for automating the deployment of applications as portable, self-sufficient containers that can run on the cloud or on-premises.
  4. Controller Node : A controller node(CN) is a Linux server that has Ansible installed on it and is used for managing remote hosts or nodes.
  5. Managed Node : The remote systems managed by the controller node are known as Managed Hosts or Managed Node(MN).

Check the following things in CN :

  • Ansible version by the command :- ansible — version
  • Create a inventory file that contains managed node IP , username and password. So that CN can manage the configuration of MN.
  • Add the path of inventory in configuration file of ansible -/etc/ansible/ansible.cfg
  • Get all manage nodes by the command : ansible all — list-hosts
  • Check the connectivity by the command : ansible all -m ping

Now the setup of the Ansible is done . So, we can go to the next step that is creating a playbook. Ansible Support YAML language , Hence I have created the dockercode.yml ansible-playbook.

This playbook performs following tasks at MN :
1. Configures yum for Docker
2. Installs Docker Software
3. Starts Docker services
4. Installs Docker SDK
5. Creates directory at MN
6. Copies Webpages from CN to MN
7. Pulls httpd server image
8. Launches Docker container

CODE :

  • Run the playbook by the command : ansible-playbook dockercode.yml

OUTPUT :

  • check all the things in MN , that we have done from CN.

Thank You!

--

--

--

Started Learning New Technologies

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to transition from DevOps to DevSecOps?

DevOps vs DevSecOps

Deploy your own version of Liquity Protocol and Create Troves

How to Successfully Manage Software Development Teams

How to manage software development teams

Resolving the Dilemma Between Native and Progressive Web Apps

September Update: Github, Khaos, and Growth!

Agile Movers & Shakers (4): Dave West, CEO of Scrum.org

Validator Initiative #10 — Spotlight Project & The Elected Series

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
Priyanka Bhide

Priyanka Bhide

Started Learning New Technologies

More from Medium

Learning DevOps Series Part 2A: Creating Spring Boot Project

Installing Jenkins on CentOS

Deploy Jenkins agents using EC2 Spot instances

CI/CD Concept with PipeLine