= Implementing infrastructure-as-code with Ansible and GIT!
  
image::ROOT:swarmlab.png[swarmlab,150,float=right]


==  What is "infrastructure-as-code"?


Imaging 

* one click and you can run a full server

** to include your favorite operating system 

** applications

** security rules

** and custom settings

*and this can be reproduced tens, hundreds or even thousands of times, all without human intervention*

====
*Thats the world of infrastructure as code, IaC for short*

IaC is a process where, you define a configuration template with all the required settings and customizations, and a provisioning tool will take care of the rest. 

====


== implement infrastructure-as-code

To successfully implement the infrastructure-as-code and to keep the concept simple we will use

* git for "Code Repository and Versioning"

* ansible for "Automation tool" that  takes control of the infrastructure configuration and performs the necessary actions to reach the desired end-state.


== Usage 

=== run instance

* Run "microservice-ansible"

** Instances->running Containers->Actions [microservice-ansible_masterservice_1]

*** connect [Open a terminal and Run]

=== find examples

* Run "microservice-ansible"

** Instances->running Containers->Actions [microservice-ansible_masterservice_1]

*** connect [Project BaseDir]

cd in  [Project BaseDir]/examples 

=== Attach network

* Run "microservice-ansible"

** Instances->running Containers->Actions [microservice-ansible_masterservice_1]

*** Networks->"Select Network"


== Scenario

=== run swarm

* Run "hybrid-linux"

** Labroom->"Swarmlab LabRoom Deploy - Local "->Actions [hybrid-linux] 

*** Number of Instances (e.g. 5) -> Up

=== run ansible

* Run "microservice-ansible"

** Instances->running Containers->Actions [microservice-ansible_masterservice_1]

*** connect [Open a terminal and Run]

=== Attach network

* Run "microservice-ansible"

** Instances->running Containers->Actions [microservice-ansible_masterservice_1]

*** Networks->"Select Network" [network hybrid linux]


====
Terminal: microservice-ansible

cd /home/docker/project/examples

edit inverntory.yml (ifconfig, nmap etc)

run fluentd.yml.sh

TIP: It's time to relax and have a cup of coffee!


====