20. Vagrantfile
Vagrant.configure("2")
do
|config|
config.vm.box
=
"precise64"
config.vm.box_url
=
"http://files.vagrantup.com/precise64.box"
config.vm.network
:private_network,
ip:
"192.168.33.10"
config.vm.synced_folder
"../data",
"/vagrant_data"
config.vm.provider
:virtualbox
do
|vb|
vb.customize
["modifyvm",
:id,
"-‐-‐memory",
"1024"]
end
end
!
RACKSPACE® HOSTING
|
WWW.RACKSPACE.CO.UK
21. Vagrantfile
Vagrant.configure("2")
do
|config|
config.vm.box
=
"precise64"
config.vm.box_url
=
"http://files.vagrantup.com/precise64.box"
config.vm.network
:private_network,
ip:
"192.168.33.10"
config.vm.provision
:puppet
do
|puppet|
puppet.manifests_path
=
"manifests"
puppet.manifest_file
=
"init.pp"
end
end
!
RACKSPACE® HOSTING
!
|
WWW.RACKSPACE.CO.UK
22. Taking this to 11!
RACKSPACE® HOSTING
|
WWW.RACKSPACE.CO.UK
23. Taking this to 11!
Vagrant.configure("2")
do
|config|
config.vm.provision
"shell",
inline:
"echo
Hello"
config.vm.define
"web"
do
|web|
web.vm.box
=
"apache"
end
config.vm.define
"db"
do
|db|
db.vm.box
=
"mysql"
end
end
!
RACKSPACE® HOSTING
!
|
WWW.RACKSPACE.CO.UK
24. Taking this to 11!
RACKSPACE® HOSTING
|
WWW.RACKSPACE.CO.UK
34. Packer
$
packer
build
example.json
==>
amazon-‐ebs:
amazon-‐ebs
output
will
be
in
this
color.
==>
amazon-‐ebs:
Creating
temporary
keypair
for
this
instance...
==>
amazon-‐ebs:
Creating
temporary
security
group
for
this
instance...
==>
amazon-‐ebs:
Authorizing
SSH
access
on
the
temporary
security
group...
==>
amazon-‐ebs:
Launching
a
source
AWS
instance...
==>
amazon-‐ebs:
Waiting
for
instance
to
become
ready...
==>
amazon-‐ebs:
Connecting
to
the
instance
via
SSH...
==>
amazon-‐ebs:
Stopping
the
source
instance...
==>
amazon-‐ebs:
Waiting
for
the
instance
to
stop...
==>
amazon-‐ebs:
Creating
the
AMI:
packer-‐example
1371856345
==>
amazon-‐ebs:
AMI:
ami-‐19601070
==>
amazon-‐ebs:
Waiting
for
AMI
to
become
ready...
==>
amazon-‐ebs:
Terminating
the
source
AWS
instance...
==>
amazon-‐ebs:
Deleting
temporary
security
group...
==>
amazon-‐ebs:
Deleting
temporary
keypair...
==>
amazon-‐ebs:
Build
finished.
!
==>
Builds
finished.
The
artifacts
of
successful
builds
are:
-‐-‐>
amazon-‐ebs:
AMIs
were
created:
!
us-‐east-‐1:
ami-‐19601070
RACKSPACE® HOSTING
|
WWW.RACKSPACE.CO.UK
35. Packer
Deploy to more than one!
provider at the same time!
using the “builders” array
RACKSPACE® HOSTING
|
WWW.RACKSPACE.CO.UK
36. Packer
$
packer
build
example.json
==>
amazon-‐ebs:
amazon-‐ebs
output
will
be
in
this
color.
==>
digitalocean:
digitalocean
output
will
be
in
this
color.
!
==>
digitalocean:
Creating
temporary
ssh
key
for
droplet...
==>
amazon-‐ebs:
Creating
temporary
keypair
for
this
instance...
==>
amazon-‐ebs:
Creating
temporary
security
group
for
this
instance...
==>
digitalocean:
Creating
droplet...
==>
amazon-‐ebs:
Authorizing
SSH
access
on
the
temporary
security
group...
==>
amazon-‐ebs:
Launching
a
source
AWS
instance...
==>
digitalocean:
Waiting
for
droplet
to
become
active...
==>
amazon-‐ebs:
Waiting
for
instance
to
become
ready...
==>
digitalocean:
Connecting
to
the
droplet
via
SSH...
==>
amazon-‐ebs:
Connecting
to
the
instance
via
SSH...
...
==>
Builds
finished.
The
artifacts
of
successful
builds
are:
-‐-‐>
amazon-‐ebs:
AMIs
were
created:
!
us-‐east-‐1:
ami-‐376d1d5e
-‐-‐>
digitalocean:
A
snapshot
was
created:
packer-‐1371870364
RACKSPACE® HOSTING
|
WWW.RACKSPACE.CO.UK
37. Packer
Also deploy to Vagrant!
using the “post-processors”!
array
RACKSPACE® HOSTING
|
WWW.RACKSPACE.CO.UK