Permalink
Browse files

Use internal mirrors for AMIs

  • Loading branch information...
1 parent fa3a7d1 commit 4d6c33b9064c02df5c266cd342d5a3a74e6d2759 @rail rail committed Nov 7, 2012
Showing with 30 additions and 28 deletions.
  1. +9 −3 aws/aws_create_ami.py
  2. +1 −1 aws/aws_create_puppetmaster.py
  3. +20 −24 aws/centos-6-x86_64-base/etc/yum-local.cfg
View
@@ -16,6 +16,7 @@
"ami": "ami-41d00528", # Any RHEL-6.2 AMI
"instance_type": "c1.xlarge",
"arch": "x86_64",
+ "subnet_id": "subnet-33a98358",
"target": {
"size": 4,
"fs_type": "ext4",
@@ -29,6 +30,7 @@
"ami": "ami-250e5060", # Any RHEL-6.2 AMI
"instance_type": "c1.xlarge",
"arch": "x86_64",
+ "subnet_id": "subnet-59e94330",
"target": {
"size": 4,
"fs_type": "ext4",
@@ -181,6 +183,7 @@ def create_instance(connection, instance_name, config, key_name, user='root'):
instance_type=config['instance_type'],
block_device_map=bdm,
client_token=str(uuid.uuid4())[:16],
+ subnet_id=config['subnet_id'],
)
instance = reservation.instances[0]
@@ -190,7 +193,7 @@ def create_instance(connection, instance_name, config, key_name, user='root'):
try:
instance.update()
if instance.state == 'running':
- env.host_string = instance.public_dns_name
+ env.host_string = instance.private_ip_address
env.user = user
env.abort_on_prompts = True
env.disable_known_hosts = True
@@ -211,7 +214,7 @@ def create_ami(host_instance, options, config):
# TODO: swap?
# TODO: factor status checks
connection = host_instance.connection
- env.host_string = host_instance.public_dns_name
+ env.host_string = host_instance.private_ip_address
env.user = 'root'
env.abort_on_prompts = True
env.disable_known_hosts = True
@@ -235,7 +238,7 @@ def create_ami(host_instance, options, config):
time.sleep(10)
# Step 0: install required packages
- run('yum install -f MAKEDEV')
+ run('yum install -y MAKEDEV || :')
# Step 1: prepare target FS
run('/sbin/mkfs.{fs_type} {dev}'.format(
fs_type=config['target']['fs_type'],
@@ -251,6 +254,8 @@ def create_ami(host_instance, options, config):
% mount_point)
# Step 2: install base system
+ # FIXME: dirty DNS hack
+ run('echo "10.12.51.224 puppet" >> /etc/hosts')
with lcd(target_name):
put('etc/yum-local.cfg', '%s/etc/yum-local.cfg' % mount_point)
put('groupinstall', '/tmp/groupinstall')
@@ -262,6 +267,7 @@ def create_ami(host_instance, options, config):
run('%s clean packages' % yum)
# Step 3: upload custom configuration files
+ run('mkdir %s/boot/grub' % mount_point)
with lcd(target_name):
for f in ('etc/rc.local', 'etc/fstab', 'etc/hosts',
'etc/sysconfig/network',
@@ -149,7 +149,7 @@ def puppetize(instance, name, options):
"repo_snapshot_id": "snap-d31a30ff", # This will be mounted at /data
},
"us-east-1": {
- "ami": "ami-10269d79", # Centos6
+ "ami": "ami-c4e366ad", # Centos6
"subnet_id": "subnet-33a98358",
"security_group_ids": ["sg-b36a84dc"],
"instance_type": "m1.medium",
@@ -11,33 +11,29 @@ assumeyes=1
syslog_ident=yum
syslog_device=
-[base]
-name=CentOS-6 - Base
-mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os
-baseurl=http://mirror.centos.org/centos/6/os/$basearch/
-#released updates
-[updates]
-name=CentOS-6 - Updates
-mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=updates
-baseurl=http://mirror.centos.org/centos/6/updates/$basearch/
+[base]
+name=base
+baseurl=http://puppet/repos/yum/mirrors/centos/6/latest/os/$basearch
+enabled=1
-#additional packages that may be useful
-[extras]
-name=CentOS-6 - Extras
-mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extras
-baseurl=http://mirror.centos.org/centos/6/extras/$basearch/
+[puppet]
+name=puppet
+baseurl=http://puppet/repos/yum/mirrors/puppetlabs/el/6/products/$basearch
+enabled=1
-#additional packages that extend functionality of existing packages
-[centosplus]
-name=CentOS-6 - Plus
-mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=centosplus
-baseurl=http://mirror.centos.org/centos/6/centosplus/$basearch/
+[updates]
+name=updates
+baseurl=http://puppet/repos/yum/mirrors/centos/6/latest/updates/$basearch
enabled=1
-#contrib - packages by Centos Users
-[contrib]
-name=CentOS-6 - Contrib
-mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=contrib
-baseurl=http://mirror.centos.org/centos/6/contrib/$basearch/
+[epel]
+name=epel
+baseurl=http://puppet/repos/yum/mirrors/epel/6/latest/$basearch
enabled=1
+
+[releng-public]
+name=releng-public
+descr=Static "releng-public" repo managed by puppet
+baseurl=http://puppet/repos/yum/releng/public/noarch
+enabled=0

0 comments on commit 4d6c33b

Please sign in to comment.