Dynamic provisioning with on

4 downloads 244 Views 911KB Size Report
web-‐group db-‐group. [local]. 127.0.0.1. [web-‐group]. 10.0.0.1. 10.0.0.2 octo.com.au ec2-‐web-‐front. [db-â€
Dynamic provisioning with

on

Get the source code https://github.com/octo-technology-downunder

© OCTO 2015

Level 7, 263 Clarence Street Sydney NSW 2000

www.octo.com.au @OCTODownUnder

Ansible, a simple automation tool

Automation

 

 

(Install,  configure  &  deploy)

   

22

Ansible, all you need to know

Inventory  

 

 

(machines)

 

Roles

   

(tasks:  apache,  mysql,  tomcat…)  

 

Playbooks

   

(execution  procedure:  roles  for  machines)  

33

Ansible Inventory $ cat ./project_inventory

[all-­‐my-­‐machines]   local   web-­‐group   db-­‐group  

Inventory  

 

[local]   127.0.0.1  

=     Hosts   +     Groups  

Group Name

 

[web-­‐group]   10.0.0.1   10.0.0.2   octo.com.au   ec2-­‐web-­‐front  

IP Address Hostname SSH Alias

 

[db-­‐group]   10.0.0.3     44

Roles  

  YAML Files   Declaratively define tasks

$ ls -1 roles/tomcat

defaults handlers meta tasks templates  

defaut config tomcat restart… dependencies action list template file (ex: server.cong.j2)

$ cat roles/tomcat/main.yml --- name: Install Tomcat apt: pkg={{tomcat_package}} state=latest - name: Start Tomcat service: name={{tomcat_service}} state=started enabled=yes   55

$ cat ./playbook_webconfig.yml

Playbooks     YAML Files   Declaratively define your configuration   Can contain many ‘’roles’’ targeting different groups

--- hosts: web-­‐group user: root vars: http_port: 80 max_clients: 200 roles: - java - apache - tomcat -  hosts: db-­‐group   user: root roles: - mysql   66

Dynamic Inventory?

Dynamic  Inventory?

 

 

  Register  hosts  dynamically   (via  the  register  module)  

  Import  hosts  list  from  external  sources   {CMDB,  EC2..  }   (via  plugins)  

77

Demo     1.  EC2  Provisioning   Create  of  2  types  of  machines  with  one  command  line   (with  ec2  &  register  module)    

2.  EC2  Cleaning   Get  the  list  of  EC2  machines  running     and  terminated  them   (with  ec2  inventory  plugin)  

88

Get the source code https://github.com/octo-technology-downunder

99

Suggest Documents