DevOps Classroom Series – Ansible – 8/Nov/2019

Ansible Workflow

  1. Make a list of all the commands/steps for deploying the applciation
  2. Execute them manually.
  3. Write a Ansible Playbook with the task for each command/step.

Sample-Application

Spring-pet Clinic

  • This application is based out of java spring framework
  • Prereqs:
    • Java 8 should be installed.
  • Download the Spring-petclinic.jar file file from here
  • once application is downloaded execute the following command in the terminal
java -jar <path to spring-petclinic.jar>

Manual Steps

  • Deploy Spring Pet Clinic which by default runs on 8080 port
sudo apt-get update
sudo apt-cache search jdk | less
sudo apt-get install openjdk-8-jdk -y
java -version
wget https://qt-s3-new-testing.s3-us-west-2.amazonaws.com/spring-petclinic.jar
java -jar spring-petclinic.jar

Student Courses Application

  • This is application written in Python Flask
  • Prereqs:
    • Python 3
    • pip-3
  • Steps
sudo apt-get update
sudo apt-get install python3 python3-pip git -y
git clone https://github.com/DevProjectsForDevOps/StudentCoursesRestAPI.git
cd StudentCoursesRestAPI
pip3 install -r requirements
python3 app.py

Using Ansible For deployment of Sample Application

  • This can be done by writing Playbooks.
  • To Write effective Playbooks, we need to know
    • YAML
    • Modules
    • Tasks
    • Ansible-ENvironment Variables
    • Inventory
    • Ansible Configuration

YAML

  • Is much like JSON.
  • It is collection of name value pairs
  • Refer here for YAML Syntax

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner