diff --git a/manifests/site.pp b/manifests/site.pp index 4f6cb82b5f..90519c7340 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -400,7 +400,7 @@ node 'status.openstack.org' { } node 'nodepool.openstack.org' { - class { 'openstack_project::nodepool': + class { 'openstack_project::nodepool_prod': mysql_password => hiera('nodepool_mysql_password'), mysql_root_password => hiera('nodepool_mysql_root_password'), nodepool_ssh_private_key => hiera('jenkins_ssh_private_key_contents'), diff --git a/modules/nodepool/manifests/init.pp b/modules/nodepool/manifests/init.pp index fadb0e7a42..a211509d89 100644 --- a/modules/nodepool/manifests/init.pp +++ b/modules/nodepool/manifests/init.pp @@ -27,6 +27,7 @@ class nodepool ( $vhost_name = 'nodepool.openstack.org', $image_log_document_root = '/var/log/nodepool/image', $enable_image_log_via_http = false, + $environment = {}, ) { class { 'mysql::server': diff --git a/modules/nodepool/templates/nodepool.default.erb b/modules/nodepool/templates/nodepool.default.erb index 657027e788..a0be88dde9 100644 --- a/modules/nodepool/templates/nodepool.default.erb +++ b/modules/nodepool/templates/nodepool.default.erb @@ -1,6 +1,8 @@ -<% if scope.lookupvar("nodepool::statsd_host") != "" %> +<% if scope.lookupvar("nodepool::statsd_host") != "" -%> export STATSD_HOST=<%= scope.lookupvar("nodepool::statsd_host") %> export STATSD_PORT=8125 -<% end %> +<% end -%> +<% scope.lookupvar("nodepool::environment").keys.sort.each do |key| -%> +export <%= key %>='<%= scope.lookupvar("nodepool::environment")[key] %>' +<% end -%> DAEMON_ARGS="-c /etc/nodepool/nodepool.yaml -l /etc/nodepool/logging.conf" - diff --git a/modules/openstack_project/manifests/jenkins_dev.pp b/modules/openstack_project/manifests/jenkins_dev.pp index ca772ffeac..48eb8630df 100644 --- a/modules/openstack_project/manifests/jenkins_dev.pp +++ b/modules/openstack_project/manifests/jenkins_dev.pp @@ -12,6 +12,7 @@ class openstack_project::jenkins_dev ( $hpcloud_username ='', $hpcloud_password ='', $hpcloud_project ='', + $nodepool_template ='nodepool-dev.yaml.erb', ) { include openstack_project @@ -139,17 +140,36 @@ class openstack_project::jenkins_dev ( } class { '::nodepool': - mysql_password => 'mysql_password', - mysql_root_password => 'mysql_root_password', - nodepool_ssh_private_key => 'nodepool_ssh_private_key', - nodepool_template => 'nodepool-dev.yaml.erb', - sysadmins => 'sysadmins', - jenkins_api_user => 'jenkins_api_user', - jenkins_api_key => 'jenkins_api_key', - jenkins_credentials_id => 'jenkins_credentials_id', - hpcloud_username => 'hpcloud_username', - hpcloud_password => 'hpcloud_password', - hpcloud_project => 'hpcloud_project', + mysql_root_password => $mysql_root_password, + mysql_password => $mysql_password, + nodepool_ssh_private_key => $nodepool_ssh_private_key, + environment => { + 'NODEPOOL_SSH_KEY' => $openstack_project::jenkins_dev_ssh_key, + } + } + + file { '/etc/nodepool/nodepool.yaml': + ensure => present, + owner => 'nodepool', + group => 'root', + mode => '0400', + content => template("openstack_project/nodepool/${nodepool_template}"), + require => [ + File['/etc/nodepool'], + User['nodepool'], + ], + } + + file { '/etc/nodepool/scripts': + ensure => directory, + owner => 'root', + group => 'root', + mode => '0755', + recurse => true, + purge => true, + force => true, + require => File['/etc/nodepool'], + source => 'puppet:///modules/openstack_project/nodepool/scripts', } } diff --git a/modules/openstack_project/manifests/nodepool.pp b/modules/openstack_project/manifests/nodepool_prod.pp similarity index 95% rename from modules/openstack_project/manifests/nodepool.pp rename to modules/openstack_project/manifests/nodepool_prod.pp index faf93725b4..cd5cee8df5 100644 --- a/modules/openstack_project/manifests/nodepool.pp +++ b/modules/openstack_project/manifests/nodepool_prod.pp @@ -1,6 +1,6 @@ -# == Class: openstack_project::nodepool +# == Class: openstack_project::nodepool_prod # -class openstack_project::nodepool( +class openstack_project::nodepool_prod( $mysql_root_password, $mysql_password, $nodepool_ssh_private_key = '',