3. DEVOPS - INFRASTRUCTURE AS CODE
Ansible
Tool di configurazione di risorse (ad esempio di macchine virtuali in VMware)
Terraform
Orchestratore di risorse: permettere di definire in modo dichiarativo le risorse fornite da una infrastruttura
on premise come Vmware oppure in cloud come AWS o GCE
Kubernetes
Orchestratore di container
4. Ansible
Esempio di file yaml che “dichiara” lo stato di una macchina virtuale: configurazione di rete e software installato
- hosts: localhost
tasks:
- name: Create a VM
vmware_guest:
datacenter: ITERBDCT001
cluster: ITERBCLR001
name: node06
template: "Ubuntu 16.04.4 server"
state: poweredon
template: "Ubuntu 16.04.4 server"
networks:
- ip: 172.16.3.178
netmask: 255.255.254.0
customization:
dns_servers:
- 172.16.2.1
domain: smeup.com
...
- name: Install apache
apache2_module:
state: present
5. Terraform
Esempio di file .tf
resource "openstack_compute_keypair_v2" "terraform" {
name = "terraform"
public_key = "${file("${var.ssh_key_file}.pub")}"
}
resource "openstack_networking_network_v2" "terraform" {
name = "terraform"
admin_state_up = "true"
}
resource "openstack_networking_subnet_v2" "terraform" {
name = "terraform"
network_id = "${openstack_networking_network_v2.terraform.id}"
cidr = "10.0.0.0/24"
ip_version = 4
dns_nameservers = ["8.8.8.8", "8.8.4.4"]
}
11. Conclusione
●Infratruttura come codice versionabile ad esempio in Github o GitLab (a breve!)
●Aggiornamento dell’infrastruttura e delle applicazioni installate senza interruzione di servizio