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


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


Imaging 

* a single click and you’re able to get a full server up and running. 

** include your favorite operating system, 

** applications

** security rules

** and custom settings. 

And the configuration 

 can be replicated dozens, 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 instead of manually setting up every server, you define a configuration script with all the required settings and customizations, and a provisioning tool will take care of the rest. 


== implement infrastructure-as-code

To successfully implement 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: make a cup off cafe!


====





