diff --git a/Puppetfile b/Puppetfile index 7f424ffb6..1451b1a60 100644 --- a/Puppetfile +++ b/Puppetfile @@ -68,6 +68,10 @@ mod 'nova', :git => 'https://git.openstack.org/openstack/puppet-nova', :ref => 'master' +mod 'openstack_integration', + :git => 'https://git.openstack.org/openstack/puppet-openstack-integration', + :ref => 'master' + mod 'openstack_extras', :git => 'https://git.openstack.org/openstack/puppet-openstack_extras', :ref => 'master' diff --git a/fixtures/scenario001.pp b/fixtures/scenario001.pp index 802760340..0eb9d8c7a 100644 --- a/fixtures/scenario001.pp +++ b/fixtures/scenario001.pp @@ -14,81 +14,24 @@ # limitations under the License. # -Exec { logoutput => 'on_failure' } +include ::openstack_integration +include ::openstack_integration::repos +include ::openstack_integration::rabbitmq +include ::openstack_integration::mysql +include ::openstack_integration::keystone -# Common resources -case $::osfamily { - 'Debian': { - include ::apt - class { '::openstack_extras::repo::debian::ubuntu': - release => 'liberty', - package_require => true, - } - $package_provider = 'apt' - } - 'RedHat': { - class { '::openstack_extras::repo::redhat::redhat': - release => 'liberty', - } - package { 'openstack-selinux': ensure => 'latest' } - $package_provider = 'yum' - } - default: { - fail("Unsupported osfamily (${::osfamily})") - } -} - -# Deploy MySQL Server -class { '::mysql::server': } - -# Deploy RabbitMQ -class { '::rabbitmq': - delete_guest_user => true, - package_provider => $package_provider, -} -rabbitmq_vhost { '/': - provider => 'rabbitmqctl', - require => Class['rabbitmq'], -} rabbitmq_user { ['neutron', 'nova', 'cinder', 'ceilometer', 'glance', 'trove']: admin => true, password => 'an_even_bigger_secret', provider => 'rabbitmqctl', - require => Class['rabbitmq'], + require => Class['::rabbitmq'], } rabbitmq_user_permissions { ['neutron@/', 'nova@/', 'cinder@/', 'ceilometer@/', 'glance@/', 'trove@/']: configure_permission => '.*', write_permission => '.*', read_permission => '.*', provider => 'rabbitmqctl', - require => Class['rabbitmq'], -} - -# Deploy Keystone -class { '::keystone::client': } -class { '::keystone::cron::token_flush': } -class { '::keystone::db::mysql': - password => 'keystone', -} -class { '::keystone': - verbose => true, - debug => true, - database_connection => 'mysql://keystone:keystone@127.0.0.1/keystone', - admin_token => 'admin_token', - enabled => true, - service_name => 'httpd', -} -include ::apache -class { '::keystone::wsgi::apache': - ssl => false, - workers => 2, -} -class { '::keystone::roles::admin': - email => 'test@example.tld', - password => 'a_big_secret', -} -class { '::keystone::endpoint': - default_domain => 'admin', + require => Class['::rabbitmq'], } # Deploy Glance diff --git a/fixtures/scenario002.pp b/fixtures/scenario002.pp index 26d5678a5..0fdd63d11 100644 --- a/fixtures/scenario002.pp +++ b/fixtures/scenario002.pp @@ -14,81 +14,24 @@ # limitations under the License. # -Exec { logoutput => 'on_failure' } +include ::openstack_integration +include ::openstack_integration::repos +include ::openstack_integration::rabbitmq +include ::openstack_integration::mysql +include ::openstack_integration::keystone -# Common resources -case $::osfamily { - 'Debian': { - include ::apt - class { '::openstack_extras::repo::debian::ubuntu': - release => 'liberty', - package_require => true, - } - $package_provider = 'apt' - } - 'RedHat': { - class { '::openstack_extras::repo::redhat::redhat': - release => 'liberty', - } - package { 'openstack-selinux': ensure => 'latest' } - $package_provider = 'yum' - } - default: { - fail("Unsupported osfamily (${::osfamily})") - } -} - -# Deploy MySQL Server -class { '::mysql::server': } - -# Deploy RabbitMQ -class { '::rabbitmq': - delete_guest_user => true, - package_provider => $package_provider, -} -rabbitmq_vhost { '/': - provider => 'rabbitmqctl', - require => Class['rabbitmq'], -} rabbitmq_user { ['glance', 'nova', 'neutron', 'sahara', 'heat']: admin => true, password => 'an_even_bigger_secret', provider => 'rabbitmqctl', - require => Class['rabbitmq'], + require => Class['::rabbitmq'], } rabbitmq_user_permissions { ['glance@/', 'nova@/', 'neutron@/', 'sahara@/', 'heat@/']: configure_permission => '.*', write_permission => '.*', read_permission => '.*', provider => 'rabbitmqctl', - require => Class['rabbitmq'], -} - -# Deploy Keystone -class { '::keystone::client': } -class { '::keystone::cron::token_flush': } -class { '::keystone::db::mysql': - password => 'keystone', -} -class { '::keystone': - verbose => true, - debug => true, - database_connection => 'mysql://keystone:keystone@127.0.0.1/keystone', - admin_token => 'admin_token', - enabled => true, - service_name => 'httpd', -} -include ::apache -class { '::keystone::wsgi::apache': - ssl => false, - workers => 2, -} -class { '::keystone::roles::admin': - email => 'test@example.tld', - password => 'a_big_secret', -} -class { '::keystone::endpoint': - default_domain => 'admin', + require => Class['::rabbitmq'], } # Deploy Glance diff --git a/functions b/functions index 556c1a205..6f845db1d 100644 --- a/functions +++ b/functions @@ -36,6 +36,10 @@ EOF --zuul-branch $ZUUL_BRANCH \ --zuul-url $ZUUL_URL \ git://git.openstack.org $project_names + + # Because openstack-integration can't be a class name. + # https://projects.puppetlabs.com/issues/5268 + mv $PUPPETFILE_DIR/openstack-integration $PUPPETFILE_DIR/openstack_integration } # Install all Puppet modules with r10k diff --git a/manifests/init.pp b/manifests/init.pp new file mode 100644 index 000000000..1847d1e32 --- /dev/null +++ b/manifests/init.pp @@ -0,0 +1,5 @@ +class openstack_integration { + + Exec { logoutput => 'on_failure' } + +} diff --git a/manifests/keystone.pp b/manifests/keystone.pp new file mode 100644 index 000000000..5fcc1b25d --- /dev/null +++ b/manifests/keystone.pp @@ -0,0 +1,29 @@ +class openstack_integration::keystone { + + class { '::keystone::client': } + class { '::keystone::cron::token_flush': } + class { '::keystone::db::mysql': + password => 'keystone', + } + class { '::keystone': + verbose => true, + debug => true, + database_connection => 'mysql://keystone:keystone@127.0.0.1/keystone', + admin_token => 'admin_token', + enabled => true, + service_name => 'httpd', + } + include ::apache + class { '::keystone::wsgi::apache': + ssl => false, + workers => 2, + } + class { '::keystone::roles::admin': + email => 'test@example.tld', + password => 'a_big_secret', + } + class { '::keystone::endpoint': + default_domain => 'admin', + } + +} diff --git a/manifests/mysql.pp b/manifests/mysql.pp new file mode 100644 index 000000000..435f5f12d --- /dev/null +++ b/manifests/mysql.pp @@ -0,0 +1,5 @@ +class openstack_integration::mysql { + + class { '::mysql::server': } + +} diff --git a/manifests/rabbitmq.pp b/manifests/rabbitmq.pp new file mode 100644 index 000000000..6597a6d9d --- /dev/null +++ b/manifests/rabbitmq.pp @@ -0,0 +1,24 @@ +class openstack_integration::rabbitmq { + + case $::osfamily { + 'Debian': { + $package_provider = 'apt' + } + 'RedHat': { + $package_provider = 'yum' + } + default: { + fail("Unsupported osfamily (${::osfamily})") + } + } + + class { '::rabbitmq': + delete_guest_user => true, + package_provider => $package_provider, + } + rabbitmq_vhost { '/': + provider => 'rabbitmqctl', + require => Class['::rabbitmq'], + } + +} diff --git a/manifests/repos.pp b/manifests/repos.pp new file mode 100644 index 000000000..fd01d3324 --- /dev/null +++ b/manifests/repos.pp @@ -0,0 +1,24 @@ +class openstack_integration::repos { + + case $::osfamily { + 'Debian': { + include ::apt + class { '::openstack_extras::repo::debian::ubuntu': + release => 'liberty', + package_require => true, + } + $package_provider = 'apt' + } + 'RedHat': { + class { '::openstack_extras::repo::redhat::redhat': + release => 'liberty', + } + package { 'openstack-selinux': ensure => 'latest' } + $package_provider = 'yum' + } + default: { + fail("Unsupported osfamily (${::osfamily})") + } + } + +}