Skip to content
This repository has been archived by the owner on Jun 5, 2020. It is now read-only.

Commit

Permalink
Use CentOS 6.2 repos instead of 6
Browse files Browse the repository at this point in the history
  • Loading branch information
Rail Aliiev committed Nov 8, 2012
1 parent f5ae11b commit eff4007
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 36 deletions.
54 changes: 25 additions & 29 deletions aws/aws_create_ami.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"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",
Expand All @@ -30,16 +29,15 @@
"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",
"e2_label": "root_dev",
"aws_dev_name": "/dev/sdh",
"int_dev_name": "/dev/xvdl",
"mount_point": "/mnt",
},
}
},
},
},
"centos-6-i386-base": {
"us-east-1": {
Expand All @@ -66,8 +64,8 @@
"aws_dev_name": "/dev/sdh",
"int_dev_name": "/dev/xvdl",
"mount_point": "/mnt",
},
}
},
},
},
"fedora-12-x86_64-desktop": {
"us-east-1": {
Expand All @@ -94,8 +92,8 @@
"aws_dev_name": "/dev/sdh",
"int_dev_name": "/dev/xvdl",
"mount_point": "/mnt",
},
}
},
},
},
"fedora-12-i386-desktop": {
"us-east-1": {
Expand Down Expand Up @@ -124,12 +122,13 @@
"aws_dev_name": "/dev/sdh",
"int_dev_name": "/dev/xvdl",
"mount_point": "/mnt",
},
}
},
},
},
"fedora-17-x86_64-desktop": {
"us-west-1": {
"ami": "ami-877e24c2", # See https://fedoraproject.org/wiki/Cloud_images
# See https://fedoraproject.org/wiki/Cloud_images
"ami": "ami-877e24c2",
"instance_type": "c1.xlarge",
"arch": "x86_64",
"target": {
Expand All @@ -139,10 +138,11 @@
"aws_dev_name": "/dev/sdh",
"int_dev_name": "/dev/xvdh",
"mount_point": "/mnt",
},
},
},
"us-east-1": {
"ami": "ami-a1ef36c8", # See https://fedoraproject.org/wiki/Cloud_images
# See https://fedoraproject.org/wiki/Cloud_images
"ami": "ami-a1ef36c8",
"instance_type": "c1.xlarge",
"arch": "x86_64",
"target": {
Expand All @@ -152,8 +152,8 @@
"aws_dev_name": "/dev/sdh",
"int_dev_name": "/dev/xvdh",
"mount_point": "/mnt",
},
}
},
},
},
}

Expand Down Expand Up @@ -183,7 +183,6 @@ 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]
Expand All @@ -193,7 +192,7 @@ def create_instance(connection, instance_name, config, key_name, user='root'):
try:
instance.update()
if instance.state == 'running':
env.host_string = instance.private_ip_address
env.host_string = instance.public_dns_name
env.user = user
env.abort_on_prompts = True
env.disable_known_hosts = True
Expand All @@ -214,7 +213,7 @@ def create_ami(host_instance, options, config):
# TODO: swap?
# TODO: factor status checks
connection = host_instance.connection
env.host_string = host_instance.private_ip_address
env.host_string = host_instance.public_dns_name
env.user = 'root'
env.abort_on_prompts = True
env.disable_known_hosts = True
Expand All @@ -238,7 +237,7 @@ def create_ami(host_instance, options, config):
time.sleep(10)

# Step 0: install required packages
run('yum install -y MAKEDEV || :')
run('which MAKEDEV >/dev/null || yum install -f MAKEDEV')
# Step 1: prepare target FS
run('/sbin/mkfs.{fs_type} {dev}'.format(
fs_type=config['target']['fs_type'],
Expand All @@ -250,12 +249,9 @@ def create_ami(host_instance, options, config):
run('mkdir {0}/dev {0}/proc {0}/etc'.format(mount_point))
run('mount -t proc proc %s/proc' % mount_point)
run('for i in console null zero ; '
'do /sbin/MAKEDEV -d %s/dev -x $i ; done' \
% mount_point)
'do /sbin/MAKEDEV -d %s/dev -x $i ; done' % 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')
Expand All @@ -267,7 +263,6 @@ 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',
Expand All @@ -286,21 +281,22 @@ def create_ami(host_instance, options, config):
if config.get('kernel_package') == 'kernel-PAE':
run('sed -i s/@VERSION@/`chroot %s rpm -q '
'--queryformat "%%{version}-%%{release}.%%{arch}.PAE" '
'%s | tail -n1`/g %s/boot/grub/grub.conf' % \
'%s | tail -n1`/g %s/boot/grub/grub.conf' %
(mount_point, config.get('kernel_package', 'kernel'), mount_point))
else:
run('sed -i s/@VERSION@/`chroot %s rpm -q '
'--queryformat "%%{version}-%%{release}.%%{arch}" '
'%s | tail -n1`/g %s/boot/grub/grub.conf' % \
'%s | tail -n1`/g %s/boot/grub/grub.conf' %
(mount_point, config.get('kernel_package', 'kernel'), mount_point))
run('echo "UseDNS no" >> %s/etc/ssh/sshd_config' % mount_point)
run('echo "PermitRootLogin without-password" >> %s/etc/ssh/sshd_config' \
% mount_point)
run('echo "PermitRootLogin without-password" >> %s/etc/ssh/sshd_config' %
mount_point)

run('chroot %s chkconfig --level 2345 network on' % mount_point)
run('chroot %s chkconfig --level 2345 rc.local on' % mount_point)
run('chroot %s chkconfig --level 2345 firstboot off || :' % mount_point)
run('chroot %s chkconfig --level 2345 NetworkManager off || :' % mount_point)
run('chroot %s chkconfig --level 2345 NetworkManager off || :' %
mount_point)

run('umount %s/proc' % mount_point)
run('umount %s' % mount_point)
Expand Down
2 changes: 1 addition & 1 deletion aws/aws_create_puppetmaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -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-b6ed68df", # Centos6
"ami": "ami-049b1e6d", # Centos6
"subnet_id": "subnet-33a98358",
"security_group_ids": ["sg-b36a84dc"],
"instance_type": "m1.medium",
Expand Down
31 changes: 25 additions & 6 deletions aws/centos-6-x86_64-base/etc/yum-local.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,33 @@ assumeyes=1
syslog_ident=yum
syslog_device=


[base]
name=base
baseurl=http://puppet/repos/yum/mirrors/centos/6/latest/os/$basearch
enabled=1
name=CentOS-6.2 - Base
mirrorlist=http://mirrorlist.centos.org/?release=6.2&arch=$basearch&repo=os
baseurl=http://vault.centos.org/6.2/os/$basearch/

#released updates
[updates]
name=updates
baseurl=http://puppet/repos/yum/mirrors/centos/6/latest/updates/$basearch
name=CentOS-6.2 - Updates
mirrorlist=http://mirrorlist.centos.org/?release=6.2&arch=$basearch&repo=updates
baseurl=http://vault.centos.org/6.2/updates/$basearch/

#additional packages that may be useful
[extras]
name=CentOS-6.2 - Extras
mirrorlist=http://mirrorlist.centos.org/?release=6.2&arch=$basearch&repo=extras
baseurl=http://vault.centos.org/6.2/extras/$basearch/

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.2 - Plus
mirrorlist=http://mirrorlist.centos.org/?release=6.2&arch=$basearch&repo=centosplus
baseurl=http://vault.centos.org/6.2/centosplus/$basearch/
enabled=1

#contrib - packages by Centos Users
[contrib]
name=CentOS-6.2 - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=6.2&arch=$basearch&repo=contrib
baseurl=http://vault.centos.org/6.2/contrib/$basearch/
enabled=1

0 comments on commit eff4007

Please sign in to comment.