summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2015-12-13 15:06:54 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2015-12-13 15:06:54 +0100
commitbd716eb2737a7bb9de4a595319fa37efddd1b58d (patch)
treeaf59955c862a8bace8672bad5167d9ed138c9d1b
parentccd4d0bb0f603e3e7ccbdc476c963c7b24e687e4 (diff)
downloadbiruda-bd716eb2737a7bb9de4a595319fa37efddd1b58d.tar.gz
biruda-bd716eb2737a7bb9de4a595319fa37efddd1b58d.tar.bz2
added old centos auto project (unsorted)
-rw-r--r--unsorted/centosauto/HOWTO.AddLVM6
-rw-r--r--unsorted/centosauto/LINKS15
-rw-r--r--unsorted/centosauto/README40
-rwxr-xr-xunsorted/centosauto/sync_centos.sh17
-rw-r--r--unsorted/centosauto/tftproot/README2
-rw-r--r--unsorted/centosauto/tftproot/images/centos/6.5/i386/README1
-rw-r--r--unsorted/centosauto/tftproot/images/centos/6.5/x86_64/README1
-rw-r--r--unsorted/centosauto/tftproot/pxelinux.cfg/01-52-54-00-12-34-5616
-rw-r--r--unsorted/centosauto/tftproot/pxelinux.cfg/default16
-rw-r--r--unsorted/centosauto/var/www/html/CentOS-Base.repo52
-rw-r--r--unsorted/centosauto/var/www/html/cfengine/failsafe.cf22
-rw-r--r--unsorted/centosauto/var/www/html/cfengine/update.cf132
-rw-r--r--unsorted/centosauto/var/www/html/kickstart.cfg55
13 files changed, 375 insertions, 0 deletions
diff --git a/unsorted/centosauto/HOWTO.AddLVM b/unsorted/centosauto/HOWTO.AddLVM
new file mode 100644
index 0000000..a2cbc24
--- /dev/null
+++ b/unsorted/centosauto/HOWTO.AddLVM
@@ -0,0 +1,6 @@
+vgdisplay
+pvdisplay
+pvcreate /dev/sdb
+vgextend vg_centos62 /dev/sdb
+lvextend -L+7999M /dev/vg_centos62/lv_root
+resize2fs /dev/vg_centos62/lv_root
diff --git a/unsorted/centosauto/LINKS b/unsorted/centosauto/LINKS
new file mode 100644
index 0000000..0c25539
--- /dev/null
+++ b/unsorted/centosauto/LINKS
@@ -0,0 +1,15 @@
+QEMU
+- http://qemu-buch.de/de/index.php/QEMU-KVM-Buch/_Netzwerkoptionen/_Netzwerkdienste
+PXE
+- https://wiki.archlinux.de/title/Preboot_eXecution_Environment
+- http://www.darryl.cain.com.au/pxe/pxe.php
+- http://www.linuxjournal.com/magazine/pxe-magic-flexible-network-booting-menus?page=0,1
+Redhat Kickstart
+- http://www.centos.org/docs/2/rhl-cg-en-7.2/s1-kickstart2-options.html
+- http://wiki.centos.org/TipsAndTricks/KickStart
+- http://fedoraproject.org/wiki/Anaconda/Kickstart
+- http://wiki.centos.org/HowTos/CreateLocalMirror
+- https://nazar.karan.org/cgit/bluecain/tree/
+- http://blog.mozilla.com/jv/2011/01/31/redirecting-kickstart-prepost-over-serial-console/
+Other Projects
+- https://github.com/fubralimited/CentOS-KVM-Image-Tools
diff --git a/unsorted/centosauto/README b/unsorted/centosauto/README
new file mode 100644
index 0000000..e3bbb24
--- /dev/null
+++ b/unsorted/centosauto/README
@@ -0,0 +1,40 @@
+cp /usr/lib/syslinux/bios/pxelinux.0 $PWD/tftproot
+cp /usr/lib/syslinux/bios/menu.c32 $PWD/tftproot
+cp /usr/lib/syslinux/bios/memdisk $PWD/tftproot
+cp /usr/lib/syslinux/bios/mboot.c32 $PWD/tftproot
+cp /usr/lib/syslinux/bios/chain.c32 $PWD/tftproot
+cp /usr/lib/syslinux/bios/libutil.c32 $PWD/tftproot
+cp /usr/lib/syslinux/bios/ldlinux.c32 $PWD/tftproot
+mkdir $PWD/tftproot/pxelinux.cfg
+
+cp -av var/www/html/* /var/www/html/.
+
+mkdir -p /var/www/html/Centos/6.5/
+
+wget -O tftproot/images/centos/6.5/x86_64/vmlinuz \
+ http://mirror.switch.ch/ftp/mirror/centos/6.5/os/x86_64/images/pxeboot/vmlinuz
+wget -O tftproot/images/centos/6.5/x86_64/initrd.img \
+ http://mirror.switch.ch/ftp/mirror/centos/6.5/os/x86_64/images/pxeboot/initrd.img
+
+qemu-img create centos6.img 1G
+
+qemu-system-x86_64 -hda centos6.img -net nic \
+ -net user,tftp=$PWD/tftproot,bootfile=pxelinux.0 -m 1024 \
+ -machine accel=kvm -redir tcp:2222::22 \
+ -nographic
+
+# -display curses
+#local mirror of Centos files (HTTP):
+wget 'http://mirror.switch.ch/ftp/mirror/centos/6.5/isos/x86_64/CentOS-6.5-x86_64-bin-DVD1.iso'
+wget 'http://mirror.switch.ch/ftp/mirror/centos/6.5/isos/x86_64/CentOS-6.5-x86_64-bin-DVD2.iso'
+mount -ro loop CentOS-6.5-x86_64-bin-DVD1.iso /mnt
+mkdir -p var/www/html/Centos/6.5/{os,updates,extras,centosplus,contrib}/x86_64
+rsync -avHPS /mnt/* var/www/html/Centos/6.5/os/x86_64/
+umount /mnt
+mount -ro loop CentOS-6.5-x86_64-bin-DVD2.iso /mnt
+rsync -avHPS /mnt/* var/www/html/Centos/6.5/os/x86_64/
+umount /mnt
+ln -s 6.5 var/www/html/Centos/6
+./sync_centos.sh
+
+copy cfengine rpms to /var/www/html/cfengine
diff --git a/unsorted/centosauto/sync_centos.sh b/unsorted/centosauto/sync_centos.sh
new file mode 100755
index 0000000..f42c76a
--- /dev/null
+++ b/unsorted/centosauto/sync_centos.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+if [ -f /var/lock/subsys/rsync_updates ]; then
+ echo "Updates via rsync already running."
+ exit 0
+fi
+# i386
+if [ -d /var/www/html/Centos/6.5 ] ; then
+ touch /var/lock/subsys/rsync_updates
+ for a in x86_64; do
+ for i in os updates extras centosplus contrib; do
+ rsync -avSHP --delete --exclude "local*" --exclude "isos" centos.intergenia.de::centos-linux/6.5/$i/$a/ /var/www/html/Centos/6.5/$i/$a/
+ done
+ done
+ /bin/rm -f /var/lock/subsys/rsync_updates
+else
+ echo "Target directory /var/www/html/Centos/6.5 not present."
+fi
diff --git a/unsorted/centosauto/tftproot/README b/unsorted/centosauto/tftproot/README
new file mode 100644
index 0000000..adf0c7a
--- /dev/null
+++ b/unsorted/centosauto/tftproot/README
@@ -0,0 +1,2 @@
+menu.c32
+pxelinux.0
diff --git a/unsorted/centosauto/tftproot/images/centos/6.5/i386/README b/unsorted/centosauto/tftproot/images/centos/6.5/i386/README
new file mode 100644
index 0000000..12f6040
--- /dev/null
+++ b/unsorted/centosauto/tftproot/images/centos/6.5/i386/README
@@ -0,0 +1 @@
+PXE boot image i386
diff --git a/unsorted/centosauto/tftproot/images/centos/6.5/x86_64/README b/unsorted/centosauto/tftproot/images/centos/6.5/x86_64/README
new file mode 100644
index 0000000..566e206
--- /dev/null
+++ b/unsorted/centosauto/tftproot/images/centos/6.5/x86_64/README
@@ -0,0 +1 @@
+PXE boot image x86_64
diff --git a/unsorted/centosauto/tftproot/pxelinux.cfg/01-52-54-00-12-34-56 b/unsorted/centosauto/tftproot/pxelinux.cfg/01-52-54-00-12-34-56
new file mode 100644
index 0000000..f8260d8
--- /dev/null
+++ b/unsorted/centosauto/tftproot/pxelinux.cfg/01-52-54-00-12-34-56
@@ -0,0 +1,16 @@
+SAY Cfengine automatic installation..
+
+DEFAULT menu.c32
+SERIAL 0 9600 0x303
+TIMEOUT 20
+PROMPT 1
+
+LABEL Centos 6.5 x86_64
+ MENU LABEL Centos 6.5 64-bit
+ KERNEL images/centos/6.5/x86_64/vmlinuz
+ APPEND initrd=images/centos/6.5/x86_64/initrd.img ksdevice=eth0 ks=http://192.168.1.12/kickstart.cfg console=ttyS0,9600n81
+
+LABEL Centos 6.5 i386
+ MENU LABEL Centos 6.5 32-bit
+ KERNEL images/centos/6.5/i386/vmlinuz
+ APPEND initrd=images/centos/6.5/i386/initrd.img ksdevice=eth0 ks=http://192.168.1.12/kickstart.cff console=ttyS0,9600n81
diff --git a/unsorted/centosauto/tftproot/pxelinux.cfg/default b/unsorted/centosauto/tftproot/pxelinux.cfg/default
new file mode 100644
index 0000000..878c47e
--- /dev/null
+++ b/unsorted/centosauto/tftproot/pxelinux.cfg/default
@@ -0,0 +1,16 @@
+SAY Cfengine automatic installation..
+
+DEFAULT menu.c32
+SERIAL 0 9600 0x303
+TIMEOUT 20
+PROMPT 1
+
+LABEL Centos 6.4 x86_64
+ MENU LABEL Centos 6.4 64-bit
+ KERNEL images/centos/6.4/x86_64/vmlinuz
+ APPEND initrd=images/centos/6.4/x86_64/initrd.img ksdevice=eth0 ks=http://192.168.1.12/kickstart.cfg console=ttyS0,9600n81
+
+LABEL Centos 6.4 i386
+ MENU LABEL Centos 6.4 32-bit
+ KERNEL images/centos/6.4/i386/vmlinuz
+ APPEND initrd=images/centos/6.4/i386/initrd.img ksdevice=eth0 ks=http://192.168.1.12/kickstart.cff console=ttyS0,9600n81
diff --git a/unsorted/centosauto/var/www/html/CentOS-Base.repo b/unsorted/centosauto/var/www/html/CentOS-Base.repo
new file mode 100644
index 0000000..ba4018a
--- /dev/null
+++ b/unsorted/centosauto/var/www/html/CentOS-Base.repo
@@ -0,0 +1,52 @@
+# CentOS-Base.repo
+#
+# The mirror system uses the connecting IP address of the client and the
+# update status of each mirror to pick mirrors that are updated to and
+# geographically close to the client. You should use this for CentOS updates
+# unless you are manually picking other mirrors.
+#
+# If the baseurl= does not work for you, as a fall back you can try the
+# remarked out baseurl= line instead.
+#
+#
+
+[base]
+name=CentOS-$releasever - Base
+baseurl=http://192.168.1.12/Centos/$releasever/os/$basearch/
+#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+
+#released updates
+[updates]
+name=CentOS-$releasever - Updates
+baseurl=http://192.168.1.12/Centos/$releasever/updates/$basearch/
+#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+
+#additional packages that may be useful
+[extras]
+name=CentOS-$releasever - Extras
+baseurl=http://192.168.1.12/Centos/$releasever/extras/$basearch/
+#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+
+#additional packages that extend functionality of existing packages
+[centosplus]
+name=CentOS-$releasever - Plus
+baseurl=http://192.168.1.12/Centos/$releasever/centosplus/$basearch/
+#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
+gpgcheck=1
+enabled=0
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+
+#contrib - packages by Centos Users
+[contrib]
+name=CentOS-$releasever - Contrib
+baseurl=http://192.168.1.12/Centos/$releasever/contrib/$basearch
+#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
+gpgcheck=1
+enabled=0
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
diff --git a/unsorted/centosauto/var/www/html/cfengine/failsafe.cf b/unsorted/centosauto/var/www/html/cfengine/failsafe.cf
new file mode 100644
index 0000000..52215b9
--- /dev/null
+++ b/unsorted/centosauto/var/www/html/cfengine/failsafe.cf
@@ -0,0 +1,22 @@
+# failsafe file, do not change!
+
+body common control
+{
+ bundlesequence => { "update" };
+
+ inputs => { "update.cf" };
+}
+
+############################################
+
+body depth_search recurse(d)
+{
+ depth => "$(d)";
+}
+
+body depth_search recurse_ignore(d,list)
+{
+ depth => "$(d)";
+ exclude_dirs => { @(list) };
+}
+
diff --git a/unsorted/centosauto/var/www/html/cfengine/update.cf b/unsorted/centosauto/var/www/html/cfengine/update.cf
new file mode 100644
index 0000000..039636c
--- /dev/null
+++ b/unsorted/centosauto/var/www/html/cfengine/update.cf
@@ -0,0 +1,132 @@
+# update promises
+
+bundle agent update
+{
+ vars:
+
+ any::
+
+ "master_server" string => "phost1.eurospider.com";
+
+ "master_location" string => "/var/cfengine/masterfiles";
+
+ "ignore_list" slist => { "\.svn", ".*~" };
+
+ redhat|freebsd::
+
+ "inputs_location" string => "$(sys.workdir)/inputs/.";
+
+ debian::
+
+ "inputs_location" string => "/etc/cfengine3/.";
+
+ files:
+
+ any::
+
+ "$(sys.workdir)/."
+
+ create => "true",
+ perms => u_p( "0700" ),
+ action => uimmediate;
+
+ redhat|freebsd::
+
+ "$(sys.workdir)/bin/."
+
+ create => "true",
+ perms => u_p( "0700" ),
+ action => uimmediate;
+
+ debian::
+
+ "$(sys.workdir)/bin/."
+
+ link_from => u_ln_s( "/usr/sbin" ),
+ action => uimmediate;
+
+ any::
+
+ "$(sys.workdir)/ppkeys/."
+
+ perms => u_p( "0700" ),
+ action => uimmediate;
+
+ redhat|freebsd::
+
+ "$(sys.workdir)/bin"
+
+ comment => "copy binaries from RPM location",
+ perms => u_p( "700" ),
+ copy_from => mycopy( "/usr/local/sbin", "localhost" ),
+ depth_search => recurse( "inf" ),
+ action => uimmediate;
+
+ bunsen::
+
+ "$(inputs_location)"
+
+ comment => "copy from local masterfiles on master policy server",
+ perms => u_p( "600" ),
+ copy_from => mycopy("$(master_location)","localhost"),
+ depth_search => recurse_ignore( "inf", "$(ignore_list)" ),
+ action => uimmediate;
+
+ !bunsen::
+
+ "$(inputs_location)"
+
+ comment => "all others fetch the promises from the policy master (also the slave)",
+ perms => u_p( "600" ),
+ copy_from => remote_copy( "$(master_location)", "$(master_server)" ),
+ depth_search => recurse_ignore( "inf", "$(ignore_list)" ),
+ action => uimmediate;
+
+ commands:
+
+ bunsen::
+
+ "/bin/sh -c 'cd $(master_location) && svn up >/dev/null 2>&1'"
+
+ comment => "update the master policy files from SVN";
+}
+
+# self-contained functions, must work even if libaries have bugs
+
+# Set permissions
+body perms u_p( p )
+{
+ mode => "$(p)";
+}
+
+# Basic copy function (for local file copies)
+body copy_from mycopy( from, server )
+{
+ source => "$(from)";
+ compare => "digest";
+}
+
+# Remote copy function, secure
+body copy_from remote_copy( sourcedir, sourceserver )
+{
+ source => "$(sourcedir)";
+ servers => { "$(sourceserver)" };
+ compare => "digest";
+ encrypt => "true";
+ verify => "true";
+ trustkey => "true";
+ preserve => "true";
+}
+
+# Copy if at least 1 minute has elapsed
+body action uimmediate
+{
+ ifelapsed => "1";
+}
+
+body link_from u_ln_s(x)
+{
+ link_type => "symlink";
+ source => "$(x)";
+ when_no_source => "force";
+}
diff --git a/unsorted/centosauto/var/www/html/kickstart.cfg b/unsorted/centosauto/var/www/html/kickstart.cfg
new file mode 100644
index 0000000..5f39f02
--- /dev/null
+++ b/unsorted/centosauto/var/www/html/kickstart.cfg
@@ -0,0 +1,55 @@
+# Kickstart file automatically generated by anaconda.
+
+#version=DEVEL
+install
+url --url=http://192.168.1.12/Centos/6.5/os/x86_64
+lang en_US.UTF-8
+keyboard us
+network --onboot yes --device eth0 --bootproto dhcp --noipv6
+rootpw --iscrypted $6$M0aOpoXkLRTRzKcS$RPTbAk5YjUZR/JO1ClO9BWZU4KNkXXGOO/9yu2lrHMsfjgehv1Sg02dvhLQ3OzLBfIGggcZ7.2JRle4TJbdAU/
+firewall --service=ssh --port=5308:tcp
+authconfig --enableshadow --passalgo=sha512
+selinux --enforcing
+timezone --utc Europe/Zurich
+bootloader --location=mbr --driveorder=sda --append=" rhgb crashkernel=auto console=ttyS0,9600n81"
+
+zerombr
+clearpart --all --drives=sda --initlabel
+
+part / --label=ROOT --fstype=ext4 --size=1000
+part swap --label=SWAP --size=12
+#part /data --label=DATA --size=1012 --grow
+
+skipx
+cmdline
+
+repo --name="CentOS" --baseurl=http://192.168.1.12/Centos/6.5/os/x86_64 --cost=100
+
+reboot
+
+%packages --excludedocs --nobase
+@core
+wget
+%end
+
+%post
+exec < /dev/console > /dev/console
+#!/bin/bash
+cd /root
+wget -O /etc/yum.repos.d/CentOS-Base.repo http://192.168.1.12/CentOS-Base.repo
+rpm --import /etc/pki/rpm-gpg/*
+yum clean all
+yum update -y
+
+#mkdir /root/cfengine
+#cd /root/cfengine
+#wget -nd -r http://192.168.1.12/cfengine/{cfengine-community-3.5.1-3.x86_64.rpm,{failsafe,update}.cf}
+#yum localinstall -y cfengine-community-3.5.1-3.x86_64.rpm
+#cp -v {failsafe,update}.cf /var/cfengine/inputs/.
+#cd /root
+
+#/usr/local/sbin/cf-agent -B 192.168.1.12
+
+#/usr/local/sbin/cf-agent
+
+%end