From 1222d7721e7c6879fd667bc057ec176d94ea3365 Mon Sep 17 00:00:00 2001 From: Matthew Mosesohn Date: Mon, 23 Mar 2015 17:54:46 +0300 Subject: [PATCH] Add auxiliary repository Configures empty auxiliary repository for ubuntu and centos that is enabled by default. Change-Id: I87f848bd13f7402bd608e5d50c488392739ca0a3 blueprint separate-mos-from-linux --- .../docker/templates/dockerctl_config.erb | 2 +- .../puppet/nailgun/examples/host-only.pp | 2 +- .../puppet/nailgun/examples/host-upgrade.pp | 2 +- .../puppet/nailgun/files/Release-auxiliary | 8 +++ .../nailgun/manifests/auxiliaryrepos.pp | 65 +++++++++++++++++++ deployment/puppet/nailgun/manifests/host.pp | 5 ++ 6 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 deployment/puppet/nailgun/files/Release-auxiliary create mode 100644 deployment/puppet/nailgun/manifests/auxiliaryrepos.pp diff --git a/deployment/puppet/docker/templates/dockerctl_config.erb b/deployment/puppet/docker/templates/dockerctl_config.erb index 2597c132f3..98fd8562e7 100644 --- a/deployment/puppet/docker/templates/dockerctl_config.erb +++ b/deployment/puppet/docker/templates/dockerctl_config.erb @@ -14,7 +14,7 @@ ADMIN_IP="<%= @admin_ipaddress %>" LOCAL_IP="127.0.0.1" #Version of Fuel to deploy -VERSION=$(awk '/release/{gsub(/"/, "");print $2}' /etc/fuel/version.yaml || echo <%= @release %>) +VERSION=$(awk '/^[[:space:]]+release/{gsub(/"/, "");print $2}' /etc/fuel/version.yaml || echo <%= @release %>) IMAGE_PREFIX="fuel" # busybox image for storage containers BUSYBOX_IMAGE="busybox.tar.gz" diff --git a/deployment/puppet/nailgun/examples/host-only.pp b/deployment/puppet/nailgun/examples/host-only.pp index 4036a30a32..50f88296b2 100644 --- a/deployment/puppet/nailgun/examples/host-only.pp +++ b/deployment/puppet/nailgun/examples/host-only.pp @@ -35,7 +35,7 @@ class { 'nailgun::host': nailgun_user => $nailgun_user, dns_domain => $::fuel_settings['DNS_DOMAIN'], dns_search => $::fuel_settings['DNS_SEARCH'], - + repo_root => "/var/www/nailgun/${::fuel_version['VERSION']['openstack_version']}", } class { 'openstack::clocksync': diff --git a/deployment/puppet/nailgun/examples/host-upgrade.pp b/deployment/puppet/nailgun/examples/host-upgrade.pp index 18395685fe..70ee67829e 100644 --- a/deployment/puppet/nailgun/examples/host-upgrade.pp +++ b/deployment/puppet/nailgun/examples/host-upgrade.pp @@ -29,7 +29,7 @@ class { 'nailgun::host': nailgun_user => $nailgun_user, dns_domain => $::fuel_settings['DNS_DOMAIN'], dns_search => $::fuel_settings['DNS_SEARCH'], - + repo_root => "/var/www/nailgun/${::fuel_version['VERSION']['openstack_version']}", } class { "openstack::clocksync": diff --git a/deployment/puppet/nailgun/files/Release-auxiliary b/deployment/puppet/nailgun/files/Release-auxiliary new file mode 100644 index 0000000000..2d5ce5832d --- /dev/null +++ b/deployment/puppet/nailgun/files/Release-auxiliary @@ -0,0 +1,8 @@ +Origin: Mirantis +Label: auxiliary +Suite: auxiliary +Codename: auxiliary +Date: Mon, 15 Apr 2015 00:00:01 UTC +Architectures: amd64 +Components: main restricted +Description: Auxiliary diff --git a/deployment/puppet/nailgun/manifests/auxiliaryrepos.pp b/deployment/puppet/nailgun/manifests/auxiliaryrepos.pp new file mode 100644 index 0000000000..9f85402ed0 --- /dev/null +++ b/deployment/puppet/nailgun/manifests/auxiliaryrepos.pp @@ -0,0 +1,65 @@ +class nailgun::auxiliaryrepos( + $repo_root = '/var/www/nailgun', + ){ + + $centos_dir = "${repo_root}/centos/auxiliary/" + $ubuntu_dir = "${repo_root}/ubuntu/auxiliary/" + + file { $centos_dir: + ensure => directory, + owner => 'root', + group => 'root', + mode => '0755', + } + + File[$centos_dir] -> + Package['createrepo'] -> + Exec["createrepo ${centos_dir}"] -> + Yumrepo['auxiliary'] + + yumrepo { 'auxiliary': + name => 'auxiliary', + descr => 'auxillary', + baseurl => "file://${centos_dir}", + gpgcheck => '0', + } + + package { 'createrepo': + ensure => latest, + } + + exec { "createrepo ${centos_dir}": + path => '/bin:/sbin:/usr/bin:/usr/sbin', + cwd => $centos_dir, + creates => "${centos_dir}/repodata/repomd.xml", + } + + $release_files = [ + "${ubuntu_dir}/dists/auxiliary/Release", + "${ubuntu_dir}/dists/auxiliary/main/binary-amd64/Release", + "${ubuntu_dir}/dists/auxiliary/restricted/binary-amd64/Release"] + + Exec['create_ubuntu_repo_dirs'] -> + Exec['create_ubuntu_repo_Packages'] -> + File[$release_files] + + exec { 'create_ubuntu_repo_dirs': + path => '/bin:/sbin:/usr/bin:/usr/sbin', + command => "bash -c \"mkdir -p ${ubuntu_dir}/pool/{main,restricted} ${ubuntu_dir}/dists/auxiliary/{main,restricted}/binary-amd64/\"", + creates => "${ubuntu_dir}/pool", + } + + exec { 'create_ubuntu_repo_Packages': + path => '/bin:/sbin:/usr/bin:/usr/sbin', + command => "bash -c \"touch ${ubuntu_dir}/dists/auxiliary/{main,restricted}/binary-amd64/Packages\"", + creates => "${ubuntu_dir}/dists/auxiliary/main/binary-amd64/Packages", + } + + file { $release_files: + ensure => file, + source => 'puppet:///modules/nailgun/Release-auxiliary', + mode => '0644', + owner => 'root', + group => 'root', + } +} diff --git a/deployment/puppet/nailgun/manifests/host.pp b/deployment/puppet/nailgun/manifests/host.pp index 03606df3fc..130440172b 100644 --- a/deployment/puppet/nailgun/manifests/host.pp +++ b/deployment/puppet/nailgun/manifests/host.pp @@ -6,6 +6,7 @@ $dns_domain = 'domain.tld', $nailgun_group = 'nailgun', $nailgun_user = 'nailgun', $gem_source = 'http://localhost/gems/', +$repo_root = '/var/www/nailgun', ) { #Enable cobbler's iptables rules even if Cobbler not called include cobbler::iptables @@ -18,6 +19,10 @@ $gem_source = 'http://localhost/gems/', } -> class { 'nailgun::iptables': } + class { 'nailgun::auxiliaryrepos': + repo_root => $repo_root, + } + nailgun::sshkeygen { '/root/.ssh/id_rsa': homedir => '/root', username => 'root',