diff options
-rw-r--r-- | ec2init/ec2config.py | 92 | ||||
-rw-r--r-- | upstart/ec2-apt-update.conf | 13 | ||||
-rw-r--r-- | upstart/ec2-ebs-mounts.conf | 12 | ||||
-rw-r--r-- | upstart/ec2-preconf-ssh-keys.conf | 13 | ||||
-rw-r--r-- | upstart/ec2-raid.conf | 12 | ||||
-rw-r--r-- | upstart/ec2-runurl.conf | 13 | ||||
-rw-r--r-- | upstart/ec2-update-software.conf | 12 |
7 files changed, 167 insertions, 0 deletions
diff --git a/ec2init/ec2config.py b/ec2init/ec2config.py new file mode 100644 index 00000000..23ab5ac3 --- /dev/null +++ b/ec2init/ec2config.py @@ -0,0 +1,92 @@ +# +# Common code for the EC2 configuration files in Ubuntu +# Copyright (C) 2008-2010 Canonical Ltd. +# +# Author: Chuck Short <chuck.short@canonical.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 3, as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +import yaml +import re + +class EC2Config(): + def read_conf(self, ec2Config): + #stream = file('/tmp/ec2.yaml') + ec2Config = yaml.load(stream) + stream.close() + return ec2Config + + def check_for_updates(self): + #stream = file('/tmp/ec2.yaml') + ec2Config = yaml.load(stream) + stream.close() + + value = ec2Config['apt_update'] + return value + + def check_for_upgrade(self): + #stream = file('/tmp/ec2.yaml') + ec2Config = yaml.load(stream) + stream.close() + + value = ec2Config['apt_upgrade'] + return value + + def parse_ssh_keys(self): + #stream = file('/tmp/ec2.yaml') + ec2Config = yaml.load(stream) + stream.close() + + disableRoot = ec2Config['disable_root'] + if disableRoot == 'true': + value = 'disabled_root' + return value + else: + ec2Key = ec2Config['ec2_fetch_key'] + if ec2Key != 'none': + value = 'default_key' + return value + else: + return ec2Key + + def add_ppa(self): + stream = file('/tmp/ec2.yaml') + ec2Config = yaml.load(stream) + stream.close() + + value = ec2Config['apt_sources'] + for ent in ec2Config['apt_sources']: + ppa = ent['source'] + where = ppa.find('ppa:') + if where != -1: + return ppa + + def add_custom_repo(self): + stream = file('/tmp/ec2.yaml') + ec2Config = yaml.load(stream) + stream.close() + + sources = [] + value = ec2Config['apt_sources'] + for ent in ec2Config['apt_sources']: + if ent.has_key('keyserver'): + keyserver = ent['keyserver'] + if ent.has_key('keyid'): + keyid = ent['keyid'] + if ent.has_key('filename'): + filename = ent['filename'] + source = ent['source'] + if source.startswith("deb"): + sources.append(source) + + return (keyserver,sources,keyid,filename) diff --git a/upstart/ec2-apt-update.conf b/upstart/ec2-apt-update.conf new file mode 100644 index 00000000..b280801b --- /dev/null +++ b/upstart/ec2-apt-update.conf @@ -0,0 +1,13 @@ +# ec2-apt-update - Update archive at boot time +# +# Update archive at boot + +description "Update archive at boot" + +start on (cloud-config + and local-filesystems + and net-device-up IFACE=eth0) +console output +task +# exec /usr/sbin/cloud-init-run --once ec2-apt-update ec2-apt-update +exec /usr/sbin/ec2-apt-update diff --git a/upstart/ec2-ebs-mounts.conf b/upstart/ec2-ebs-mounts.conf new file mode 100644 index 00000000..a1457f6a --- /dev/null +++ b/upstart/ec2-ebs-mounts.conf @@ -0,0 +1,12 @@ +# ec2-ebs-mounts +# +# Mount EC2 EBS mount points + +description "Populate EBS mountpoints" + +start on cloud-config + +console output +task + +exec /usr/sbin/ec2-ebs-mount diff --git a/upstart/ec2-preconf-ssh-keys.conf b/upstart/ec2-preconf-ssh-keys.conf new file mode 100644 index 00000000..383b5bbc --- /dev/null +++ b/upstart/ec2-preconf-ssh-keys.conf @@ -0,0 +1,13 @@ +# ec2-preconf-ssh-keys +# +# Download preconfigured ssh-keys for EC2. + +description "Download preconfigured ssh keys" + +start on (cloud-config + and local-filesystem + and net-device-ifup IFACE=eth0) +console out +task + +exec /usr/sbin/ec2-preconf-ssh-keys diff --git a/upstart/ec2-raid.conf b/upstart/ec2-raid.conf new file mode 100644 index 00000000..e4364373 --- /dev/null +++ b/upstart/ec2-raid.conf @@ -0,0 +1,12 @@ +# ec2-raid - Setup ephemeral storage RAID and mount points +# +# Setup ephemeral storage RAID and mount points + +description "Setup RAID storage and moint points" + +start on (cloud-config + and local-filesystem) +console output +task + +exec /usr/sbin/ec2-setup-raid diff --git a/upstart/ec2-runurl.conf b/upstart/ec2-runurl.conf new file mode 100644 index 00000000..28249f8d --- /dev/null +++ b/upstart/ec2-runurl.conf @@ -0,0 +1,13 @@ +# ec2-runurl - Run runurl at boot +# +# Runurl at boot + +description "Run runurl" + +start on (cloud-config + and local-filesystem + and net-device-ifup IFACE=eth0) +console output +task + +exec /usr/sbin/ec2-runurl diff --git a/upstart/ec2-update-software.conf b/upstart/ec2-update-software.conf new file mode 100644 index 00000000..ee3131d1 --- /dev/null +++ b/upstart/ec2-update-software.conf @@ -0,0 +1,12 @@ +# ec2-software-update - Update software at boot +# +# Update software at boot + +description "Update software at boot" + +start on (cloud-config + and local-filesystem + and net-device-iup IFACE=eth0) +console output + +exec /usr/sbin/ec2-update-software |