From 440245d6d47347be44d5fd2bfea7b13b8a314584 Mon Sep 17 00:00:00 2001 From: Vladimir Kuklin Date: Sat, 7 Mar 2015 12:24:18 +0000 Subject: [PATCH] Revert "Revert "Cobbler: aligned repos snippets with astute change"" This brings back changes that broke compatibility between old Nailgun code and Fuel Library with assumption that newer FUEL CI ISO will be uploaded in several hours. blueprint consume-external-ubuntu This reverts commit ccaab07d525fefb295587eb80d269c24c04bd009. Change-Id: Ifc6a8a6043445741691cbfae364b7b8c5df9802e --- .../puppet/cobbler/manifests/snippets.pp | 4 +- .../cobbler/templates/kickstart/centos.ks.erb | 15 ++- .../templates/preseed/ubuntu-1204.preseed.erb | 99 +++++++++-------- .../templates/preseed/ubuntu-1404.preseed.erb | 105 ++++++++++-------- .../puppet/cobbler/templates/settings.erb | 29 +++-- .../templates/snippets/nailgun_repo.erb | 27 ++--- .../snippets/ubuntu_precise_packages_late.erb | 10 ++ .../templates/snippets/ubuntu_repos_late.erb | 15 +++ ...es.erb => ubuntu_trusty_packages_late.erb} | 13 +-- 9 files changed, 178 insertions(+), 139 deletions(-) create mode 100644 deployment/puppet/cobbler/templates/snippets/ubuntu_precise_packages_late.erb create mode 100644 deployment/puppet/cobbler/templates/snippets/ubuntu_repos_late.erb rename deployment/puppet/cobbler/templates/snippets/{ubuntu_packages.erb => ubuntu_trusty_packages_late.erb} (61%) diff --git a/deployment/puppet/cobbler/manifests/snippets.pp b/deployment/puppet/cobbler/manifests/snippets.pp index 2275a16d7f..6842d9f4fe 100644 --- a/deployment/puppet/cobbler/manifests/snippets.pp +++ b/deployment/puppet/cobbler/manifests/snippets.pp @@ -63,7 +63,6 @@ class cobbler::snippets { cobbler_snippet {"ubuntu_authorized_keys":} cobbler_snippet {"ubuntu_blacklist_i2c_piix4":} cobbler_snippet {"ubuntu_disable_pxe":} - cobbler_snippet {"ubuntu_packages":} cobbler_snippet {"ubuntu_puppet_config":} cobbler_snippet {"ubuntu_mcollective_config":} cobbler_snippet {"ubuntu_network":} @@ -71,6 +70,9 @@ class cobbler::snippets { cobbler_snippet {"ubuntu_partition":} cobbler_snippet {"ubuntu_partition_late":} cobbler_snippet {"ubuntu_static_net":} + cobbler_snippet {"ubuntu_repos_late":} + cobbler_snippet {"ubuntu_precise_packages_late":} + cobbler_snippet {"ubuntu_trusty_packages_late":} cobbler_snippet {"anaconda_ssh_console":} cobbler_snippet {"anaconda_yum":} cobbler_snippet {'centos_post_kernel_lt_if_enabled':} diff --git a/deployment/puppet/cobbler/templates/kickstart/centos.ks.erb b/deployment/puppet/cobbler/templates/kickstart/centos.ks.erb index 8b480bf9e7..dad09297c9 100644 --- a/deployment/puppet/cobbler/templates/kickstart/centos.ks.erb +++ b/deployment/puppet/cobbler/templates/kickstart/centos.ks.erb @@ -1,15 +1,18 @@ +#import json + # WHAT TO DO (install fresh system rather than upgrade) install # INSTALLATION SOURCE (centos repository) -url --url=$tree +#set $repo_setup = json.loads($getVar("repo_setup")) +#set $repo = $repo_setup["repos"][0] +url --url=$repo["uri"] -#if $varExists('repo_metadata') +#if $varExists("repo_setup") # REPOSITORIES FROM Nailgun -## Expected repo_metadata format Name1=Value1,Name2=Value2 -#set repo_list = dict(item.split("=") for item in $repo_metadata.split(",")) -#for $repo_name, $repo_url in $repo_list.items() -repo --name=$repo_name --baseurl=$repo_url +#set $repos = $repo_setup["repos"][1:] +#for $repo in $repos +repo --name=$repo["name"] --baseurl=$repo["uri"] #end for #else # ALTERNATIVE REPOSITORIES (PRESET) diff --git a/deployment/puppet/cobbler/templates/preseed/ubuntu-1204.preseed.erb b/deployment/puppet/cobbler/templates/preseed/ubuntu-1204.preseed.erb index 900f8e91d2..731014cd6f 100644 --- a/deployment/puppet/cobbler/templates/preseed/ubuntu-1204.preseed.erb +++ b/deployment/puppet/cobbler/templates/preseed/ubuntu-1204.preseed.erb @@ -27,7 +27,6 @@ d-i clock-setup/ntp boolean false d-i time/zone string <%= @ks_system_timezone %> $SNIPPET('ubuntu_network_console_and_syslog') - $SNIPPET('ubuntu_partition') #set fuel_version=$getVar('fuel_version', '') @@ -42,26 +41,42 @@ d-i base-installer/kernel/image string linux-image-3.11 # REPOS ########## -d-i mirror/protocol string http +#import json +#set $repo_setup = json.loads($getVar("repo_setup")) +#set $repos = $repo_setup["repos"] +#set $base_mirror = $repos[0] +#set $base_mirror_protocol = $base_mirror["uri"].split(":", 1)[0] +#set $base_mirror_host = $base_mirror["uri"].split("http://")[1].split("/")[0] +#set $base_mirror_directory = "/" + $base_mirror["uri"].split("http://")[1].split("/", 1)[1] +#set $base_mirror_suite = $base_mirror["suite"] +#set $base_mirror_components = ", ".join($base_mirror["section"].split()) +d-i mirror/protocol string $base_mirror_protocol d-i mirror/country string manual -d-i mirror/http/hostname string @@server@@:8080 -d-i mirror/http/directory string /ubuntu/x86_64 +d-i mirror/http/hostname string $base_mirror_host +d-i mirror/http/directory string $base_mirror_directory d-i mirror/http/proxy string - -d-i mirror/suite string precise +d-i mirror/suite string $base_mirror_suite # Suite to use for loading installer components (optional). -d-i mirror/udeb/suite string precise +d-i mirror/udeb/suite string $base_mirror_suite # Components to use for loading installer components (optional). -d-i mirror/udeb/components multiselect main, restricted +d-i mirror/udeb/components multiselect $base_mirror_components # Retry failed repo d-i apt-setup/mirror/error select Retry -# Downloading a file failed -# d-i apt-setup/use_mirror select Retry -d-i apt-setup/restricted boolean true -d-i apt-setup/universe boolean true +# Use network mirror d-i apt-setup/use_mirror boolean true -d-i apt-setup/security_host 127.0.0.1 + +# You can choose to install restricted and universe software, or to install +# software from the backports repository. +d-i apt-setup/restricted boolean false +d-i apt-setup/universe boolean false +d-i apt-setup/backports boolean false + +# Select which update services to use; define the mirrors to be used. +# Values shown below are the normal defaults. +# d-i apt-setup/services-select multiselect +d-i apt-setup/security_host string 127.0.0.1 +# d-i apt-setup/security_path string /ubuntu d-i debian-installer/allow_unauthenticated boolean true @@ -69,16 +84,12 @@ d-i console-setup/ask_detect boolean false d-i keyboard-configuration/layoutcode string us d-i keyboard-configuration/modelcode string SKIP -#if $varExists('repo_metadata') -# Additional repositories, local[0-9] available -#set counter_x = 0 -#set repo_list = dict(item.split("=") for item in $repo_metadata.split(",")) -#for $repo_name, $repo_url in $repo_list.items() -d-i apt-setup/local$counter_x/repository string $repo_url -d-i apt-setup/local$counter_x/comment string $repo_name -#set counter_x = $counter_x + 1 -#end for -#end if +# NOTE(kozhukalov): We avoid defining multiple mirrors +# using apt-setup/localN debconf variables. +# The reason for this is that it does not suport pinning. +# We define multiple repos with their priorities inside target +# and then use in-target apt-get to install additional packages. +# See ubuntu_repos_late and ubuntu_packages_late snippets. ########## # USERS @@ -95,19 +106,20 @@ d-i passwd/make-user boolean false ############ tasksel tasksel/first multiselect standard - debconf debconf/frontend select Noninteractive -# d-i pkgsel/include string openssh-server debconf-utils -$SNIPPET('ubuntu_packages') +# NOTE(kozhukalov): We deliberately avoid using +# pkgsel/include mechanism for installing additional packages. +# We need preferences for our additional mirrors +# and it is only possible if we put preferences into target and +# install packages using apt-get inside this target directory. +# See ubuntu_repos_late and ubuntu_packages_late snippets. + d-i pkgsel/language-packs multiselect en d-i pkgsel/update-policy select none d-i pkgsel/upgrade select none d-i pkgsel/updatedb boolean true - - - d-i finish-install/keep-consoles boolean false d-i finish-install/reboot_in_progress note @@ -120,11 +132,20 @@ d-i debian-installer/exit/poweroff boolean false ################ # LATE COMMANDS ################ - # TODO: # add puppet and mcollective configuration # add network configuration d-i preseed/late_command string true && \ +$SNIPPET('ubuntu_repos_late') +echo 'APT::Get::AllowUnauthenticated 1;' > /target/etc/apt/apt.conf.d/02mirantis-allow-unsigned && \ +in-target apt-get update; \ +in-target apt-get upgrade -y; \ +#if $fuel_version >= '6.0' +in-target apt-get -y install linux-image-generic-lts-trusty linux-headers-generic-lts-trusty; \ +#else +in-target apt-get -y install linux-image-3.11 linux-headers-3.11; \ +#end if +$SNIPPET('ubuntu_packages_late') $SNIPPET('ubuntu_partition_late') $SNIPPET('ubuntu_disable_pxe') && \ $SNIPPET('ubuntu_network') && \ @@ -141,27 +162,9 @@ mkdir -p /target/etc/nailgun-agent && \ echo "---" > $nailgun_agent_conf && \ echo "url: '<%= scope.lookupvar('nailgun::cobbler::nailgun_api_url') %>'" >> $nailgun_agent_conf && \ echo target > /target/etc/nailgun_systemtype && \ -echo 'APT::Get::AllowUnauthenticated 1;' > /target/etc/apt/apt.conf.d/02mirantis-allow-unsigned && \ -# REPOSITORIES FROM Nailgun -#if $varExists('repo_metadata') -echo "" /target/etc/apt/sources.list && \ -#set repo_list = dict(item.split("=") for item in $repo_metadata.split(",")) -#for $repo_name, $repo_url in $repo_list.items() -echo 'deb $repo_url' >> /target/etc/apt/sources.list && \ -#end for -#else -echo 'deb http://@@server@@:8080/ubuntu/x86_64 precise main' > /target/etc/apt/sources.list && \ -#end if $SNIPPET('ubuntu_authorized_keys') sed -i -e "/^\s*GSSAPICleanupCredentials yes/d" -e "/^\s*GSSAPIAuthentication yes/d" -e "s/.*PasswordAuthentication\ .*/PasswordAuthentication\ no/g" -e "/UseDNS/d" /target/etc/ssh/sshd_config && \ echo "UseDNS no" >> /target/etc/ssh/sshd_config && \ -#if $fuel_version >= '6.0' -in-target apt-get -y install linux-image-generic-lts-trusty linux-headers-generic-lts-trusty && \ -#else -in-target apt-get -y install linux-image-3.11 linux-headers-3.11 && \ -#end if -in-target apt-get update; \ -in-target apt-get upgrade -y; \ $SNIPPET('ubuntu_blacklist_i2c_piix4') $SNIPPET('ubuntu_static_net') $SNIPPET('ofed_install_with_sriov') diff --git a/deployment/puppet/cobbler/templates/preseed/ubuntu-1404.preseed.erb b/deployment/puppet/cobbler/templates/preseed/ubuntu-1404.preseed.erb index a102bfab75..652618ceb8 100644 --- a/deployment/puppet/cobbler/templates/preseed/ubuntu-1404.preseed.erb +++ b/deployment/puppet/cobbler/templates/preseed/ubuntu-1404.preseed.erb @@ -27,36 +27,56 @@ d-i clock-setup/ntp boolean false d-i time/zone string <%= @ks_system_timezone %> $SNIPPET('ubuntu_network_console_and_syslog') - $SNIPPET('ubuntu_partition') +#set fuel_version=$getVar('fuel_version', '') +#if $fuel_version >= '6.0' d-i base-installer/kernel/image string linux-image-generic-lts-trusty +#else +d-i base-installer/kernel/image string linux-image-3.11 +#end if ########## # REPOS ########## -d-i mirror/protocol string http +#import json +#set $repo_setup = json.loads($getVar("repo_setup")) +#set $repos = $repo_setup["repos"] +#set $base_mirror = $repos[0] +#set $base_mirror_protocol = $base_mirror["uri"].split(":", 1)[0] +#set $base_mirror_host = $base_mirror["uri"].split("http://")[1].split("/")[0] +#set $base_mirror_directory = "/" + $base_mirror["uri"].split("http://")[1].split("/", 1)[1] +#set $base_mirror_suite = $base_mirror["suite"] +#set $base_mirror_components = ", ".join($base_mirror["section"].split()) +d-i mirror/protocol string $base_mirror_protocol d-i mirror/country string manual -d-i mirror/http/hostname string @@server@@:8080 -d-i mirror/http/directory string /ubuntu/x86_64 +d-i mirror/http/hostname string $base_mirror_host +d-i mirror/http/directory string $base_mirror_directory d-i mirror/http/proxy string - -d-i mirror/suite string trusty +d-i mirror/suite string $base_mirror_suite # Suite to use for loading installer components (optional). -d-i mirror/udeb/suite string trusty +d-i mirror/udeb/suite string $base_mirror_suite # Components to use for loading installer components (optional). -d-i mirror/udeb/components multiselect main, restricted +d-i mirror/udeb/components multiselect $base_mirror_components # Retry failed repo d-i apt-setup/mirror/error select Retry -# Downloading a file failed -# d-i apt-setup/use_mirror select Retry -d-i apt-setup/restricted boolean true -d-i apt-setup/universe boolean true +# Use network mirror d-i apt-setup/use_mirror boolean true -d-i apt-setup/security_host 127.0.0.1 + +# You can choose to install restricted and universe software, or to install +# software from the backports repository. +d-i apt-setup/restricted boolean false +d-i apt-setup/universe boolean false +d-i apt-setup/backports boolean false + +# Select which update services to use; define the mirrors to be used. +# Values shown below are the normal defaults. +# d-i apt-setup/services-select multiselect +d-i apt-setup/security_host string 127.0.0.1 +# d-i apt-setup/security_path string /ubuntu d-i debian-installer/allow_unauthenticated boolean true @@ -64,16 +84,12 @@ d-i console-setup/ask_detect boolean false d-i keyboard-configuration/layoutcode string us d-i keyboard-configuration/modelcode string SKIP -#if $varExists('repo_metadata') -# Additional repositories, local[0-9] available -#set counter_x = 0 -#set repo_list = dict(item.split("=") for item in $repo_metadata.split(",")) -#for $repo_name, $repo_url in $repo_list.items() -d-i apt-setup/local$counter_x/repository string deb $repo_url -d-i apt-setup/local$counter_x/comment string $repo_name -#set counter_x = $counter_x + 1 -#end for -#end if +# NOTE(kozhukalov): We avoid defining multiple mirrors +# using apt-setup/localN debconf variables. +# The reason for this is that it does not suport pinning. +# We define multiple repos with their priorities inside target +# and then use in-target apt-get to install additional packages. +# See ubuntu_repos_late and ubuntu_packages_late snippets. ########## # USERS @@ -90,19 +106,20 @@ d-i passwd/make-user boolean false ############ tasksel tasksel/first multiselect standard - debconf debconf/frontend select Noninteractive -# d-i pkgsel/include string openssh-server debconf-utils -$SNIPPET('ubuntu_packages') +# NOTE(kozhukalov): We deliberately avoid using +# pkgsel/include mechanism for installing additional packages. +# We need preferences for our additional mirrors +# and it is only possible if we put preferences into target and +# install packages using apt-get inside this target directory. +# See ubuntu_repos_late and ubuntu_packages_late snippets. + d-i pkgsel/language-packs multiselect en d-i pkgsel/update-policy select none d-i pkgsel/upgrade select none d-i pkgsel/updatedb boolean true - - - d-i finish-install/keep-consoles boolean false d-i finish-install/reboot_in_progress note @@ -115,11 +132,24 @@ d-i debian-installer/exit/poweroff boolean false ################ # LATE COMMANDS ################ - # TODO: # add puppet and mcollective configuration # add network configuration d-i preseed/late_command string true && \ +$SNIPPET('ubuntu_repos_late') +echo 'APT::Get::AllowUnauthenticated 1;' > /target/etc/apt/apt.conf.d/02mirantis-allow-unsigned && \ +in-target apt-get update; \ +in-target apt-get upgrade -y; \ +#if $fuel_version >= '6.0' +in-target apt-get -y install linux-image-generic-lts-trusty linux-headers-generic-lts-trusty; \ +#else +in-target apt-get -y install linux-image-3.11 linux-headers-3.11; \ +#end if +#if $fuel_version >= '6.1' +$SNIPPET('ubuntu_trusty_packages_late') +#else +$SNIPPET('ubuntu_precise_packages_late') +#end if $SNIPPET('ubuntu_partition_late') $SNIPPET('ubuntu_disable_pxe') && \ $SNIPPET('ubuntu_network') && \ @@ -136,26 +166,13 @@ mkdir -p /target/etc/nailgun-agent && \ echo "---" > $nailgun_agent_conf && \ echo "url: '<%= scope.lookupvar('nailgun::cobbler::nailgun_api_url') %>'" >> $nailgun_agent_conf && \ echo target > /target/etc/nailgun_systemtype && \ -echo 'APT::Get::AllowUnauthenticated 1;' > /target/etc/apt/apt.conf.d/02mirantis-allow-unsigned && \ -# REPOSITORIES FROM Nailgun -#if $varExists('repo_metadata') -echo "" /target/etc/apt/sources.list && \ -#set repo_list = dict(item.split("=") for item in $repo_metadata.split(",")) -#for $repo_name, $repo_url in $repo_list.items() -echo 'deb $repo_url' >> /target/etc/apt/sources.list && \ -#end for -#else -echo 'deb http://@@server@@:8080/ubuntu/x86_64 trusty main' > /target/etc/apt/sources.list && \ -#end if $SNIPPET('ubuntu_authorized_keys') sed -i -e "/^\s*GSSAPICleanupCredentials yes/d" -e "/^\s*GSSAPIAuthentication yes/d" -e "s/.*PasswordAuthentication\ .*/PasswordAuthentication\ no/g" -e "/UseDNS/d" /target/etc/ssh/sshd_config && \ echo "UseDNS no" >> /target/etc/ssh/sshd_config && \ -in-target apt-get -y install linux-headers-generic-lts-trusty && \ -in-target apt-get update; \ -in-target apt-get upgrade -y; \ $SNIPPET('ubuntu_blacklist_i2c_piix4') $SNIPPET('ubuntu_static_net') $SNIPPET('ofed_install_with_sriov') # Rsyslogd should send all messages to master node $SNIPPET('target_logs_to_master_ubuntu') true + diff --git a/deployment/puppet/cobbler/templates/settings.erb b/deployment/puppet/cobbler/templates/settings.erb index 5356671c33..0be20919d6 100644 --- a/deployment/puppet/cobbler/templates/settings.erb +++ b/deployment/puppet/cobbler/templates/settings.erb @@ -41,8 +41,8 @@ build_reporting_smtp_server: "localhost" build_reporting_subject: "" # Cheetah-language kickstart templates can import Python modules. -# while this is a useful feature, it is not safe to allow them to -# import anything they want. This whitelists which modules can be +# while this is a useful feature, it is not safe to allow them to +# import anything they want. This whitelists which modules can be # imported through Cheetah. Users can expand this as needed but # should never allow modules such as subprocess or those that # allow access to the filesystem as Cheetah templates are evaluated @@ -52,6 +52,7 @@ cheetah_import_whitelist: - "re" - "time" - "orchestra" + - "json" # Default createrepo_flags to use for new repositories. If you have # createrepo >= 0.4.10, consider "-c cache --update -C", which can @@ -108,13 +109,13 @@ default_virt_type: qemu # basis when adding/editing profiles with --enable-menu=0/1. Users # should ordinarily leave this setting enabled unless they are concerned # with accidental reinstalls from users who select an entry at the PXE -# boot menu. Adding a password to the boot menus templates +# boot menu. Adding a password to the boot menus templates # may also be a good solution to prevent unwanted reinstallations enable_menu: 1 # enable Func-integration? This makes sure each installed machine is set up # to use func out of the box, which is a powerful way to script and control -# remote machines. +# remote machines. # Func lives at http://fedorahosted.org/func # read more at https://fedorahosted.org/cobbler/wiki/FuncIntegration # you will need to mirror Fedora/EPEL packages for this feature, so see @@ -160,7 +161,7 @@ ldap_search_passwd: '' ldap_search_prefix: 'uid=' # cobbler has a feature that allows for integration with config management -# systems such as Puppet. The following parameters work in conjunction with +# systems such as Puppet. The following parameters work in conjunction with # --mgmt-classes and are described in furhter detail at: # https://fedorahosted.org/cobbler/wiki/UsingCobblerWithConfigManagementSystem mgmt_classes: [] @@ -230,7 +231,7 @@ power_management_default_type: 'ether_wake' power_template_dir: "/etc/cobbler/power" # if this setting is set to 1, cobbler systems that pxe boot -# will request at the end of their installation to toggle the +# will request at the end of their installation to toggle the # --netboot-enabled record in the cobbler system record. This eliminates # the potential for a PXE boot loop if the system is set to PXE # first in it's BIOS order. Enable this if PXE is first in your BIOS @@ -242,7 +243,7 @@ pxe_just_once: 1 # from what directory? pxe_template_dir: "/etc/cobbler/pxe" -# Path to where system consoles are +# Path to where system consoles are consoles: "/var/consoles" # Are you using a Red Hat management platform in addition to Cobbler? @@ -264,12 +265,12 @@ redhat_management_server: "xmlrpc.rhn.redhat.com" # specify the default Red Hat authorization key to use to register # system. If left blank, no registration will be attempted. Similarly -# you can set the --redhat-management-key to blank on any system to +# you can set the --redhat-management-key to blank on any system to # keep it from trying to register. redhat_management_key: "" -# if using authn_spacewalk in modules.conf to let cobbler authenticate -# against Satellite/Spacewalk's auth system, by default it will not allow per user +# if using authn_spacewalk in modules.conf to let cobbler authenticate +# against Satellite/Spacewalk's auth system, by default it will not allow per user # access into Cobbler Web and Cobbler XMLRPC. # in order to permit this, the following setting must be enabled HOWEVER # doing so will permit all Spacewalk/Satellite users of certain types to edit all @@ -317,7 +318,7 @@ run_install_triggers: 1 # enables a trigger which version controls all changes to /var/lib/cobbler # when add, edit, or sync events are performed. This can be used # to revert to previous database versions, generate RSS feeds, or for -# other auditing or backup purposes. "git" and "hg" are currently suported, +# other auditing or backup purposes. "git" and "hg" are currently suported, # but git is the recommend SCM for use with this feature. scm_track_enabled: 0 scm_track_mode: "git" @@ -342,7 +343,7 @@ snippetsdir: /var/lib/cobbler/snippets # and serve a templated version of the file to the client. template_remote_kickstarts: 0 -# cobbler uses pxe booting by default, enable this option if you want to +# cobbler uses pxe booting by default, enable this option if you want to # use gpxe use_gpxe: 0 @@ -377,8 +378,6 @@ yum_post_install_mirror: 1 # if yum-priorities plugin is used. 1=maximum. Tweak with caution. yum_distro_priority: 1 -# Flags to use for yumdownloader. Not all versions may support +# Flags to use for yumdownloader. Not all versions may support # --resolve. yumdownloader_flags: "--resolve" - - diff --git a/deployment/puppet/cobbler/templates/snippets/nailgun_repo.erb b/deployment/puppet/cobbler/templates/snippets/nailgun_repo.erb index 1e5436ce4b..8dc4bb1719 100644 --- a/deployment/puppet/cobbler/templates/snippets/nailgun_repo.erb +++ b/deployment/puppet/cobbler/templates/snippets/nailgun_repo.erb @@ -1,21 +1,14 @@ +#import json rm /etc/yum.repos.d/*.repo -cat > /etc/yum.repos.d/nailgun.repo << EOF -#if $varExists('repo_metadata') -# REPOSITORIES FROM Nailgun -#set nailgun_repo_list = dict(item.split("=") for item in $repo_metadata.split(",")) -#for $repo_name, $repo_url in $nailgun_repo_list.items() -[$repo_name] -name=$repo_name -baseurl=$repo_url +#set $repo_setup = json.loads($getVar("repo_setup")) +#set $repos = $repo_setup["repos"] +#for $repo in $repos +cat > /etc/yum.repos.d/${repo["name"]}.repo << EOF +[${repo["name"]}] +name=$repo["name"] +baseurl=$repo["uri"] gpgcheck=0 +priority=$repo["priority"] +EOF #end for -#else -<% @ks_repo.each do |repo| %> -[<%= repo['id'] %>] -name=<%= repo['name'] %> -baseurl=<%= repo['url'] %> -gpgcheck=0 -<% end %> -#end if -EOF \ No newline at end of file diff --git a/deployment/puppet/cobbler/templates/snippets/ubuntu_precise_packages_late.erb b/deployment/puppet/cobbler/templates/snippets/ubuntu_precise_packages_late.erb new file mode 100644 index 0000000000..89780624bf --- /dev/null +++ b/deployment/puppet/cobbler/templates/snippets/ubuntu_precise_packages_late.erb @@ -0,0 +1,10 @@ +#set $ubuntu_packages = ["acl", "openssh-server", "debconf-utils", "ntp", "ntpdate", "ruby-ipaddress", "ruby-netaddr", "ruby-openstack", "libaugeas-ruby", "libstomp-ruby1.8", "libshadow-ruby1.8", "libjson-ruby1.8", "vim", "vlan", "curl", "anacron", "python-amqp", "nailgun-agent", "nailgun-mcagents", "lvm2", "nailgun-net-check", "puppet", "telnet", "gdisk", "daemonize", "rsync", "virt-what" ] +#if $str($getVar('mco_auto_setup','')) == "1" + #silent $ubuntu_packages.append("ruby-stomp") + #silent $ubuntu_packages.append("mcollective") +#end if +#set mlnx_mode=$getVar('mlnx_plugin_mode','disabled') +#if $mlnx_mode != "disabled" + #silent $ubuntu_packages.append("mlnx-ofed-light") +#end if +in-target apt-get -y install #echo " ".join($ubuntu_packages)#; \ diff --git a/deployment/puppet/cobbler/templates/snippets/ubuntu_repos_late.erb b/deployment/puppet/cobbler/templates/snippets/ubuntu_repos_late.erb new file mode 100644 index 0000000000..8b920f97e2 --- /dev/null +++ b/deployment/puppet/cobbler/templates/snippets/ubuntu_repos_late.erb @@ -0,0 +1,15 @@ +#import json +## We assume ks_meta contains repo_setup variable +## Cleaning up sources.list +echo > /target/etc/apt/sources.list; \ +mkdir -p /target/etc/apt/sources.list.d; \ +mkdir -p /target/etc/apt/preferences.d; \ +#set $repo_setup = json.loads($getVar("repo_setup")) +#set $repos = $repo_setup["repos"] +#for $repo in $repos +echo 'deb $repo["uri"] $repo["suite"] $repo["section"]' > /target/etc/apt/sources.list.d/${repo["name"]}.list; \ +echo 'Package: *' > /target/etc/apt/preferences.d/$repo["name"]; \ +echo 'Pin: release a=$repo["suite"]' >> /target/etc/apt/preferences.d/$repo["name"]; \ +echo 'Pin-Priority: $repo["priority"]' >> /target/etc/apt/preferences.d/$repo["name"]; \ +echo '' >> /target/etc/apt/preferences.d/$repo["name"]; \ +#end for diff --git a/deployment/puppet/cobbler/templates/snippets/ubuntu_packages.erb b/deployment/puppet/cobbler/templates/snippets/ubuntu_trusty_packages_late.erb similarity index 61% rename from deployment/puppet/cobbler/templates/snippets/ubuntu_packages.erb rename to deployment/puppet/cobbler/templates/snippets/ubuntu_trusty_packages_late.erb index 3fa056b11f..a2e7300913 100644 --- a/deployment/puppet/cobbler/templates/snippets/ubuntu_packages.erb +++ b/deployment/puppet/cobbler/templates/snippets/ubuntu_trusty_packages_late.erb @@ -1,13 +1,10 @@ -#set $pkgsel_packages = ["acl", "openssh-server", "debconf-utils", "ntp", "ntpdate", "ruby-ipaddress", "ruby-netaddr", "ruby-openstack", "ruby-augeas", "ruby-stomp", "ruby-shadow", "ruby-json", "vim", "vlan", "curl", "anacron", "python-amqp", "nailgun-agent", "nailgun-mcagents", "lvm2", "nailgun-net-check", "puppet", "telnet", "gdisk", "daemonize", "rsync", "virt-what" ] - +#set $ubuntu_packages = ["acl", "openssh-server", "debconf-utils", "ntp", "ntpdate", "ruby-ipaddress", "ruby-netaddr", "ruby-openstack", "ruby-augeas", "ruby-stomp", "ruby-shadow", "ruby-json", "vim", "vlan", "curl", "anacron", "python-amqp", "nailgun-agent", "nailgun-mcagents", "lvm2", "nailgun-net-check", "puppet", "telnet", "gdisk", "daemonize", "rsync", "virt-what" ] #if $str($getVar('mco_auto_setup','')) == "1" - #silent $pkgsel_packages.append("ruby-stomp") - #silent $pkgsel_packages.append("mcollective") + #silent $ubuntu_packages.append("ruby-stomp") + #silent $ubuntu_packages.append("mcollective") #end if - #set mlnx_mode=$getVar('mlnx_plugin_mode','disabled') #if $mlnx_mode != "disabled" - #silent $pkgsel_packages.append("mlnx-ofed-light") + #silent $ubuntu_packages.append("mlnx-ofed-light") #end if - -d-i pkgsel/include string #echo " ".join($pkgsel_packages) +in-target apt-get -y install #echo " ".join($ubuntu_packages)#; \