-
-
Save gcgists/6466707 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
runcmd: | |
- [ touch, /tmp/alive ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
# Must be a runcmd because of the backtics | |
runcmd: | |
- apt-get -y install linux-headers-`uname -r` | |
# Include the Gridcentric public repo | |
apt_sources: | |
- source: "deb http://downloads.gridcentric.com/packages/agent/linux/ubuntu/ gridcentric multiverse" | |
key: | | |
-----BEGIN PGP PUBLIC KEY BLOCK----- | |
Version: GnuPG v1.4.11 (GNU/Linux) | |
mQENBFAQqgUBCADOMIkW4BliIOZyks8addo/SJjXRVjbAs2/O5pINHTRRo8DabCB | |
ISbKAjmxpkepQ/mN2o4cxK+3IGpSVQhrhLRyBRRMZv1MH4n+Yoq2AemO83ILQthi | |
39jHwKm107untAeLKTwt1DSY1HnFEQJl5bwG7HHqz3iD9HCwY5bX4eDrm4AxW0NG | |
rPdZpnLcuZfgMWEzRnhSkaTrCKiysQs5BVF3twbmzgO6hK26XjEOCNeOgHWGAbjZ | |
tky9zcjg2c1FG6g7pYyPyeLkSpF+CfhYe5pclrSvB708wVb+NczBD9MfInV9Er9/ | |
UYr2kd4rYttc/tUFSCPjKoT9grO7dtIHbZVtABEBAAG0J0dyaWRjZW50cmljIElu | |
Yy4gPGluZm9AZ3JpZGNlbnRyaWMuY29tPokBOAQTAQIAIgUCUBCqBQIbAwYLCQgH | |
AwIGFQgCCQoLBBYCAwECHgECF4AACgkQ9sSiVmboP0x1eAgAkpUEzJ5ZxjZPxbPH | |
de5ryZpUvb/3VKsXiV6mRPHM78Psdjc68dnm3n1V57g5zc57n2mD/li80Y+bqzgk | |
eWjMg6JRr1bBIgz2kKVtXQhmDWsk9tu3KW3AieVArsZWjGo8Oab4jNZO0gq2QOcR | |
Bt/uTYW2wU9xO0S/AyRtwBUqjDP7Q9LKp2i5UrBCtQfXQ1WFvUgQzhcYwFkoO/oH | |
bi4S4hcMsGBQjsrtQkorwj8Fp3QuUErvjnjT6+6RqO+W2SjYb7eFSBBHRD6Wnas4 | |
TDETaIfuEOonLXzRjaQ2QTprVIZDQkY9Qnp/BZXfWheXeIkq6jsWyV87Wmwm+V8e | |
zGdl0Q== | |
=DHFj | |
-----END PGP PUBLIC KEY BLOCK----- | |
packages: | |
- vms-agent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a VM snapshot | |
nova live-image-create vms-test-vm vms-test-snapshot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Boot a VM, passing in the cloud-init-vms.txt file as user-data. | |
# Note: --flavor, --image, --key_name, and --security_groups should | |
# be set according to your environment. | |
nova boot --flavor m1.small --image precise-server-cloudimg-amd64 --key_name default --security_groups default --user-data cloud-init-vms.txt --poll vms-test-vm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Download the cloud-init-vms.txt file from github | |
wget https://gist.github.com/tsmithgc/5223747/raw/cloud-init-vms.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Download the cloud-init-vms.txt file from github | |
wget https://gist.github.com/tsmithgc/5223747/raw/cloud-init-clone.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Delete a VM | |
nova delete vms-test-clone |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Discard a live-image | |
nova live-image-delete vms-test-snapshot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ nova list | |
+--------------------------------------+-------------------+--------+-----------------+ | |
| ID | Name | Status | Networks | | |
+--------------------------------------+-------------------+--------+-----------------+ | |
| a4867099-e979-444c-bafb-6c661eac2278 | vms-test-snapshot | BUILD | | | |
| fac5036a-e899-4251-8c63-979dc0303917 | vms-test-vm | ACTIVE | private=X.X.X.X | | |
+--------------------------------------+-------------------+--------+-----------------+ | |
[...] | |
$ nova list | |
+--------------------------------------+-------------------+---------+-----------------+ | |
| ID | Name | Status | Networks | | |
+--------------------------------------+-------------------+---------+-----------------+ | |
| a4867099-e979-444c-bafb-6c661eac2278 | vms-test-snapshot | BLESSED | | | |
| fac5036a-e899-4251-8c63-979dc0303917 | vms-test-vm | ACTIVE | private=X.X.X.X | | |
+--------------------------------------+-------------------+---------+-----------------+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ssh ubuntu@<IP address> "ls -l /tmp/alive" | |
rw-r--r-- 1 root root 0 Mon DD HH:MM /tmp/alive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ nova list | |
+--------------------------------------+-------------------+---------+-----------------+ | |
| ID | Name | Status | Networks | | |
+--------------------------------------+-------------------+---------+-----------------+ | |
| f42bed03-3baa-4bed-92c9-6a15bbb4bc47 | vms-test-clone | BUILD | private=X.X.X.X | | |
| a4867099-e979-444c-bafb-6c661eac2278 | vms-test-snapshot | BLESSED | | | |
| fac5036a-e899-4251-8c63-979dc0303917 | vms-test-vm | ACTIVE | private=X.X.X.X | | |
+--------------------------------------+-------------------+---------+-----------------+ | |
[...] | |
$ nova list | |
+--------------------------------------+-------------------+---------+-----------------+ | |
| ID | Name | Status | Networks | | |
+--------------------------------------+-------------------+---------+-----------------+ | |
| f42bed03-3baa-4bed-92c9-6a15bbb4bc47 | vms-test-clone | ACTIVE | private=X.X.X.X | | |
| a4867099-e979-444c-bafb-6c661eac2278 | vms-test-snapshot | BLESSED | | | |
| fac5036a-e899-4251-8c63-979dc0303917 | vms-test-vm | ACTIVE | private=X.X.X.X | | |
+--------------------------------------+-------------------+---------+-----------------+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Log into the VM | |
ssh ubuntu@<IP ADDRESS> | |
# Install software, etc | |
# [...] | |
# Create custom post-launch scripts in /etc/gridcentric/clone.d | |
echo "touch /tmp/alive" | sudo tee /etc/gridcentric/clone.d/30_alive | |
sudo chmod +x /etc/gridcentric/clone.d/30_alive | |
# Logout | |
logout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Download the most recent Ubuntu Server 12.04 cloud image | |
wget http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img | |
# Resize it to 30G | |
qemu-img resize precise-server-cloudimg-amd64-disk1.img 30G | |
# Upload it to glance | |
glance add name=precise-server-cloudimg-amd64 is_public=true container_format=bare disk_format=qcow2 < precise-server-cloudimg-amd64-disk1.img | |
# Optional: delete the downloaded image | |
rm precise-server-cloudimg-amd64-disk1.img |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Launch a VM from a live-image | |
# Note: all parameters are optional. | |
# --target is the memory target for the clone | |
# virtual machine, in megabytes, and defaults | |
# to 0 (no memory target) | |
# --user_data defaults to None (no user data) | |
# --security-groups defaults to the security groups | |
# specified in the original VM | |
# --availability_zone defaults to the availability | |
# zone specified in the original VM | |
# --num-instances defaults to 1 | |
# --key-name defaults to the key name specified | |
# in the original VM | |
# --params defaults to None | |
nova live-image-start --live-image vms-test-snapshot vms-test-clone |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Launch a VM from a live-image, using cloud-init for | |
# post-clone reconfiguration. | |
nova live-image-start --live-image vms-test-snapshot --user-data cloud-init-clone.txt vms-test-clone |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Log into the VM | |
$ ssh ubuntu@<IP ADDRESS> | |
[...] | |
# Verify Agent has been installed | |
$ ls /etc/gridcentric/ | |
boot boot.d clone clone.d common |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment