[Ovirt-devel] [PATCH server] Tweaked the install file to change the ovirt password to ovirt, uncomments dnsmag config directory, extend the dns config, and run cobbler import. All per perry's comments

Bryan Kearney bkearney at redhat.com
Mon Feb 2 22:25:23 UTC 2009


THis is a resend of the earlier ptch. It needs to be applied on top of perrys path stream for the installer. In addition to the subject, it breaks out the cobbler import into an appliance and non-appliance portion.

-- bk

---
 .../appliances/ovirt-appliance/ovirt-appliance.pp  |   18 ++++-
 installer/modules/ovirt/files/cobbler-import       |   81 ++++++++++++++++++++
 .../modules/ovirt/files/cobbler-import-appliance   |   55 +++++++++++++
 .../modules/ovirt/files/cobbler-import-generic     |   23 ++++++
 installer/modules/ovirt/manifests/cobbler.pp       |   12 +++
 installer/modules/ovirt/manifests/dns.pp           |   18 +++--
 installer/modules/ovirt/manifests/ovirt.pp         |    4 +
 7 files changed, 199 insertions(+), 12 deletions(-)
 create mode 100644 installer/modules/ovirt/files/cobbler-import
 create mode 100644 installer/modules/ovirt/files/cobbler-import-appliance
 create mode 100644 installer/modules/ovirt/files/cobbler-import-generic

diff --git a/installer/appliances/ovirt-appliance/ovirt-appliance.pp b/installer/appliances/ovirt-appliance/ovirt-appliance.pp
index 4a7908b..9234d4f 100644
--- a/installer/appliances/ovirt-appliance/ovirt-appliance.pp
+++ b/installer/appliances/ovirt-appliance/ovirt-appliance.pp
@@ -13,12 +13,12 @@ $ipa_host = 'management.priv.ovirt.org'
 dns::bundled{setup: mgmt_ipaddr=> $mgmt_ipaddr, prov_ipaddr=> $prov_ipaddr, mgmt_dev => 'eth0', prov_dev => 'eth1'}
 
 # dhcp configuration
-$dhcp_interface = 'eth1'
+$dhcp_interface = 'eth0'
 $dhcp_network = '192.168.50'
 $dhcp_start = '3'
-$dhcp_stop = '10'
+$dhcp_stop = '50'
 $dhcp_domain = 'priv.ovirt.org'
-$ntp_server = '192.168.222.211'
+$ntp_server =  $mgmt_ipaddr
 
 $prov_dns_server = ''
 $prov_network_gateway = '192.168.50.1'
@@ -33,7 +33,7 @@ $db_password = 'cobbler'
 
 # FreeIPA configuration
 $realm_name = 'priv.ovirt.org'
-$freeipa_password = 'password'
+$freeipa_password = 'ovirt'
 $ldap_dn = 'cn=ipaConfig,cn=etc,dc=priv,dc=ovirt,dc=org'
 
 include cobbler::bundled
@@ -42,3 +42,13 @@ include tftp::bundled
 include postgres::bundled
 include freeipa::bundled
 include ovirt::setup
+
+file {"/usr/sbin/cobbler-import-appliance":
+      source => "puppet:///ovirt/cobbler-import-appliance",
+      mode => 755
+}
+
+single_exec {"cobbler-import-appliance":
+    command => "/usr/sbin/cobbler-import-appliance >> /var/log/cobbler-import-appliance.log 2>&1",
+    require => [File["/usr/sbin/cobbler-import-appliance"], Service["cobblerd"], Single_Exec["cobbler-import"]]
+}
diff --git a/installer/modules/ovirt/files/cobbler-import b/installer/modules/ovirt/files/cobbler-import
new file mode 100644
index 0000000..d516c68
--- /dev/null
+++ b/installer/modules/ovirt/files/cobbler-import
@@ -0,0 +1,81 @@
+#!/bin/sh
+
+# Import Cobbler profiles on first boot
+
+url=http://download.fedora.redhat.com/pub/fedora/linux
+ksdir=/var/www/cobbler/ks_mirror
+rawhide=11
+
+set -x
+set -e
+for dir in $ksdir/* ; do
+    ova=$dir/.treeinfo.ova
+    if [ ! -f $ova ]; then
+        echo "Skipping $dir, no $ova file present"
+        continue
+    fi
+
+    os=$(awk '{print $1}' $ova)
+    ver=$(awk '{print $2}' $ova)
+    arch=$(awk '{print $3}' $ova)
+
+    cobbler import --name=$os-$ver --arch=$arch --path=$dir
+
+    sed -e 's#^reboot.*#poweroff#' /var/lib/cobbler/kickstarts/sample_end.ks \
+        > /var/lib/cobbler/kickstarts/sample-$os-$ver-$arch.ks
+
+    if [[ "$ver" =~ "$rawhide" ]]; then
+        cobbler repo add --name=f$ver-$arch --arch=$arch --mirror-locally=0 \
+            --mirror=$url/development/$arch/os
+        repos=""
+    else
+        cobbler repo add --name=f$ver-$arch --arch=$arch --mirror-locally=0 \
+            --mirror=$url/releases/$ver/Everything/$arch/os
+        cobbler repo add --name=f$ver-$arch-updates --arch=$arch --mirror-locally=0 \
+            --mirror=$url/updates/$ver/$arch.newkey
+        repos="f$ver-$arch f$ver-$arch-updates"
+    fi
+
+    cobbler profile edit --name=$os-$ver-$arch \
+        --repos="$repos" \
+        --kickstart=/var/lib/cobbler/kickstarts/sample-$os-$ver-$arch.ks
+done
+
+node_arch=$(rpm -q --qf "%{arch}" ovirt-node-image)
+node_dir=/usr/share/ovirt-node-image
+
+# Create PXE images from oVirt ISO
+pushd $node_dir
+ovirt-pxe ovirt-node-image.iso
+popd
+
+cobbler distro add --name="oVirt-Node-$node_arch" --arch=$node_arch \
+    --initrd=$node_dir/tftpboot/initrd0.img --kernel=$node_dir/tftpboot/vmlinuz0 \
+    --kopts="rootflags=loop root=/ovirt-node-image.iso rootfstype=iso9660 ro console=tty0 console=ttyS0,115200n8"
+
+cobbler profile add --name=oVirt-Node-$node_arch --distro=oVirt-Node-$node_arch
+cobbler system add --netboot-enabled=1 --profile=oVirt-Node-$node_arch \
+    --name=node3 --mac=00:16:3e:12:34:57
+cobbler system add --netboot-enabled=1 --profile=oVirt-Node-$node_arch \
+    --name=node4 --mac=00:16:3e:12:34:58 --kopts="ovirt_init=scsi ovirt_local_boot"
+cobbler system add --netboot-enabled=1 --profile=oVirt-Node-$node_arch \
+    --name=node5 --mac=00:16:3e:12:34:59 --kopts="ovirt_init=scsi"
+
+# TODO use Augeas 0.3.0 Inifile lens
+sed -i -e "s/^module = authn_denyall.*/module = authn_configfile/" \
+    /etc/cobbler/modules.conf
+sed -i -e "s/^server:.*/server: '192.168.50.2'/" \
+    -e "s/^next_server:.*/next_server: '192.168.50.2'/" \
+    /etc/cobbler/settings
+sed -i -e '/kernel /a \\tIPAPPEND 2' /etc/cobbler/pxe/pxesystem.template
+sed -i -e "s/^ONTIMEOUT.*/ONTIMEOUT oVirt-Node-$node_arch/" \
+    /etc/cobbler/pxe/pxedefault.template
+
+service cobblerd restart
+cobbler sync
+cobbler list
+
+set +x
+set +e
+echo "Add new oVirt Nodes as Cobbler systems to make them PXE boot oVirt Node image directly."
+echo "oVirt-Node-$node_arch is also default boot option in Cobbler menu"
diff --git a/installer/modules/ovirt/files/cobbler-import-appliance b/installer/modules/ovirt/files/cobbler-import-appliance
new file mode 100644
index 0000000..89ccfdb
--- /dev/null
+++ b/installer/modules/ovirt/files/cobbler-import-appliance
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+# Import Cobbler profiles on first boot
+
+url=http://download.fedora.redhat.com/pub/fedora/linux
+ksdir=/var/www/cobbler/ks_mirror
+rawhide=11
+node_arch=$(rpm -q --qf "%{arch}" ovirt-node-image)
+
+set -x
+set -e
+for dir in $ksdir/* ; do
+    ova=$dir/.treeinfo.ova
+    if [ ! -f $ova ]; then
+        echo "Skipping $dir, no $ova file present"
+        continue
+    fi
+
+    os=$(awk '{print $1}' $ova)
+    ver=$(awk '{print $2}' $ova)
+    arch=$(awk '{print $3}' $ova)
+
+    # Would prefer cobbler distro add
+    cobbler import --name=$os-$ver --arch=$arch --path=$dir
+
+    sed -e 's#^reboot.*#poweroff#' /var/lib/cobbler/kickstarts/sample_end.ks \
+        > /var/lib/cobbler/kickstarts/sample-$os-$ver-$arch.ks
+
+    if [[ "$ver" =~ "$rawhide" ]]; then
+        cobbler repo add --name=f$ver-$arch --arch=$arch --mirror-locally=0 \
+            --mirror=$url/development/$arch/os
+        repos=""
+    else
+        cobbler repo add --name=f$ver-$arch --arch=$arch --mirror-locally=0 \
+            --mirror=$url/releases/$ver/Everything/$arch/os
+        cobbler repo add --name=f$ver-$arch-updates --arch=$arch --mirror-locally=0 \
+            --mirror=$url/updates/$ver/$arch.newkey
+        repos="f$ver-$arch f$ver-$arch-updates"
+    fi
+
+    cobbler profile edit --name=$os-$ver-$arch \
+        --repos="$repos" \
+        --kickstart=/var/lib/cobbler/kickstarts/sample-$os-$ver-$arch.ks
+done
+
+sed -i -e "s/^server:.*/server: '192.168.50.2'/" \
+    -e "s/^next_server:.*/next_server: '192.168.50.2'/" \
+    /etc/cobbler/settings
+
+cobbler system add --netboot-enabled=1 --profile=oVirt-Node-$node_arch \
+    --name=node3 --mac=00:16:3e:12:34:57
+cobbler system add --netboot-enabled=1 --profile=oVirt-Node-$node_arch \
+    --name=node4 --mac=00:16:3e:12:34:58 --kopts="ovirt_init=scsi ovirt_local_boot"
+cobbler system add --netboot-enabled=1 --profile=oVirt-Node-$node_arch \
+    --name=node5 --mac=00:16:3e:12:34:59 --kopts="ovirt_init=scsi"
diff --git a/installer/modules/ovirt/files/cobbler-import-generic b/installer/modules/ovirt/files/cobbler-import-generic
new file mode 100644
index 0000000..cee095d
--- /dev/null
+++ b/installer/modules/ovirt/files/cobbler-import-generic
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+node_arch=$(rpm -q --qf "%{arch}" ovirt-node-image)
+node_dir=/usr/share/ovirt-node-image
+
+# Create PXE images from oVirt ISO
+pushd $node_dir
+ovirt-pxe ovirt-node-image.iso
+popd
+
+cobbler distro add --name="oVirt-Node-$node_arch" --arch=$node_arch \
+    --initrd=$node_dir/tftpboot/initrd0.img --kernel=$node_dir/tftpboot/vmlinuz0 \
+    --kopts="rootflags=loop root=/ovirt-node-image.iso rootfstype=iso9660 ro console=tty0 console=ttyS0,115200n8"
+cobbler profile add --name=oVirt-Node-$node_arch --distro=oVirt-Node-$node_arch
+
+# TODO use Augeas 0.3.0 Inifile lens
+sed -i -e '/kernel /a \\tIPAPPEND 2' /etc/cobbler/pxe/pxesystem.template
+sed -i -e "s/^ONTIMEOUT.*/ONTIMEOUT oVirt-Node-$node_arch/" \
+    /etc/cobbler/pxe/pxedefault.template
+
+#service cobblerd restart
+#cobbler sync
+#cobbler list
diff --git a/installer/modules/ovirt/manifests/cobbler.pp b/installer/modules/ovirt/manifests/cobbler.pp
index ca83b38..1cbf605 100644
--- a/installer/modules/ovirt/manifests/cobbler.pp
+++ b/installer/modules/ovirt/manifests/cobbler.pp
@@ -108,6 +108,18 @@ class cobbler::bundled {
 #	firewall_rule{"25150": destination_port => "25150"}
 #	firewall_rule{"25151": destination_port => "25151"}
 
+
+    file {"/usr/sbin/cobbler-import":
+          source => "puppet:///ovirt/cobbler-import-generic",
+          mode => 755
+    }
+
+    single_exec {"cobbler-import":
+    command => "/usr/sbin/cobbler-import >> /var/log/cobbler-import.log 2>&1",
+    require => [File["/usr/sbin/cobbler-import"],
+               Service["cobblerd"]]
+    }      
+
 }
 
 class cobbler::remote {
diff --git a/installer/modules/ovirt/manifests/dns.pp b/installer/modules/ovirt/manifests/dns.pp
index 5326c7c..d1d18fc 100644
--- a/installer/modules/ovirt/manifests/dns.pp
+++ b/installer/modules/ovirt/manifests/dns.pp
@@ -19,6 +19,9 @@
 #--
 
 # common featues
+
+import "augeas"
+
 define dns::common($mgmt_ipaddr="", $prov_ipaddr="",$mgmt_dev="",$prov_dev="") {
 
     package {"dnsmasq":
@@ -44,14 +47,13 @@ define dns::common($mgmt_ipaddr="", $prov_ipaddr="",$mgmt_dev="",$prov_dev="") {
         require => [Single_exec["set_hostname"]]
     }
 
-
-    file_replacement {"dnsmasq_configdir":
-        file => "/etc/dnsmasq.conf",
-        pattern => "^#conf-dir=*$",
-        replacement => "conf-dir=/etc/dnsmasq.d",
-        notify => Service[dnsmasq],
-        require => Package["dnsmasq"]
-    }
+	augeas{"appliance_info":
+	    context => "/files/etc/dnsmasq.conf",
+	    changes => [
+	        "set conf-dir /etc/dnsmasq.d"
+        ],
+        notify => Service[dnsmasq]
+    }    
 
     file {"/etc/dhclient.conf":
         ensure => present
diff --git a/installer/modules/ovirt/manifests/ovirt.pp b/installer/modules/ovirt/manifests/ovirt.pp
index c9d3aee..9eab6bd 100644
--- a/installer/modules/ovirt/manifests/ovirt.pp
+++ b/installer/modules/ovirt/manifests/ovirt.pp
@@ -149,6 +149,10 @@ class ovirt::setup {
 		require => Package[ntp]
                 }
 
+    service {"ace" :
+                enable => false
+    }
+
 #	firewall_rule{"http": destination_port => "80"}
 
 }
-- 
1.6.0.6




More information about the ovirt-devel mailing list