Getting Started with Configuration Management and Ansible

Why Ansible?

Prerequisites

Additional Tips

Installing Ansible

Step 1: Install Ansible (on the host system / Ansible system)

sudo apt-get update
sudo apt-get install software-properties-common
sudo apt-add-repository ppa:ansible/ansible
sudo apt-get update
sudo apt-get install ansible

Step 2: Verify the Version (test if it works!)

Step 3: Update Configuration Files

Step 4: Verifying Connection

ansible WebServer -m ping -e 'ansible_python_interpreter=/usr/bin/python3'
[WebServer:vars]
'ansible_python_interpreter=/usr/bin/python3'

Step 5: Update the Remote Server

ansible WebServer -m apt -a "upgrade=yes update_cache=yes" -b

Step 5: Ansible Playbook

Install a WebServer on ECS Server

---
- hosts: WebServer
tasks:
- name: Install NginX
apt: name=nginx state=latest
- name: Start NginX Service
service:
name: nginx
state: started

Deploy Default Website Page

- name: "HTML Test Deploy"
become: true
syncronize:
dest: /var/www/html
src: ../default-site/

Ansible in Action

--

--

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