Merge "Add standalone nailgun role"

This commit is contained in:
Jenkins 2014-04-18 13:32:29 +00:00 committed by Gerrit Code Review
commit 42945ae893
8 changed files with 234 additions and 10 deletions

View File

@ -0,0 +1,124 @@
$fuel_settings = parseyaml($astute_settings_yaml)
$fuel_version = parseyaml($fuel_version_yaml)
if is_hash($::fuel_version) and $::fuel_version['VERSION'] and $::fuel_version['VERSION']['production'] {
$production = $::fuel_version['VERSION']['production']
}
else {
$production = 'dev'
}
if $production != 'dev' {
$env_path = "/usr"
$staticdir = "/usr/share/nailgun/static"
} else {
$env_path = "/opt/nailgun"
$staticdir = "/opt/nailgun/share/nailgun/static"
}
Class["nailgun::user"] ->
Class["nailgun::packages"] ->
Class["nailgun::venv"] ->
Class["nailgun::supervisor"]
Exec {path => '/usr/bin:/bin:/usr/sbin:/sbin'}
$centos_repos =
[
{
"id" => "nailgun",
"name" => "Nailgun",
"url" => "\$tree"
},
]
$repo_root = "/var/www/nailgun"
#$pip_repo = "/var/www/nailgun/eggs"
$pip_repo = "http://${::fuel_settings['ADMIN_NETWORK']['ipaddress']}:8080/eggs/"
$gem_source = "http://${::fuel_settings['ADMIN_NETWORK']['ipaddress']}:8080/gems/"
$package = "Nailgun"
$version = "0.1.0"
$astute_version = "0.0.2"
$nailgun_group = "nailgun"
$nailgun_user = "nailgun"
$venv = $env_path
$pip_index = "--no-index"
$pip_find_links = "-f ${pip_repo}"
$templatedir = $staticdir
$rabbitmq_host = $::fuel_settings['ADMIN_NETWORK']['ipaddress']
$rabbitmq_astute_user = "naily"
$rabbitmq_astute_password = "naily"
$cobbler_url = "http://${::fuel_settings['ADMIN_NETWORK']['ipaddress']}:80/cobbler_api"
$cobbler_user = "cobbler"
$cobbler_password = "cobbler"
$mco_pskey = "unset"
$mco_vhost = "mcollective"
$mco_host = $::fuel_settings['ADMIN_NETWORK']['ipaddress']
$mco_user = "mcollective"
$mco_password = "marionette"
$mco_connector = "rabbitmq"
#deprecated
$puppet_master_hostname = "${::fuel_settings['HOSTNAME']}.${::fuel_settings['DNS_DOMAIN']}"
class { "nailgun::user":
nailgun_group => $nailgun_group,
nailgun_user => $nailgun_user,
}
class { "nailgun::packages": }
class { "nailgun::venv":
venv => $venv,
venv_opts => "--system-site-packages",
package => $package,
version => $version,
pip_opts => "${pip_index} ${pip_find_links}",
production => $production,
nailgun_user => $nailgun_user,
nailgun_group => $nailgun_group,
database_name => "nailgun",
database_engine => "postgresql",
database_host => $::fuel_settings['ADMIN_NETWORK']['ipaddress'],
database_port => "5432",
database_user => "nailgun",
database_passwd => "nailgun",
staticdir => $staticdir,
templatedir => $templatedir,
rabbitmq_host => $rabbitmq_host,
rabbitmq_astute_user => $rabbitmq_astute_user,
rabbitmq_astute_password => $rabbitmq_astute_password,
admin_network => ipcalc_network_by_address_netmask($::fuel_settings['ADMIN_NETWORK']['ipaddress'], $::fuel_settings['ADMIN_NETWORK']['netmask']),
admin_network_cidr => ipcalc_network_cidr_by_netmask($::fuel_settings['ADMIN_NETWORK']['netmask']),
admin_network_size => ipcalc_network_count_addresses($::fuel_settings['ADMIN_NETWORK']['ipaddress'], $::fuel_settings['ADMIN_NETWORK']['netmask']),
admin_network_first => $::fuel_settings['ADMIN_NETWORK']['static_pool_start'],
admin_network_last => $::fuel_settings['ADMIN_NETWORK']['static_pool_end'],
admin_network_netmask => $::fuel_settings['ADMIN_NETWORK']['netmask'],
admin_network_ip => $::fuel_settings['ADMIN_NETWORK']['ipaddress'],
cobbler_url => $cobbler_url,
cobbler_user => $cobbler_user,
cobbler_password => $cobbler_password,
mco_pskey => $mco_pskey,
mco_vhost => $mco_vhost,
mco_host => $mco_host,
mco_user => $mco_user,
mco_password => $mco_password,
mco_connector => $mco_connector,
puppet_master_hostname => $puppet_master_hostname,
}
class { "nailgun::supervisor":
nailgun_env => $env_path,
ostf_env => $env_path,
conf_file => "nailgun/supervisord.conf.nailgun.erb",
}

View File

@ -43,6 +43,7 @@ node default {
$mco_password = "marionette"
$mco_connector = "rabbitmq"
$rabbitmq_host = $::fuel_settings['ADMIN_NETWORK']['ipaddress']
$rabbitmq_astute_user = "naily"
$rabbitmq_astute_password = "naily"

View File

@ -22,7 +22,6 @@ class nailgun(
$templatedir,
$logdumpdir = "/var/www/nailgun/dump",
$cobbler_url = "http://localhost/cobbler_api",
$cobbler_user = "cobbler",
$cobbler_password = "cobbler",
$cobbler_host = $::fuel_settings['ADMIN_NETWORK']['ipaddress'],
@ -133,6 +132,7 @@ class nailgun(
staticdir => $staticdir,
templatedir => $templatedir,
rabbitmq_host => $rabbitmq_host,
rabbitmq_astute_user => $rabbitmq_astute_user,
rabbitmq_astute_password => $rabbitmq_astute_password,
@ -142,8 +142,20 @@ class nailgun(
admin_network_first => $::fuel_settings['ADMIN_NETWORK']['static_pool_start'],
admin_network_last => $::fuel_settings['ADMIN_NETWORK']['static_pool_end'],
admin_network_netmask => $::fuel_settings['ADMIN_NETWORK']['netmask'],
admin_network_ip => $::fuel_settings['ADMIN_NETWORK']['ipaddress']
admin_network_ip => $::fuel_settings['ADMIN_NETWORK']['ipaddress'],
cobbler_url => $cobbler_url,
cobbler_user => $cobbler_user,
cobbler_password => $cobbler_password,
mco_pskey => $mco_pskey,
mco_vhost => $mco_vhost,
mco_host => $mco_host,
mco_user => $mco_user,
mco_password => $mco_password,
mco_connector => $mco_connector,
puppet_master_hostname => $puppet_master_hostname,
}
class {"nailgun::astute":

View File

@ -10,6 +10,8 @@ class nailgun::packages(
nailgun_safe_package { "supervisor": }
nailgun_safe_package { "nginx": }
nailgun_safe_package { "crontabs": }
nailgun_safe_package { "cronie-anacron": }
if ( $production == 'dev' ) {
nailgun_safe_package { "python-virtualenv": }

View File

@ -19,6 +19,7 @@ class nailgun::venv(
$staticdir,
$templatedir,
$rabbitmq_host,
$rabbitmq_astute_user,
$rabbitmq_astute_password,
@ -30,12 +31,25 @@ class nailgun::venv(
$admin_network_netmask,
$admin_network_ip,
$cobbler_url,
$cobbler_user = "cobbler",
$cobbler_password = "cobbler",
$mco_pskey,
$mco_vhost,
$mco_host,
$mco_user,
$mco_password,
$mco_connector,
$puppet_master_hostname,
$exclude_network = $admin_network,
$exclude_cidr = $admin_network_cidr,
) {
if $production == 'prod' {
if $production != 'dev' {
package{'nailgun':}
} else {
nailgun::venv::venv { $venv:
@ -134,12 +148,13 @@ class nailgun::venv(
}
}
package {'cronie-anacron': }
file {"/etc/cron.daily/capacity":
content => template("nailgun/cron_daily_capacity.erb"),
owner => 'root',
group => 'root',
mode => 0644
mode => '0644',
require => Package['cronie-anacron']
}
}

View File

@ -9,7 +9,7 @@ define nailgun::venv::venv(
if $ensure == 'present' {
$root_parent = inline_template("<%= venv.match(%r!(.+)/.+!)[1] %>")
$root_parent = inline_template("<%= @venv.match(%r!(.+)/.+!)[1] %>")
if !defined(File[$root_parent]) {
file { $root_parent:

View File

@ -1,4 +1,4 @@
LISTEN_ADDRESS: "127.0.0.1"
LISTEN_ADDRESS: "0.0.0.0"
LISTEN_PORT: "8001"
DEVELOPMENT: false
@ -51,14 +51,14 @@ PATH_TO_BOOTSTRAP_SSH_KEY: "/root/.ssh/bootstrap.rsa"
MASTER_IP: "<%= @admin_network_ip %>"
COBBLER_URL: "<%= scope.lookupvar('nailgun::cobbler_url') %>"
COBBLER_URL: "<%= @cobbler_url %>"
COBBLER_USER: "<%= @cobbler_user %>"
COBBLER_PASSWORD: "<%= @cobbler_password %>"
COBBLER_PROFILE: "centos-x86_64"
MCO_PSKEY: "<%= @mco_pskey %>"
MCO_VHOST: "<%= @mco_vhost %>"
MCO_HOST: <%= scope.lookupvar('nailgun::mco_host') %>
MCO_HOST: <%= @mco_host %>
MCO_USER: "<%= @mco_user %>"
MCO_PASSWORD: "<%= @mco_password %>"
MCO_CONNECTOR: "<%= @mco_connector %>"
@ -67,5 +67,5 @@ PUPPET_MASTER_HOST: "<%= @puppet_master_hostname %>"
PUPPET_VERSION: "2.7.19"
DNS_DOMAIN: "<%= @domain %>"
DNS_SERVERS: "<%= scope.lookupvar('nailgun::puppet_master_ip') %>"
DNS_SERVERS: "<%= @cobbler_url %>"
DNS_SEARCH: "<%= @domain %>"

View File

@ -0,0 +1,70 @@
[rpcinterface:supervisor]
; required for supervisorctl
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[unix_http_server]
file=/var/run/supervisor.sock
[supervisord]
logfile=/var/log/supervisor/supervisord.log
loglevel=debug
pidfile=/var/run/supervisord.pid
childlogdir=/var/log/supervisor
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock
[program:nailgun]
command=/usr/bin/nailgund
process_name=%(program_name)s
numprocs=1
numprocs_start=0
autostart=true
autorestart=true
startsecs=10
startretries=1000000
exitcodes=0,2
stopsignal=INT
stopwaitsecs=60
redirect_stderr=true
stdout_logfile=/var/log/nailgun/app.log
stdout_capture_maxbytes=0
stdout_events_enabled=false
serverurl=AUTO
[program:assassind]
command=/usr/bin/assassind
process_name=%(program_name)s
numprocs=1
numprocs_start=0
autostart=true
autorestart=true
startsecs=10
startretries=1000000
exitcodes=0
stopsignal=INT
stopwaitsecs=60
redirect_stderr=true
stdout_logfile=/var/log/nailgun/assassind.log
stdout_capture_maxbytes=0
stdout_events_enabled=false
serverurl=AUTO
[program:receiverd]
command=/usr/bin/receiverd
process_name=%(program_name)s
numprocs=1
numprocs_start=0
autostart=true
autorestart=true
startsecs=10
startretries=1000000
exitcodes=0
stopsignal=INT
stopwaitsecs=60
redirect_stderr=true
stdout_logfile=/var/log/nailgun/receiverd.log
stdout_capture_maxbytes=0
stdout_events_enabled=false
serverurl=AUTO