just enough

ansible

Frontend
Carts
Catalogue
frontend
catalogue
catalogue-db
carts
carts-db
https://github.com/udbc/bootcamp/tree/master/ansible
[frontend]
  • list of hosts
  • type/class/group that host belongs to 
  • how to connect to the host
inventory
[catalogue]
[carts]

inventory

[frontend]
192.168.61.11 ansible_ssh_pass=xyz

[catalogue]
192.168.61.12 ansible_ssh_pass=xyz

[carts]
192.168.61.13 

[dev:children]
frontend
catalogue
carts
frontend
catalogue
catalogue-db
carts
carts-db

ROLES

common
common
common
common
common
nodejs
catalogue
mongo
mysql
carts

roles

APP
ta1.yml
ta2.yml
tasks
f1
files
f2
vars
main.yml
app1
roles
ta1.yml
ta2.yml
tasks
task1
task2
- user:
    name: xyz
    comment: "Xy Z"
    uid: 5001
    group: devops
- package:
    name: tomcat
    version: 7.0.1
main.yml
user
package
modules
task file
objective
APP

Steps

  • Create User
  • Install Apps
  • Manage Configs
  • Start Service 
APP

Steps

  • Create User
  • Install Apps
  • Manage Configs
  • Start Service 

Map to Ansible Modules

Modules

user
package
template
service
user
package
template
service
state = present
uid = 5001
home = /home/xyz
pass = xxxx
name = xyz
state = installed
version = 7.0.4
state = running
state = present
source = xyz.j2
owner = root
mode = 0644
name = xyz

Task Definitions

frontend
catalogue
catalogue-db
carts
carts-db
common
common
common
common
nodejs
catalogue
mysql
carts
docker
playbooks
play 1
play 2
play 3
- hosts: db
  remote_user: devops
  become: true
  roles:
     - { role: mysql, tags: 'mysql'  }
- hosts: www
  remote_user: devops
  become: true
  roles:
     - base 
     - java
     - tomcat
 
- hosts: lb
  remote_user: devops
  become: true
  roles:
     - base 
     - ssl
     - haproxy
 
host
role1
role2
role3
playbooks
provisioning
installation & 
configurations
application deployment

one server many Playbooks

playbook3
playbook2
playbook1
[frontend]
inventory
[catalogue]
[carts]
[carts]
frontend
catalogue
carts

Properties

group_vars
Made with Slides.com