Getting Started in AWS and Eucalyptus - AnsibleFest 2013

2,090 views

Published on

Presentation from 2013 AnsibleFest which describes practices for using Ansible against AWS and Eucalyptus clouds.

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,090
On SlideShare
0
From Embeds
0
Number of Embeds
223
Actions
Shares
0
Downloads
9
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Getting Started in AWS and Eucalyptus - AnsibleFest 2013

  1. 1. Getting Started in AWS &EucalyptusLester Wade@LesterWade
  2. 2. Why Ansible?New and interesting.Subsequently found to be awesome.Contribution is easy.Python (note to python-boto).
  3. 3. AWS Modulesec2ec2_factsec2_volec2_elbrdscloudformations3
  4. 4. Two aspects...1. Working with AWS (compatible) services.2. Working with the resources (instances).
  5. 5. Example:ec2 provision + load balance + configure
  6. 6. Provision + Load Balance:tasks:- name: Launch instancelocal_action: ec2 keypair=mykey group=mygroup instance_type=m1.small image=emi- wait=true region=eu-west-1register: ec2- name: Add new instance to host grouplocal_action: add_host hostname=${item.public_ip} groupname=launchedwith_items: ${ec2.instances}- name: Wait for SSH to come uplocal_action: wait_for host=${item.public_dns_name} port=22 delay=60 timeout=320 state=startedwith_items: ${ec2.instances}- name: Add the instance to my LBlocal_action: ec2_elb instance_id=${item.id} state=present ec2_elbs=lwadeelbwith_items: ${ec2.instances}
  7. 7. Configure (based on dynamic host group)- name: Configure instance(s)hosts: launchedgather_facts: Truehandlers:- name: restart apacheaction: service name=httpd state=restartedtasks:- name: Ensure NTP is up and runningaction: service name=ntpd state=started- name: Install Apacheaction: yum name=httpd state=latestnotify: restart apache- name: Copy index.htmlaction: copy src=files/index.html dest=/var/www/html/index.html owner=root group=rootnotify: restart apache
  8. 8. "Oh nice, I can automate instance launchand configuration but what now... ?"
  9. 9. Working with instances (2)Transient- auto-scale in/out- die
  10. 10. Example: inventory pluginExample: ansible-pull
  11. 11. Schedule continual snapshot in cron(tab):# Refresh EC2 inventory cache every 15 minutesMAILTO="root@localhost"*/15 * * * * /etc/ansible/ec2.py --refresh-cache# Consider refresh-cache prior to crontabed playbook executionUtilize inventory:ansible-playbook -i /etc/ansible/ec2.py tag_Name_ansiblefest -m ping --private-key=/my/pri.key
  12. 12. Bake ansible + ansible-pull into an image.Run on boot or cron. rc.local or crontab -l:# Ansible first-boot runansible-pull -d /var/lib/ansible/local -U https://github.com/lwade/ansiblefest.git >> /var/log/ansible-pull.log 2>&1
  13. 13. Working with instances (2)Transient (e.g. auto-scaled in/out)Image-backed*
  14. 14. * Raw vs. Baked Imageschoco chip cookie, Bob Smith
  15. 15. Example: image buildinghttps://github.com/lwade/ansiblefest/blob/master/image-build/image-build.yml
  16. 16. Thanks

×