diff --git a/deployment_scripts/puppet/manifests/install.pp b/deployment_scripts/puppet/manifests/install.pp index fae25c7..3d52bd8 100644 --- a/deployment_scripts/puppet/manifests/install.pp +++ b/deployment_scripts/puppet/manifests/install.pp @@ -50,6 +50,9 @@ class {'::manila_auxiliary::image': image => $image, } -class {'::manila_auxiliary::ssh_keygen': } +class {'::manila_auxiliary::ssh_keygen': + name => '/root/.ssh/id_rsa', + user => 'root', +} Package['python-pip']->Package['pycrypto']->Package['python-manila']->Package['python-manilaclient']->Package['python-manila-ui'] diff --git a/deployment_scripts/puppet/manifests/site.pp b/deployment_scripts/puppet/manifests/site.pp index 6409e55..74f6551 100644 --- a/deployment_scripts/puppet/manifests/site.pp +++ b/deployment_scripts/puppet/manifests/site.pp @@ -14,13 +14,13 @@ notify {'MODULAR: fuel-plugin-manila/site': } -$manila = hiera_hash('manila', {}) -$db_user = 'manila' -$db_pass = $manila['db_password'] -$db_host = hiera('database_vip') -$sql_conn = "mysql+pymysql://${db_user}:${db_pass}@${db_host}/manila?charset=utf8" - -$image = $manila['service_vm_image']['img_name'] +$manila = hiera_hash('manila', {}) +$db_user = 'manila' +$db_pass = $manila['db_password'] +$manila_pass = $manila['user_password'] +$db_host = hiera('database_vip') +$sql_conn = "mysql+pymysql://${db_user}:${db_pass}@${db_host}/manila?charset=utf8" +$image = $manila['service_vm_image']['img_name'] $rabbit_hash = hiera_hash('rabbit', {}) $amqp_user = $rabbit_hash['user'] @@ -28,58 +28,29 @@ $amqp_password = $rabbit_hash['password'] $amqp_hosts = split(hiera('amqp_hosts', ''), ',') $network_metadata = hiera_hash('network_metadata', {}) +$ns = hiera_hash('network_scheme', {}) $mgmt_ip = $network_metadata['vips']['management']['ipaddr'] +$br_mgmt = split($ns['endpoints']['br-mgmt']['IP'][0], '/') +$br_mgmt_ip = $br_mgmt[0] + + +$neutron = hiera_hash('quantum_settings', {}) +$neutron_pass = $neutron['keystone']['admin_password'] +$auth_url = "http://${mgmt_ip}:35357/" +$auth_uri = "http://${mgmt_ip}:5000/" + +$cinder = hiera_hash('cinder', {}) +$cinder_pass = $cinder['user_password'] + +$nova = hiera_hash('nova', {}) +$nova_pass = $nova['user_password'] $verbose = hiera('verbose') $debug = hiera('debug') $use_syslog = hiera('use_syslog') -$neutron = hiera_hash('quantum_settings', {}) -$neutron_pass = $neutron['keystone']['admin_password'] -$neutron_url = "http://${mgmt_ip}:35357/" -$cinder = hiera_hash('cinder', {}) -$cinder_pass = $cinder['user_password'] -$auth_url = "http://${mgmt_ip}:35357/" - -$nova = hiera_hash('nova', {}) -$nova_pass = $nova['user_password'] - -class {'::manila': - sql_connection => $sql_conn, - rabbit_userid => $amqp_user, - rabbit_hosts => $amqp_hosts, - rabbit_password => $amqp_password, - package_ensure => 'absent', - verbose => $verbose, - debug => $debug, - use_syslog => $use_syslog, - log_facility => 'LOG_LOCAL4', -} - -class {'::manila::quota': -} - -class {'::manila::network::neutron': - neutron_admin_password => $neutron_pass, - neutron_admin_auth_url => $neutron_url, -} - -class {'::manila::volume::cinder': - cinder_admin_password => $cinder_pass, - cinder_admin_auth_url => $auth_url, -} - -class {'::manila::compute::nova': - nova_admin_password => $nova_pass, - nova_admin_auth_url => $auth_url, -} - -class {'::manila::backends': - enabled_share_backends => ['generic'], -} - -$gen = {'generic' => +$backends = {'generic' => {'share_backend_name' => 'generic', 'driver_handles_share_servers' => 'true', 'share_driver' => 'manila.share.drivers.generic.GenericShareDriver', @@ -91,32 +62,25 @@ $gen = {'generic' => } } -create_resources('::manila_auxiliary::backend::generic', $gen) - -exec { 'manual_db_sync': - command => $::manila::params::db_sync_command, - path => '/usr/bin', - user => 'manila', - }-> -class {'::manila::api': - keystone_password => $manila['user_password'], - keystone_auth_host => $mgmt_ip, - package_ensure => 'absent', - enabled => true, - manage_service => true, +class {'::manila_auxiliary': + sql_connection => $sql_conn, + shared_backends => 'generic', #should be array of backends + amqp_durable_queues => 'False', + rabbit_userid => $amqp_user, + rabbit_hosts => $amqp_hosts, + rabbit_use_ssl => 'False', + rabbit_password => $amqp_password, + auth_url => $auth_url, + auth_uri => $auth_uri, + br_mgmt_ip => $br_mgmt_ip, + cinder_pass => $cinder_pass, + manila_pass => $manila_pass, + neutron_pass => $neutron_pass, + nova_pass => $nova_pass, + verbose => $verbose, + debug => $debug, } -class {'::manila::scheduler': - scheduler_driver => 'manila.scheduler.drivers.filter.FilterScheduler', - package_ensure => 'absent', - enabled => true, - manage_service => true, -} +create_resources('::manila_auxiliary::backend::generic', $backends) -class {'::manila::share': - package_ensure => 'absent', - enabled => true, - manage_service => true, -} - -class {'::manila_auxiliary::data': } +class {'::manila_auxiliary::services': } diff --git a/deployment_scripts/puppet/modules/manila_auxiliary/files/manila-common b/deployment_scripts/puppet/modules/manila_auxiliary/files/manila-common new file mode 100644 index 0000000..91bb8e8 --- /dev/null +++ b/deployment_scripts/puppet/modules/manila_auxiliary/files/manila-common @@ -0,0 +1,3 @@ +Defaults:manila !requiretty + +manila ALL = (root) NOPASSWD: /usr/bin/manila-rootwrap /etc/manila/rootwrap.conf * diff --git a/deployment_scripts/puppet/modules/manila_auxiliary/files/meta.sh b/deployment_scripts/puppet/modules/manila_auxiliary/files/meta.sh new file mode 100755 index 0000000..85ce8fb --- /dev/null +++ b/deployment_scripts/puppet/modules/manila_auxiliary/files/meta.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +. /root/openrc + +if [[ -z $(manila type-list|grep default_share_type) ]]; then + echo add default_share_type + manila type-create default_share_type True +fi + +if [[ -z $(manila share-network-list| grep test_share_network) ]];then + echo add test_share_network + net_uid=$(neutron net-list|grep internal|cut -f2 -d' ') + subnet_uid=$(neutron net-list|grep internal|cut -f6 -d' ') + manila share-network-create \ + --name test_share_network \ + --neutron-net-id $net_uid \ + --neutron-subnet-id $subnet_uid +fi + +if [[ -z $(openstack flavor list|grep manila-service-flavor) ]];then + echo add manila-service-flavor + openstack flavor create manila-service-flavor --id 100 --ram 256 --disk 0 --vcpus 1 +fi diff --git a/deployment_scripts/puppet/modules/manila_auxiliary/manifests/conf.pp b/deployment_scripts/puppet/modules/manila_auxiliary/manifests/conf.pp new file mode 100644 index 0000000..d95dd4d --- /dev/null +++ b/deployment_scripts/puppet/modules/manila_auxiliary/manifests/conf.pp @@ -0,0 +1,10 @@ +class manila_auxiliary::conf ( + $default_share_type = 'default_share_type', + ) { + manila_config { + 'DEFAULT/default_share_type': value => $default_share_type; + 'DEFAULT/osapi_share_extension': value => 'manila.api.contrib.standard_extensions'; + 'DEFAULT/enabled_share_protocols': value => 'NFS,CIFS'; + 'DEFAULT/share_name_template': value => 'share-%s'; + } + } diff --git a/deployment_scripts/puppet/modules/manila_auxiliary/manifests/data.pp b/deployment_scripts/puppet/modules/manila_auxiliary/manifests/data.pp deleted file mode 100644 index 00cc99d..0000000 --- a/deployment_scripts/puppet/modules/manila_auxiliary/manifests/data.pp +++ /dev/null @@ -1,6 +0,0 @@ -class manila_auxiliary::data () { - service {'manila-data': - ensure => ''running, - name => 'manila-data', -} -} diff --git a/deployment_scripts/puppet/modules/manila_auxiliary/manifests/fs.pp b/deployment_scripts/puppet/modules/manila_auxiliary/manifests/fs.pp index b4ccf04..62be4af 100644 --- a/deployment_scripts/puppet/modules/manila_auxiliary/manifests/fs.pp +++ b/deployment_scripts/puppet/modules/manila_auxiliary/manifests/fs.pp @@ -16,7 +16,17 @@ class manila_auxiliary::fs () { owner => 'manila', group => 'manila', } - file { '/var/log/manila': + file {'/var/log/manila': + ensure => 'directory', + owner => 'manila', + group => 'manila', + } + file {'/var/lib/manila': + ensure => 'directory', + owner => 'manila', + group => 'manila', + }-> + file {'/var/lib/manila/tmp': ensure => 'directory', owner => 'manila', group => 'manila', @@ -38,12 +48,17 @@ class manila_auxiliary::fs () { } file {'/etc/manila/rootwrap.conf': source => 'puppet:///modules/manila_auxiliary/rootwrap.conf', - owner => 'manila', - group => 'manila', + owner => 'root', + group => 'root', } file {'/etc/manila/rootwrap.d/share.filters': source => 'puppet:///modules/manila_auxiliary/share.filters', - owner => 'manila', - group => 'manila', + owner => 'root', + group => 'root', + } + file {'/etc/sudoers.d/manila-common': + source => 'puppet:///modules/manila_auxiliary/manila-common', + owner => 'root', + group => 'root', } } diff --git a/deployment_scripts/puppet/modules/manila_auxiliary/manifests/init.pp b/deployment_scripts/puppet/modules/manila_auxiliary/manifests/init.pp index 01dca4e..79dbc3f 100644 --- a/deployment_scripts/puppet/modules/manila_auxiliary/manifests/init.pp +++ b/deployment_scripts/puppet/modules/manila_auxiliary/manifests/init.pp @@ -43,5 +43,106 @@ # Copyright 2016 Your name here, unless otherwise noted. # -class manila_auxiliary () { +class manila_auxiliary ( + $sql_connection = $sql_conn, + $shared_backends = undef, + $amqp_durable_queues = 'False', + $rabbit_userid = 'nova', + $rabbit_hosts = undef, + $rabbit_use_ssl = 'False', + $rabbit_password = undef, + $auth_url = undef, + $auth_uri = undef, + $cinder_pass = undef, + $br_mgmt_ip = undef, + $manila_pass = undef, + $neutron_pass = undef, + $nova_pass = undef, + $project_domain_id = 'default', + $project_name = 'services', + $user_domain_id = 'default', + $project_domain_name = 'Default', + $verbose = $verbose, + $debug = $debug, + ) { + + $lcfs = '%(asctime)s.%(msecs)d %(color)s%(levelname)s %(name)s %(request_id)s %(user_id)s %(project_id)s%(color)s] %(instance)s%(color)s%(message)s' + $ldfs = '%(asctime)s.%(msecs)d %(color)s%(levelname)s %(name)s -%(color)s %(instance)s%(color)s%(message)s' + $ldeb = 'from (pid=%(process)d) %(funcName)s %(pathname)s:%(lineno)d' + $lep = '%(color)s%(asctime)s.%(msecs)d TRACE %(name)s %(instance)s' + + $scheduler_driver = 'manila.scheduler.drivers.filter.FilterScheduler' + + manila_config { + 'DEFAULT/api_paste_config': value => '/etc/manila/api-paste.ini'; + 'DEFAULT/state_path': value => '/var/lib/manila'; + 'DEFAULT/osapi_share_extension': value => 'manila.api.contrib.standard_extensions'; + 'DEFAULT/default_share_type': value => 'default_share_type'; + 'DEFAULT/rootwrap_config': value => '/etc/manila/rootwrap.conf'; + 'DEFAULT/auth_strategy': value => 'keystone'; + 'DEFAULT/enabled_share_backends': value => $shared_backends; + 'DEFAULT/enabled_share_protocols': value => 'NFS,CIFS'; + 'DEFAULT/share_name_template': value => 'share-%s'; + 'DEFAULT/scheduler_driver': value => $scheduler_driver; + 'DEFAULT/debug': value => $debug; + 'DEFAULT/logging_context_format_string': value => $lcfs; + 'DEFAULT/logging_default_format_string': value => $ldfs; + 'DEFAULT/logging_debug_format_suffix': value => $ldeb; + 'DEFAULT/logging_exception_prefix': value => $lep; + 'DEFAULT/rpc_backend': value => 'rabbit'; + } + manila_config { + 'oslo_messaging_rabbit/amqp_durable_queues': value => $amqp_durable_queues; + 'oslo_messaging_rabbit/rabbit_hosts': value => $rabbit_hosts; + 'oslo_messaging_rabbit/rabbit_use_ssl': value => $rabbit_use_ssl; + 'oslo_messaging_rabbit/rabbit_userid': value => $rabbit_userid; + 'oslo_messaging_rabbit/rabbit_password': value => $rabbit_password; + 'oslo_messaging_rabbit/rabbit_virtual_host': value => '/'; + 'oslo_messaging_rabbit/rabbit_ha_queues': value => 'True'; + 'oslo_messaging_rabbit/heartbeat_rate': value => '2'; + } + manila_config { + 'oslo_concurrency/lock_path': value => '/var/lib/manila/tmp'; + } + manila_config { + 'database/connection': value => $sql_connection; + } + manila_config { + 'cinder/auth_url': value => $auth_url; + 'cinder/auth_type': value => 'password'; + 'cinder/password': value => $cinder_pass; + 'cinder/project_domain_id': value => $project_domain_id; + 'cinder/project_name': value => $project_name; + 'cinder/user_domain_id': value => $user_domain_id; + 'cinder/username': value => 'cinder'; + } + manila_config { + 'keystone_authtoken/auth_uri': value => $auth_uri; + 'keystone_authtoken/signing_dir': value => '/tmp/keystone-signing-manila'; + 'keystone_authtoken/memcached_servers': value => "${br_mgmt_ip}:11211"; + 'keystone_authtoken/admin_password': value => $manila_pass; + 'keystone_authtoken/admin_tenant_name': value => $project_name; + 'keystone_authtoken/identity_uri': value => $auth_uri; + 'keystone_authtoken/admin_user': value => 'manila'; + 'keystone_authtoken/signing_dirname': value => '/tmp/keystone-signing-manila'; + } + manila_config { + 'neutron/auth_url': value => $auth_url; + 'neutron/auth_type': value => 'password'; + 'neutron/password': value => $neutron_pass; + 'neutron/project_domain_id': value => $project_domain_id; + 'neutron/project_domain_name': value => $project_domain_name; + 'neutron/project_name': value => $project_name; + 'neutron/user_domain_id': value => $user_domain_id; + 'neutron/username': value => 'neutron'; + } + manila_config { + 'nova/auth_url': value => $auth_url; + 'nova/auth_type': value => 'password'; + 'nova/password': value => $nova_pass; + 'nova/project_domain_id': value => $project_domain_id; + 'nova/project_name': value => $project_name; + 'nova/user_domain_id': value => $user_domain_id; + 'nova/username': value => 'nova'; + } } diff --git a/deployment_scripts/puppet/modules/manila_auxiliary/manifests/meta.pp b/deployment_scripts/puppet/modules/manila_auxiliary/manifests/meta.pp new file mode 100644 index 0000000..18fc4d2 --- /dev/null +++ b/deployment_scripts/puppet/modules/manila_auxiliary/manifests/meta.pp @@ -0,0 +1,10 @@ +class manila_auxiliary::meta ( + ) { + file {'/tmp/meta.sh': + source => 'puppet:///modules/manila_auxiliary/meta.sh', + }-> + exec {'manila_meta': + command => '/tmp/meta.sh', + path => '/bin:/usr/bin', + } + } diff --git a/deployment_scripts/puppet/modules/manila_auxiliary/manifests/services.pp b/deployment_scripts/puppet/modules/manila_auxiliary/manifests/services.pp new file mode 100644 index 0000000..e988b1b --- /dev/null +++ b/deployment_scripts/puppet/modules/manila_auxiliary/manifests/services.pp @@ -0,0 +1,29 @@ +class manila_auxiliary::services () { + exec { 'manual_db_sync': + command => 'manila-manage db sync', + path => '/usr/bin', + user => 'manila', + }-> + service { 'manila-api': + ensure => 'running', + name => 'manila-api', + enable => true, + hasstatus => true, + }-> + service { 'manila-scheduler': + ensure => 'running', + name => 'manila-scheduler', + enable => true, + hasstatus => true, + }-> + service { 'manila-share': + ensure => 'running', + name => 'manila-share', + enable => true, + hasstatus => true, + }-> + service {'manila-data': + ensure => 'running', + name => 'manila-data', + } +}