This talk is about an introduction to practical aspects of what a cloud platform should offer, while connecting with essential background information of cloud computing theory. We are going to review the basics of a cloud computing platform. After laying the field of the cloud as a means for automated infrastructure, we are going to extend in Ansible for cloud management.
Ansible is one option for running orchestrated workflows over one or multiple IT environments, while also covers the network management. We shall describe by example the management of cloud resources and services residing on those resources based on Ansible playbooks. Then, a discussion on the abstractions available through variables,roles and inventories will follow.
20. Page - 20
Variables
Config settings
System level
Application
Vars defined
CLI
several files
priority
# httpd version
httpd_version: "2.4.6"
httpd_packages:
- "httpd"
- "mod_ssl"
# httpd.conf options
httpd_conf:
ServerRoot: "/etc/httpd"
MainConfPath: "/etc/httpd/conf/httpd.conf"
DocumentRoot: "/var/www"
ListenPort:
- "80"
- "443"
21. Page - 21
---
- hosts: web-farm
vars_files:
- path/to/htppd.vars
tasks:
- name: Be sure apache is installed
package:
name: "{{ httpd_packages }}"
state: present
- name: Be sure apache is configured
template:
src: httpd.conf.j2
dest: "{{ httpd_conf.MainConfPath }}"
Task Automation
Ansible play
Variables
Ansible modules
22. Page - 22
---
- hosts: web-farm
vars_files:
- path/to/htppd.vars
tasks:
- name: Be sure apache is installed
package:
name: "{{ httpd_packages }}"
state: present
- name: Be sure apache is configured
template:
src: httpd.conf.j2
dest: "{{ httpd_conf.MainConfPath }}"
Task Automation
Ansible play
Inventory
Variables
Ansible modules
23. Page - 23
# Production servers
LIVE-web01 ansible_host=10.0.0.10
LIVE-web02 ansible_host=10.0.0.10
[web-farm]
LIVE-web01
LIVE-web02
[backend:children]
web-farm
[all:vars]
ansible_port=22
ansible_user=system
ansible_private_key_file=~/.ssh/id_rsa
Inventory
Define hosts
behavioral settings
host vars
Groups
Groups of groups
Group vars
default groups