95 lines
3.2 KiB
ObjectPascal
Raw Normal View History

# == Class: openstack_project::server
#
# A server that we expect to run for some time
class openstack_project::server (
$iptables_public_tcp_ports = [],
$iptables_public_udp_ports = [],
$iptables_rules4 = [],
$iptables_rules6 = [],
$sysadmins = [],
$certname = $::fqdn,
$pin_puppet = '3.',
$ca_server = undef,
$enable_unbound = true,
$afs = false,
$afs_cache_size = 500000,
$puppetmaster_server = 'puppetmaster.openstack.org',
$manage_exim = true,
$pypi_index_url = 'https://pypi.python.org/simple',
Don't purge apt sources on infracloud Without this change, puppetting an infracloud machine from scratch results in an error[1]. The order of events that causes this issue is: 1) Puppet purges /etc/apt/sources.list, removing all of apt's knowledge of other sources 2) Puppet creates /etc/apt/sources.list.d/openstack-infra.list, but this will have no effect on apt's knowledge of other sources until an apt-get update is run 3) The puppet-openstack_extras module runs an exec to install the ubuntu-cloud-keyring package. (This is done with an exec type rather than a package type because it needs to be run before Exec['apt_update'] which is defined in the puppetlabs-apt module.) Since apt at this point knows of no apt sources in the world, it fails to find the package. 4) Apt-get update is run and the world is right again, so subsequent puppet runs or manual installs of ubuntu-cloud-keyring are confusingly successful. A potential fix for this is to create another exec resource that runs apt-get update after adding openstack-infra.list but before installing ubuntu-cloud-keyring, after which apt-get update will run once again. This is inefficient and ugly. Since on these particular nodes we control the base images, and the default apt sources list is sane and matches what we have set in openstack-infra.list anyway, we can just disable the purging of the original sources.list and there will no longer be any point during which apt has no sources. [1] http://paste.openstack.org/show/488079/ Change-Id: I2cb375979d55e612fe8acc4cc7abdd393f39c2b9
2016-02-24 10:50:08 -08:00
$purge_apt_sources = true,
) {
include openstack_project::params
if $::osfamily == 'Debian' {
# Purge and augment existing /etc/apt/sources.list if requested, and make
# sure apt-get update is run before any packages are installed
class { '::apt':
purge => { 'sources.list' => $purge_apt_sources }
}
if $purge_apt_sources == true {
file { '/etc/apt/sources.list.d/openstack-infra.list':
ensure => present,
group => 'root',
mode => '0444',
owner => 'root',
source => "puppet:///modules/openstack_project/sources.list.${::lsbdistcodename}",
}
exec { 'update-apt':
command => 'apt-get update',
refreshonly => true,
path => '/bin:/usr/bin',
subscribe => File['/etc/apt/sources.list.d/openstack-infra.list'],
}
Exec['update-apt'] -> Package <| |>
}
}
package { $::openstack_project::params::packages:
ensure => present
}
###########################################################
# Manage ntp
include '::ntp'
if ($::osfamily == "RedHat") {
# Utils in ntp-perl are included in Debian's ntp package; we
# add it here for consistency. See also
# https://tickets.puppetlabs.com/browse/MODULES-3660
package { 'ntp-perl':
ensure => present
}
# NOTE(pabelanger): We need to ensure ntpdate service starts on boot for
# centos-7. Currently, ntpd explicitly require ntpdate to be running before
# the sync process can happen in ntpd. As a result, if ntpdate is not
# running, ntpd will start but fail to sync because of DNS is not properly
# setup.
package { 'ntpdate':
ensure => present,
}
service { 'ntpdate':
enable => true,
require => Package['ntpdate'],
}
}
class { 'openstack_project::template':
iptables_public_tcp_ports => $iptables_public_tcp_ports,
iptables_public_udp_ports => $iptables_public_udp_ports,
iptables_rules4 => $iptables_rules4,
iptables_rules6 => $iptables_rules6,
certname => $certname,
pin_puppet => $pin_puppet,
ca_server => $ca_server,
puppetmaster_server => $puppetmaster_server,
enable_unbound => $enable_unbound,
afs => $afs,
afs_cache_size => $afs_cache_size,
manage_exim => $manage_exim,
sysadmins => $sysadmins,
pypi_index_url => $pypi_index_url,
}
}