ae0f98e0cd
Stop using latest for packages installed by puppet. This way, all system packages get updated, not just some random ones. The unattended-upgrades config will email root. It is configured for openstack servers and jenkins slaves, but not template hosts so that it doesn't interfere with spin-up. Also, fix some bits in the gerrit module that were causing continuous restarts on gerrit-dev. Install emacs. Change-Id: I51c9083ccd3669f284fce4b50c36a37a0cac92d8
102 lines
2.4 KiB
Puppet
102 lines
2.4 KiB
Puppet
class pypimirror ( $base_url,
|
|
$log_filename = "/var/log/pypimirror.log",
|
|
$mirror_file_path = "/var/lib/pypimirror",
|
|
$pip_download = "/var/lib/pip-download",
|
|
$pip_cache = "/var/cache/pip",
|
|
$projects = [] )
|
|
{
|
|
|
|
package { 'nginx':
|
|
ensure => present,
|
|
}
|
|
|
|
package { 'pip':
|
|
ensure => latest, # okay to use latest for pip
|
|
provider => 'pip',
|
|
require => Package['python-pip'],
|
|
}
|
|
|
|
file { '/usr/local/mirror_scripts':
|
|
ensure => 'directory',
|
|
mode => 755,
|
|
owner => 'root',
|
|
group => 'root',
|
|
}
|
|
|
|
file { $pip_download:
|
|
ensure => 'directory',
|
|
mode => 755,
|
|
owner => 'root',
|
|
group => 'root',
|
|
}
|
|
|
|
file { $pip_cache:
|
|
ensure => 'directory',
|
|
mode => 755,
|
|
owner => 'root',
|
|
group => 'root',
|
|
}
|
|
|
|
file { '/usr/local/mirror_scripts/run-mirror.sh':
|
|
ensure => present,
|
|
mode => 755,
|
|
owner => 'root',
|
|
group => 'root',
|
|
content => template('pypimirror/run-mirror.sh.erb'),
|
|
require => File['/usr/local/mirror_scripts'],
|
|
}
|
|
|
|
file { '/usr/local/mirror_scripts/pull-repo.sh':
|
|
ensure => present,
|
|
mode => 755,
|
|
owner => 'root',
|
|
group => 'root',
|
|
source => "puppet:///modules/pypimirror/pull-repo.sh",
|
|
require => File['/usr/local/mirror_scripts'],
|
|
}
|
|
|
|
file { '/usr/local/mirror_scripts/process_cache.py':
|
|
ensure => present,
|
|
mode => 755,
|
|
owner => 'root',
|
|
group => 'root',
|
|
source => "puppet:///modules/pypimirror/process_cache.py",
|
|
require => File['/usr/local/mirror_scripts'],
|
|
}
|
|
|
|
# Add cron job to update the mirror
|
|
|
|
cron { "update_mirror":
|
|
user => root,
|
|
minute => "0",
|
|
command => '/usr/local/mirror_scripts/run-mirror.sh',
|
|
require => File["/usr/local/mirror_scripts/run-mirror.sh"],
|
|
}
|
|
|
|
# Rotate the mirror log file
|
|
|
|
include logrotate
|
|
logrotate::file {"pypimirror":
|
|
log => $log_filename,
|
|
options => ["compress", "delaycompress", "missingok", "rotate 7", "daily", "notifempty"],
|
|
require => Cron["update_mirror"],
|
|
}
|
|
|
|
# Setup the web server
|
|
|
|
service { "nginx":
|
|
ensure => running,
|
|
hasrestart => true
|
|
}
|
|
|
|
file { "/etc/nginx/sites-available/default":
|
|
ensure => present,
|
|
content => template('pypimirror/nginx_default.erb'),
|
|
replace => true,
|
|
owner => "root",
|
|
group => "root",
|
|
require => Package["nginx"],
|
|
notify => Service["nginx"],
|
|
}
|
|
}
|