Your SlideShare is downloading. ×
CloudInit Introduction
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

CloudInit Introduction

4,220
views

Published on

CloudInit introduction, …

CloudInit introduction,
Use case on Amazon AWS EC2

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
4,220
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
20
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Xebia Workshop CloudInit Xebia: OpenCSI: Bertrand Dechoux Bruno Bonfils Charles Blonde Cyrille Le Clerc Emmanuel Servent Eric BriandSaturday, August 13, 11
  • 2. Introduction  Goal: bootstrap a cloud instance  How: give a file as parameter for the first instance start ▶ Retrievedfrom http://169.254.169.254/latest/user-data ▶ May be a multipart file  Ubuntu project, exist for RPM based systems 2Saturday, August 13, 11
  • 3. Some recipes examples Set the hostname Import SSH keys Declare apt mirror Install packages Execute commands Execute scripts Bootstrap Puppet / Chef Detailed sample : http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/view/head:/doc/examples/cloud-config.txt 3Saturday, August 13, 11
  • 4. Advices CloudInit is not very well documented, use the source, good luck! Choose to use existing recipes or write your own 4Saturday, August 13, 11
  • 5. cloud-config: the key CloudInit script #cloud-config timezone: Europe/Paris packages: - puppet - java-1.6.0-openjdk - tomcat6 - tomcat6-webapps runcmd: - [service, tomcat6, start] - [chkconfig, tomcat6, on] Declarative YAML based configuration 5Saturday, August 13, 11
  • 6. My own shell script #!/usr/bin/env bash instanceId=$(curl http://169.254.169.254/latest/meta-data/instance-id) fqdn="$instanceId.aws.labs.opencsi.com" sed -i.bak "s/HOSTNAME=.*/HOSTNAME=${fqdn}/" /etc/sysconfig/network hostname ${fqdn} echo "127.0.0.1 $id $fqdn" >> /etc/hosts # Now bootstrap puppet puppetd --no-daemonize --onetime -v --server=puppetmaster.aws.labs.opencsi.com 6Saturday, August 13, 11
  • 7. My own shell script #!/usr/bin/env python ... # INJECT DATABASE URL IN CATALINA.PROPERTIES f = open(catalinaBase + /conf/catalina.properties, ab) f.write(nn# BEGIN OF ADDED BY CLOUD-INIT #n) f.write(jdbc.url=jdbc:mysql://my-db-host:3306/petclinicn) f.write(jdbc.username=petclinicn) f.write(jdbc.password=petclinicn) f.write(nn# END OF ADDED BY CLOUD-INIT #n) f.close() # DOWNLOAD AND DEPLOY WAR url = http://my-nexus/fr/xebia/.../1.0.2/petclinic-1.0.2.war URLopener().retrieve(url, catalinaBase + /webapps/petclinic.war) print(Downloaded + url + to + filename) Inject database config in Tomcat Deploy war 7Saturday, August 13, 11
  • 8. CloudInit resources https://help.ubuntu.com/community/CloudInit https://code.launchpad.net/~cloud-init-dev/ cloud-init/trunk 8Saturday, August 13, 11
  • 9. The Workshop“Discover Java Infra as Code with Amazon AWS” http://code.google.com/p/xebia-france/wiki/ JavaInfrastructureAsCodeWithAmazonAwsWorkshop 9Saturday, August 13, 11

×