irving cordova
retrieved from: https://www.eucalyptus.com/eucalyptus-cloud/iaas
retrieved from: http://arnoldit.com/wordpress/2012/03/01/datasift-architecture/
retrieved from: http://www.dbta.com/Editorial/News-Flashes/IBM-Announces-Cloud-of-Clouds-Approach-to-Data-Migration-and-Storage-94054.aspx
?
we were already familiar with it
bash "compile_redis_source" do
cwd Chef::Config[:file_cache_path]
code <<-EOH
tar zxf redis.tar.gz
cd antirez-redis-55479a7
make && make install
EOH
creates "/usr/local/bin/redis-server"
end
service "redis" do
provider Chef::Provider::Service::Upstart
subscribes :restart, resources(:bash => "compile_redis_source")
supports :restart => true, :start => true, :stop => true
end
template "redis.conf" do
path "#{node[:redis][:dir]}/redis.conf"
source "redis.conf.erb"
owner "root"
group "root"
mode "0644"
notifies :restart, resources(:service => "redis")
end
a sample chef recipe
we need orchestration!
the codification of a complete process
image and quote from: https://devcentral.f5.com/articles/wils-automation-versus-orchestration
An expressive toolset for constructing scalable, resilient architectures
infochimps logo
image from: http://availagility.co.uk/2012/04/21/linking-flow-value-and-capability/multiple-teams-jpg/
image from wikipedia
# file: create_server.yml
- hosts: local
connection: local
gather_facts: False
tasks:
- name: Provision server
local_action: ec2
ec2_url={{lookup('env', 'EC2_URL')}}
aws_access_key={{ lookup('env', 'AWS_ACCESS_KEY_ID') }}
aws_secret_key={{ lookup('env', 'AWS_SECRET_ACCESS_KEY') }}
keypair={{lookup('env', 'keypair')}}
instance_type=t1.micro
image={{ lookup('env', 'image_centos') }}
zone={{ lookup('env', 'regions') }}
instance_tags='{"Name":"sample_server"}'
wait=true
count=1
an ansible task to create a server in eucalyptus
image from wikipedia
image from http://aws.amazon.com/ec2/
#!/usr/bin/env python
'''
EC2 external inventory script
=================================
Generates inventory that Ansible can understand by making API request to
AWS EC2 using the Boto library.
NOTE: This script assumes Ansible is being executed where the environment
variables needed for Boto have already been set:
export AWS_ACCESS_KEY_ID='AK123'
export AWS_SECRET_ACCESS_KEY='abc123'
This script also assumes there is an ec2.ini file alongside it. To specify a
different path to ec2.ini, define the EC2_INI_PATH environment variable:
export EC2_INI_PATH=/path/to/my_ec2.ini
If you're using eucalyptus you need to set the above variables and
you need to define:
export EC2_URL=http://hostname_of_your_cc:port/services/Eucalyptus
For more details, see: http://docs.pythonboto.org/en/latest/boto_config_tut.html
the ec2 dynamic inventory from ansible
$ export EC2_URL=http://127.0.0.1:8773/services/Eucalyptus
$ ansible -i ec2.py -u ubuntu us-east-1d -m ping
image from: http://www.clker.com/clipart-server-farm.html
# filter out the instances that don't have a cluster tag
cluster = os.environ.get('CLUSTER')
if cluster != None:
if 'cluster' in instance.tags and instance.tags['cluster'] != cluster:
return
if not 'cluster' in instance.tags:
return
modifying ec2 inventory to only return servers with the correct CLUSTER tag
image from: http://www.nytimes.com/2008/12/04/fashion/04roles.html
{
"ec2": [
"euca-127-0-0-1.eucalyptus.cloud.net"
],
"i-942C484F": [
"euca-127-0-0-1.eucalyptus.cloud.net"
],
"local": [
"localhost"
],
"tag_role_sample": [
"euca-127-0-0-1.eucalyptus.cloud.net"
],
"type_t1_micro": [
"euca-127-0-0-1.eucalyptus.cloud.net"
]
}
# file: sample_role.yml
- hosts: 'tag_role_sample'
roles:
- sample
tags returned by EC2 inventory
translating tag to roles
image from: https://www.arbfile.org/webapp/pgStatic/content/EBulletinArbitrators/2013/pgEBulletinArbs_May2013.jsp
# file: hosts/group_vars/tag_cluster_mycluster
# Properties to override go here
msg: "Overriden!"
overriding variables per cluster
____ansible.cfg
|____bin
| |____ansible-eucalyptus
|____clouds
| |____sample_cloud.ini
|____hosts
| |____ec2.py
| |____group_vars
| | |____tag_cluster_mycluster
|____keys
| |____sample.key
|____tasks
| |____create_server.yml
| |____sample_role.yml
| |____roles
| | |____sample
| | | |____defaults
| | | | |____main.yml
| | | |____tasks
| | | | |____main.yml
final tree with all files in place