Configuration Managment Solution Workflow
- Purpose: Automate Deployments, or to be very specific
- ensuring the code written by dev team is reflected in one or more of the enviroments
- Knowledge:
- Various Environments available
- When to deploy in each environment
- Pre-requisites to deploy application. Some of examples are
- JDK 1.9 and tomcat 9 are required
- Python 3.7 is used
- Ensure /etc/<application>/config.yaml has database servers url, username and password.
- Steps of deploying
- Make a list of OS-Level (linux/windows commands) to be exeucted to deploy the application
- Execute all the commands gathered manually to ensure they are working.
Example:
- Purpose: Create a Dev Environment for Spring-Petclinic
- Knowledge:
Ansible Way of Working
- In Ansible smallest activity (atomic) is called as module
- For linux commands which you have written find the right modules in ansible. Ansible has lot of modules Refer Here
- We will be creating one-one mapping between linux commands and modules to be used
Linux Ansible Module
apt-get => apt
wget => get_url
java => command
- Combine modules to form playbook
- Now ansible can be executed in two modes
- Adhoc Command:
- To run ansible create a command
ansible -m ping all
- Playbook:
- Write a YAML file to automate the deployment
- Sample YAML
---
- hosts: all
become: yes
tasks:
- name: install java and update packages
apt:
name: openjdk-8-jdk
update: yes
state: present
- name: download package
get_url:
url: https://war-jar-files.s3-us-west-2.amazonaws.com/spring-petclinic-2.2.0.BUILD-SNAPSHOT.jar
- name: run spring pet clinic
command: java -jar spring-petclinic-2.2.0.BUILD-SNAPSHOT.jar
Ansible Terms
- Playbook: YAML Reprsentation of Automation to be done
- Tasks:
- Each task will be module to be executed with some parameters
- Module:
- Atomic unit of automation in Ansible.
Exercise
- Find steps to deploy
- node js application
- PHP application.
Like this:
Like Loading...