commit 3cbe75283ff2ae1d9d4a4282b665c1318c0a71ce Author: Bryan Kearney Date: Fri Sep 19 08:58:35 2008 -0400 Added the AOS recipe files diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1404853 --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +*~ +INSTALL +Makefile +Makefile.in +aclocal.m4 +autom4te.cache/ +config.h +config.h.in +config.log +config.status +configure +install-sh +missing +ovirt-appliance-*.tar.gz +repos.ks +stamp-h1 +rpm-build diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..112a61f --- /dev/null +++ b/Makefile.am @@ -0,0 +1,40 @@ +# Copyright (C) 2008 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# 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, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +EXTRA_DIST = \ + .gitignore \ + ovirt-appliance.spec \ + release.mk \ + version \ + resources/ovirtbr.xml \ + resources/ovirt-splash.xcf \ + resources/ovirt-splash.xpm.gz \ + appliances/ovirt/ovirt.pp \ + appliances/ovirt/files/collectd.conf \ + appliances/ovirt/files/ovirt-cfgdb \ + appliances/ovirt/files/ovirt.repo \ + appliances/ovirt/files/ovirt-server-appliance \ + appliances/ovirt/templates/ovirt-server-appliance-setup.erb \ + appliances/ovirt/templates/terminal.erb + +include release.mk + +pkg_name = $(PACKAGE_NAME) +.PHONY: tar +tar: dist + mkdir -p rpm-build/BUILDROOT + cp version $(distdir).tar.gz rpm-build diff --git a/README.rdoc b/README.rdoc new file mode 100644 index 0000000..c3e1ff9 --- /dev/null +++ b/README.rdoc @@ -0,0 +1,11 @@ += oVirt Server Appliance Recipe +This example will help to build an oVirt Server Appliance +In order to do this, please do the following: + +A sample kickstart file is provided in the resources directory. To use +this, create a repository holding these new RPMS, and add it to +the kickstart file. You can then do the following assuming that the +appliance creator tool is installed: + +appliance-creator --name ovirt-appliance --config ovirt-appliance.ks +virt-image ovirt-appliance.xml diff --git a/appliances/ovirt/files/collectd.conf b/appliances/ovirt/files/collectd.conf new file mode 100644 index 0000000..0b327de --- /dev/null +++ b/appliances/ovirt/files/collectd.conf @@ -0,0 +1,23 @@ +LoadPlugin network +LoadPlugin logfile +LoadPlugin rrdtool +LoadPlugin unixsock + + + LogLevel info + File STDOUT + + + + Listen "0.0.0.0" + + + + DataDir "/var/lib/collectd/rrd" + CacheTimeout 120 + CacheFlush 900 + + + + SocketFile "/var/lib/collectd/unixsock" + diff --git a/appliances/ovirt/files/ovirt-cfgdb b/appliances/ovirt/files/ovirt-cfgdb new file mode 100644 index 0000000..f0f5744 --- /dev/null +++ b/appliances/ovirt/files/ovirt-cfgdb @@ -0,0 +1,12 @@ +rm /files/etc/sysconfig/network-scripts/ifcfg-eth0 +set /files/etc/sysconfig/network-scripts/ifcfg-eth0/DEVICE eth0 +set /files/etc/sysconfig/network-scripts/ifcfg-eth0/ONBOOT yes +set /files/etc/sysconfig/network-scripts/ifcfg-eth0/BRIDGE ovirtbr0 +rm /files/etc/sysconfig/network-scripts/ifcfg-ovirtbr0 +set /files/etc/sysconfig/network-scripts/ifcfg-ovirtbr0/DEVICE ovirtbr0 +set /files/etc/sysconfig/network-scripts/ifcfg-ovirtbr0/BOOTPROTO dhcp +set /files/etc/sysconfig/network-scripts/ifcfg-ovirtbr0/ONBOOT y +set /files/etc/sysconfig/network-scripts/ifcfg-ovirtbr0/TYPE Bridge +set /files/etc/sysconfig/network-scripts/ifcfg-ovirtbr0/PEERNTP yes +set /files/etc/sysconfig/network-scripts/ifcfg-ovirtbr0/DELAY 0 +save diff --git a/appliances/ovirt/files/ovirt-server-appliance b/appliances/ovirt/files/ovirt-server-appliance new file mode 100644 index 0000000..ff2fddd --- /dev/null +++ b/appliances/ovirt/files/ovirt-server-appliance @@ -0,0 +1,85 @@ +#!/bin/bash +# +# ovirt-server-appliance oVirt Server Appliance service +# +# chkconfig: 3 60 40 +# description: ovirt server appliance service +# + +# Source functions library +. /etc/init.d/functions + +start() { + echo -n "Starting ovirt-server-appliance: " + dnsmasq -i eth1 -F 192.168.50.6,192.168.50.252 \ + -G 00:16:3e:12:34:57,192.168.50.3 -G 00:16:3e:12:34:58,192.168.50.4 \ + -G 00:16:3e:12:34:59,192.168.50.5 \ + -s priv.ovirt.org \ + -W _ovirt._tcp,management.priv.ovirt.org,80 \ + -W _ipa._tcp,management.priv.ovirt.org,80 \ + -W _ldap._tcp,management.priv.ovirt.org,389 \ + -W _collectd._tcp,management.priv.ovirt.org,25826 \ + -W _identify._tcp,management.priv.ovirt.org,12120 \ + --enable-tftp --tftp-root=/var/lib/tftpboot -M pxelinux.0 \ + -O option:router,192.168.50.2 -O option:ntp-server,192.168.50.2 \ + --dhcp-option=12 \ + -R --local /priv.ovirt.org/ --server 192.168.122.1 + + # Set up the fake iscsi target + tgtadm --lld iscsi --op new --mode target --tid 1 \ + -T ovirtpriv:storage + + # + # Now associate them to the LVs + # + tgtadm --lld iscsi --op new --mode logicalunit --tid 1 \ + --lun 1 -b /dev/VolGroup00/iSCSI3 + tgtadm --lld iscsi --op new --mode logicalunit --tid 1 \ + --lun 2 -b /dev/VolGroup00/iSCSI4 + tgtadm --lld iscsi --op new --mode logicalunit --tid 1 \ + --lun 3 -b /dev/VolGroup00/iSCSI5 + + # + # Now make them available + # + tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL + + echo_success + echo +} + +stop() { + echo -n "Stopping ovirt-server-appliance: " + + # stop access to the iscsi target + tgtadm --lld iscsi --op unbind --mode target --tid 1 -I ALL + + # unbind the LUNs + tgtadm --lld iscsi --op delete --mode logicalunit --tid 1 --lun 3 + tgtadm --lld iscsi --op delete --mode logicalunit --tid 1 --lun 2 + tgtadm --lld iscsi --op delete --mode logicalunit --tid 1 --lun 1 + + # shutdown the target + tgtadm --lld iscsi --op delete --mode target --tid 1 + + kill $(cat /var/run/dnsmasq.pid) + + echo_success + echo +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + *) + echo "Usage: ovirt-server-appliance {start|stop|restart}" + exit 2 +esac diff --git a/appliances/ovirt/files/ovirt.repo b/appliances/ovirt/files/ovirt.repo new file mode 100644 index 0000000..fcdb195 --- /dev/null +++ b/appliances/ovirt/files/ovirt.repo @@ -0,0 +1,5 @@ +[ovirt] +name=ovirt +baseurl=http://ovirt.org/repos/ovirt/$releasever/$basearch/ +enabled=1 +gpgcheck=0 diff --git a/appliances/ovirt/ovirt.pp b/appliances/ovirt/ovirt.pp new file mode 100644 index 0000000..6a69a80 --- /dev/null +++ b/appliances/ovirt/ovirt.pp @@ -0,0 +1,131 @@ +#-- +# Copyright (C) 2008 Red Hat Inc. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# Author: Bryan Kearney +#-- + +# +# cobbler thincrust appliance +# + +# Modules used by the appliance +import "appliance_base" +import "banners" +import "firewall" +import "apache" +import "augeas" +import "postgres" + +# Information about our appliance +$appliance_name = "oVirt Server Suite" +$appliance_version = "0.0.1" +$principal = "ovirtadmin" +$realm = "PRIV.OVIRT.ORG" +$password = "ovirt" +$ktab_file = "/usr/share/ovirt-server/ovirtadmin.tab" + +# Configuration +appliance_base::setup{$appliance_name: hostname => "management.priv.ovirt.org"} +banners::terminal{$appliance_name: template_file => "ovirt/terminal.erb"} +banners::login{$appliance_nane:} +postgres::setup{$appliance_name:} +firewall::setup{$appliance_name: status => "disabled"} + +$changes = [ + "set /files/etc/sysconfig/network-scripts/ifcfg-eth0/PEERDNS no", + "set /files/etc/sysconfig/network-scripts/ifcfg-eth1/DNS1 192.168.50.2" +] + +augeas {"network_scripts": + changes => $changes, + notify => Service["network"] +} + +file {"/etc/yum.repos.d/ovirt.repo": + source => "puppet:///ovirt/ovirt.repo" +} + +file {"/etc/collectd.conf": + source => "puppet:///ovirt/collectd.conf" +} + +file {"/var/www/html/ovirt-cfgdb": + source => "puppet:///ovirt/ovirt-cfgdb" +} + + +firewall_rule {"ovirt_nat": + table => "nat", + chain => "POSTROUTING", + out_interface => "eth0", + action => "MASQUERADE" +} + +firewall_rule {"ssh": + table => "filter", + chain => "INPUT", + destination_port => '22', + action => "ACCEPT" +} + +file_replacement{"nat_forwarding" : + file => "/etc/sysctl.conf", + pattern => "^net.ipv4.ip_forward = .*", + replacement => "net.ipv4.ip_forward = 1", + notify => Service[network] +} + +file {"/etc/init.d/ovirt-server-appliance": + source => "puppet:///ovirt/ovirt-server-appliance", + mode => 755 +} + +service {"ovirt-server-appliance": + ensure => "running", + enable => true , + require => [File["/etc/init.d/ovirt-server-appliance"], Service["network"], Service["httpd"]] +} + +file {"/usr/sbin/ovirt-server-appliance-setup": + content => template("ovirt-server-appliance-setup.erb"), + mode => 755 +} + +single_exec {"ovirt_appliance_installation": + command => "/usr/sbin/ovirt-server-appliance-setup >> /var/log/ovirt-server-appliance-setup.log", + require => [File["/usr/sbin/ovirt-server-appliance-setup"], Service["ovirt-server-appliance"], Firewall_rule ["ovirt_nat"], Firewall_rule["ssh"], Exec["reload-firewall"]] +} + +single_exec {"ovirt_installation": + command => "/usr/sbin/ovirt-server-install >> /var/log/ovirt-server-install.log", + require => [Service["postgresql"],Single_exec["ovirt_appliance_installation"]] +} + +# +# Cobbler Configuration +# +firewall_rule{"25150": destination_port => "25150"} +firewall_rule{"25151": destination_port => "25151"} + +# Set the password to be ovirt/ovirt +file_append{"ovirt_cobbler_user": + file => "/etc/cobbler/users.digest", + line => "ovirt:Cobbler:68db208a546dcedf34edf0b4fe0ab1f2", +} + +file {"/etc/vsftpd": ensure => directory} +file {"/etc/vsftpd/vsftpd.conf": ensure => exists} diff --git a/appliances/ovirt/templates/ovirt-server-appliance-setup.erb b/appliances/ovirt/templates/ovirt-server-appliance-setup.erb new file mode 100644 index 0000000..dc4341b --- /dev/null +++ b/appliances/ovirt/templates/ovirt-server-appliance-setup.erb @@ -0,0 +1,32 @@ +#!/bin/bash +export PATH=/usr/kerberos/bin:$PATH +# workaround for https://bugzilla.redhat.com/show_bug.cgi?id=451936 +sed -i '/\[kdcdefaults\]/a \ kdc_ports = 88' /usr/share/ipa/kdc.conf.template +# set up freeipa +ipa-server-install -r PRIV.OVIRT.ORG -p <%= password %>-P <%= password %> -a <%= password %> \ + --hostname management.priv.ovirt.org -u dirsrv -U + +# workaround for https://bugzilla.redhat.com/show_bug.cgi?id=459061 +# note: this has to happen after ipa-server-install or the templating +# feature in ipa-server-install chokes on the characters in the regexp +# we add here. +sed -i -e 's###' \ + /etc/httpd/conf.d/ipa.conf +sed -i -e 's###' /etc/httpd/conf.d/ipa.conf +# workaround for https://bugzilla.redhat.com/show_bug.cgi?id=459209 +sed -i -e 's/^/#/' /etc/httpd/conf.d/ipa-rewrite.conf +service httpd restart + +# now create the ovirtadmin user +echo <%= password %>|kinit admin +# change max username length policy +ldapmodify -h management.priv.ovirt.org -p 389 -Y GSSAPI < <%= principal %> +# make ovitadmin also an IPA admin +ipa-modgroup -a ovirtadmin admins +ipa-moduser --setattr krbPasswordExpiration=19700101000000Z <%= principal %> diff --git a/appliances/ovirt/templates/terminal.erb b/appliances/ovirt/templates/terminal.erb new file mode 100644 index 0000000..f680d2f --- /dev/null +++ b/appliances/ovirt/templates/terminal.erb @@ -0,0 +1,13 @@ + + 888 888 ${g}d8b$n 888 + 888 888 ${g}Y8P$n 888 + 888 888 888 + .d88b. Y88b d88P 888 888d888 888888 + d88''88b Y88b d88P 888 888P' 888 + 888 888 Y88o88P 888 888 888 + Y88..88P Y888P 888 888 Y88b. + 'Y88P' Y8P 888 888 'Y888 + + Server Suite + + Virtualization just got the ${g}Green Light$n diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..0d2c99c --- /dev/null +++ b/autogen.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# Run this to generate configure and Makefile + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +THEDIR=`pwd` +( + cd $srcdir + die=0 + + (autoconf --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have autoconf installed." + echo "Download the appropriate package for your distribution," + echo "or see http://www.gnu.org/software/autoconf" + die=1 + } + + (libtool --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have libtool installed." + echo "Download the appropriate package for your distribution," + echo "or see http://www.gnu.org/software/libtool" + die=1 + } + + (automake --version) < /dev/null > /dev/null 2>&1 || { + echo + die=1 + echo "You must have automake installed." + echo "Download the appropriate package for your distribution," + echo "or see http://www.gnu.org/software/automake" + } + + test $die = 1 && exit 1 + + test -f ovirt-appliance.spec || { + echo "You must run this script in the top-level directory" + exit 1 + } + + if test -z "$*"; then + echo "I am going to run ./configure with no arguments - if you wish " + echo "to pass any to it, please specify them on the $0 command line." + fi + + aclocal + autoheader + automake --add-missing + autoconf + ./configure "$@" +) + +if test "x$OBJ_DIR" != x; then + mkdir -p "$OBJ_DIR" + cd "$OBJ_DIR" +fi diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..3f0fa6e --- /dev/null +++ b/configure.ac @@ -0,0 +1,6 @@ +# note: the version number here is overridden by the one in release.mk +AC_INIT([ovirt-appliance], [0.1], [ovirt-devel@redhat.com]) +AM_INIT_AUTOMAKE([-Wall -Werror foreign]) + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff --git a/ovirt-appliance.spec b/ovirt-appliance.spec new file mode 100644 index 0000000..61b84c4 --- /dev/null +++ b/ovirt-appliance.spec @@ -0,0 +1,64 @@ +%define pbuild %{_builddir}/%{name}-%{version} +%define aceHome /usr/share/ace/appliances/ + +Summary: oVirt Server Appliance Recipe +Name: ovirt-appliance +Source1: version +Version: %(echo `awk '{ print $1 }' %{SOURCE1}`) +Release: %(echo `awk '{ print $2 }' %{SOURCE1}`)%{?dist} + +Group: Applications/Internet +URL: http://www.thincrust.net +License: Fedora +Source0: %{name}-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version} +BuildArch: noarch +Requires: ace-base +Requires: ace-banners +Requires: ace-postgres +Requires: ace-apache +Requires: httpd +Requires: libvirt-python +Requires: openssh-clients +Requires: openssh-server +Requires: nfs-utils +Requires: collectd +Requires: collectd-rrdtool +Requires: ipa-server +Requires: ipa-admintools +Requires: scsi-target-utils +Requires: iscsi-initiator-utils +Requires: ovirt-server +Requires: ovirt-node-image-pxe +Requires: ovirt-release +Requires: rhpl +Requires: cobbler +Requires: rubygem-cobbler +Requires: bind-utils +Requires: augeas +Requires: syslinux +Requires: lokkit +Requires: curl + +%description +Thincrust oVirt Server Appliance Recipe + +%prep +%setup -q + +%install +rm -rf %{buildroot} +%{__mkdir} -p %{buildroot}/%{aceHome} +%{__cp} -R %{pbuild}/appliances/* %{buildroot}/%{aceHome} + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root,-) +%dir %{aceHome} +%{aceHome}/* + +%changelog +* Thu Mar 26 2008 Bryan Kearney 0.0-1 +- Initial packaging diff --git a/release.mk b/release.mk new file mode 100644 index 0000000..76dfa51 --- /dev/null +++ b/release.mk @@ -0,0 +1,55 @@ +# Release/version-related Makefile variables and rules. +# It expects the including Makefile to define the "pkg_name" +# variable, as well as a file named "version" in the current directory. + +srcdir ?= . +ARCH = $(shell uname -i) +VERSION = $(shell awk '{ print $$1 }' $(srcdir)/version) +RELEASE = $(shell awk '{ print $$2 }' $(srcdir)/version) +NEWVERSION = $$(awk 'BEGIN { printf "%.2f", $(VERSION) + .01 }') +NEWRELEASE = $$(($(RELEASE) + 1)) +X = $$(awk '{ split($$2,r,"."); \ + printf("%d.%d\n", r[1], r[2]+1) }' $(srcdir)/version) +git_head = $$(git log -1 --pretty=format:%h) +GITRELEASE = $(X).$$(date --utc +%Y%m%d%H%M)git$(git_head) +DIST = $$(rpm --eval '%{dist}') + +SPEC_FILE = $(pkg_name).spec + +OVIRT_CACHE_DIR ?= $(HOME)/ovirt-cache + +NV = $(pkg_name)-$(VERSION) +RPM_FLAGS = \ + --define "_topdir %(pwd)/rpm-build" \ + --define "_builddir %{_topdir}" \ + --define "_rpmdir %{_topdir}" \ + --define "_srcrpmdir %{_topdir}" \ + --define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \ + --define "_specdir %{_topdir}" \ + --define "_sourcedir %{_topdir}" \ + --define "ovirt_cache_dir $(OVIRT_CACHE_DIR)" + +bumpgit: + echo "$(VERSION) $(GITRELEASE)" > version + +bumprelease: + echo "$(VERSION) $(NEWRELEASE)" > version + +bumpversion: + echo "$(NEWVERSION) 1" > version + +setversion: + echo "$(VERSION) $(RELEASE)" > version + +new-rpms: bumprelease rpms + +rpms: tar + rpmbuild $(RPM_FLAGS) -ba $(SPEC_FILE) + +publish: rpms + rm -f $(OVIRT_CACHE_DIR)/ovirt/$(pkg_name)* + mkdir -p $(OVIRT_CACHE_DIR)/ovirt + cp -a rpm-build/$(pkg_name)*.rpm $(OVIRT_CACHE_DIR)/ovirt + createrepo $(OVIRT_CACHE_DIR)/ovirt + +.PHONY: rpms new-rpms publish setversion bumprelease bumpversion bumpgit diff --git a/resources/ovirt-splash.xcf b/resources/ovirt-splash.xcf new file mode 100644 index 0000000..cc9e993 Binary files /dev/null and b/resources/ovirt-splash.xcf differ diff --git a/resources/ovirt-splash.xpm.gz b/resources/ovirt-splash.xpm.gz new file mode 100644 index 0000000..8cd25b8 Binary files /dev/null and b/resources/ovirt-splash.xpm.gz differ diff --git a/resources/ovirtbr.xml b/resources/ovirtbr.xml new file mode 100644 index 0000000..9bce127 --- /dev/null +++ b/resources/ovirtbr.xml @@ -0,0 +1,7 @@ + + ovirtbr + + + + + diff --git a/version b/version new file mode 100644 index 0000000..e8d782e --- /dev/null +++ b/version @@ -0,0 +1 @@ +0.92 2