summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorApsar, Shaik (sa709c) <sa709c@intl.att.com>2015-12-31 21:59:31 +0530
committerApsar, Shaik (sa709c) <sa709c@intl.att.com>2016-01-08 17:03:39 +0530
commit219f2ff75daf06790c7cf876c474f926aa34792b (patch)
tree94363b36154b2bd6a38bf31a8e9a6f337084ae45
parent5144e1aad0ebdbf52816b07cf4d95bd6e2def322 (diff)
Trove fuel plugin changes for implementing new fuel Trove role.7.0
Notes
Notes (review): Code-Review+1: Mateusz Matuszkowiak <mmatuszkowiak@mirantis.com> Code-Review+2: Ram Sateesh Talari <ramsateesh.talari@intl.att.com> Workflow+1: Ram Sateesh Talari <ramsateesh.talari@intl.att.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Thu, 03 Mar 2016 07:52:00 +0000 Reviewed-on: https://review.openstack.org/262811 Project: openstack/fuel-plugin-dbaas-trove Branch: refs/heads/master
-rw-r--r--deployment_scripts/puppet/manifests/cluster.pp50
-rw-r--r--deployment_scripts/puppet/manifests/db.pp53
-rw-r--r--deployment_scripts/puppet/manifests/haproxy.pp48
-rw-r--r--deployment_scripts/puppet/manifests/keystone.pp44
-rw-r--r--deployment_scripts/puppet/manifests/rabbitmq.pp147
-rw-r--r--deployment_scripts/puppet/manifests/trove.pp92
-rw-r--r--deployment_scripts/puppet/modules/trove/.gitignore8
-rw-r--r--deployment_scripts/puppet/modules/trove/.gitreview4
-rw-r--r--deployment_scripts/puppet/modules/trove/CHANGELOG.md18
-rw-r--r--deployment_scripts/puppet/modules/trove/Gemfile35
-rw-r--r--deployment_scripts/puppet/modules/trove/LICENSE176
-rw-r--r--deployment_scripts/puppet/modules/trove/README.md70
-rw-r--r--deployment_scripts/puppet/modules/trove/Rakefile73
-rw-r--r--deployment_scripts/puppet/modules/trove/examples/site.pp38
-rw-r--r--deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove.rb113
-rw-r--r--deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_api_paste_ini/ini_setting.rb27
-rw-r--r--deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_conductor_config/ini_setting.rb27
-rw-r--r--deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_config/ini_setting.rb27
-rw-r--r--deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_datastore/trove.rb52
-rw-r--r--deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_datastore_version/trove.rb60
-rw-r--r--deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_guestagent_config/ini_setting.rb27
-rw-r--r--deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_taskmanager_config/ini_setting.rb27
-rw-r--r--deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_api_paste_ini.rb42
-rw-r--r--deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_conductor_config.rb42
-rw-r--r--deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_config.rb42
-rw-r--r--deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_datastore.rb26
-rw-r--r--deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_datastore_version.rb38
-rw-r--r--deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_guestagent_config.rb42
-rw-r--r--deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_taskmanager_config.rb42
-rw-r--r--deployment_scripts/puppet/modules/trove/manifests/api.pp370
-rw-r--r--deployment_scripts/puppet/modules/trove/manifests/client.pp40
-rw-r--r--deployment_scripts/puppet/modules/trove/manifests/conductor.pp224
-rw-r--r--deployment_scripts/puppet/modules/trove/manifests/config.pp84
-rw-r--r--deployment_scripts/puppet/modules/trove/manifests/db/mysql.pp83
-rw-r--r--deployment_scripts/puppet/modules/trove/manifests/db/postgresql.pp47
-rw-r--r--deployment_scripts/puppet/modules/trove/manifests/db/sync.pp28
-rw-r--r--deployment_scripts/puppet/modules/trove/manifests/generic_service.pp91
-rw-r--r--deployment_scripts/puppet/modules/trove/manifests/guestagent.pp213
-rw-r--r--deployment_scripts/puppet/modules/trove/manifests/init.pp259
-rw-r--r--deployment_scripts/puppet/modules/trove/manifests/keystone/auth.pp220
-rw-r--r--deployment_scripts/puppet/modules/trove/manifests/params.pp35
-rw-r--r--deployment_scripts/puppet/modules/trove/manifests/rabbitmq.pp106
-rw-r--r--deployment_scripts/puppet/modules/trove/manifests/taskmanager.pp281
-rw-r--r--deployment_scripts/puppet/modules/trove/metadata.json39
-rw-r--r--deployment_scripts/puppet/modules/trove/spec/acceptance/basic_trove_spec.rb114
-rw-r--r--deployment_scripts/puppet/modules/trove/spec/acceptance/nodesets/default.yml9
-rw-r--r--deployment_scripts/puppet/modules/trove/spec/acceptance/nodesets/nodepool-centos7.yml10
-rw-r--r--deployment_scripts/puppet/modules/trove/spec/acceptance/nodesets/nodepool-trusty.yml10
-rw-r--r--deployment_scripts/puppet/modules/trove/spec/classes/trove_api_spec.rb194
-rw-r--r--deployment_scripts/puppet/modules/trove/spec/classes/trove_client_spec.rb55
-rw-r--r--deployment_scripts/puppet/modules/trove/spec/classes/trove_conductor_spec.rb153
-rw-r--r--deployment_scripts/puppet/modules/trove/spec/classes/trove_config_spec.rb63
-rw-r--r--deployment_scripts/puppet/modules/trove/spec/classes/trove_db_mysql_spec.rb109
-rw-r--r--deployment_scripts/puppet/modules/trove/spec/classes/trove_db_postgresql_spec.rb58
-rw-r--r--deployment_scripts/puppet/modules/trove/spec/classes/trove_guestagent_spec.rb158
-rw-r--r--deployment_scripts/puppet/modules/trove/spec/classes/trove_init_spec.rb66
-rw-r--r--deployment_scripts/puppet/modules/trove/spec/classes/trove_keystone_auth_spec.rb141
-rw-r--r--deployment_scripts/puppet/modules/trove/spec/classes/trove_taskmanager_spec.rb211
-rw-r--r--deployment_scripts/puppet/modules/trove/spec/shared_examples.rb56
-rw-r--r--deployment_scripts/puppet/modules/trove/spec/spec_helper.rb7
-rw-r--r--deployment_scripts/puppet/modules/trove/spec/spec_helper_acceptance.rb56
-rw-r--r--deployment_scripts/puppet/modules/trove/spec/unit/provider/trove_config/ini_setting_spec.rb37
-rw-r--r--deployment_scripts/puppet/modules/trove/spec/unit/provider/trove_datastore/trove_spec.rb57
-rw-r--r--deployment_scripts/puppet/modules/trove/spec/unit/provider/trove_datastore_version/trove_spec.rb50
-rw-r--r--deployment_scripts/puppet/modules/trove/spec/unit/provider/trove_spec.rb14
-rw-r--r--deployment_scripts/puppet/modules/trove/spec/unit/type/trove_config_spec.rb52
-rw-r--r--deployment_scripts/puppet/modules/trove/templates/rabbitmq-init-centos.erb182
-rw-r--r--deployment_scripts/puppet/modules/trove/templates/rabbitmq-init-ubuntu.erb231
-rw-r--r--deployment_scripts/puppet/modules/trove/templates/rabbitmq.config.erb7
-rw-r--r--deployment_scripts/puppet/modules/trove/templates/trove-guestagent.conf.erb73
-rw-r--r--deployment_tasks.yaml106
-rw-r--r--environment_config.yaml18
-rw-r--r--metadata.yaml18
-rw-r--r--network_roles.yaml12
-rw-r--r--node_roles.yaml13
-rwxr-xr-xpre_build_hook4
-rw-r--r--volumes.yaml1
77 files changed, 5899 insertions, 56 deletions
diff --git a/deployment_scripts/puppet/manifests/cluster.pp b/deployment_scripts/puppet/manifests/cluster.pp
new file mode 100644
index 0000000..a8491a0
--- /dev/null
+++ b/deployment_scripts/puppet/manifests/cluster.pp
@@ -0,0 +1,50 @@
1notice('MODULAR: trove/cluster.pp')
2
3if !(hiera('role') in ['trove']) {
4 fail('The node role is not in trove roles')
5}
6
7$network_scheme = hiera_hash('network_scheme', {})
8$network_metadata = hiera_hash('network_metadata', {})
9
10prepare_network_config($network_scheme)
11
12$trove_node = get_nodes_hash_by_roles($network_metadata, ['trove'])
13
14$corosync_nodes = corosync_nodes($trove_node, 'trove/api')
15
16$network_ip = get_network_role_property('trove/api', 'ipaddr')
17
18class { 'cluster':
19 internal_address => $network_ip,
20 corosync_nodes => $corosync_nodes,
21}
22
23pcmk_nodes { 'pacemaker' :
24 nodes => $corosync_nodes,
25 add_pacemaker_nodes => false,
26}
27
28Service <| title == 'corosync' |> {
29 subscribe => File['/etc/corosync/service.d'],
30 require => File['/etc/corosync/corosync.conf'],
31}
32
33Service['corosync'] -> Pcmk_nodes<||>
34Pcmk_nodes<||> -> Service<| provider == 'pacemaker' |>
35
36# Sometimes during first start pacemaker can not connect to corosync
37# via IPC due to pacemaker and corosync processes are run under different users
38if($::operatingsystem == 'Ubuntu') {
39 $pacemaker_run_uid = 'hacluster'
40 $pacemaker_run_gid = 'haclient'
41
42 file {'/etc/corosync/uidgid.d/pacemaker':
43 content =>"uidgid {
44 uid: ${pacemaker_run_uid}
45 gid: ${pacemaker_run_gid}
46}"
47 }
48
49 File['/etc/corosync/corosync.conf'] -> File['/etc/corosync/uidgid.d/pacemaker'] -> Service <| title == 'corosync' |>
50} \ No newline at end of file
diff --git a/deployment_scripts/puppet/manifests/db.pp b/deployment_scripts/puppet/manifests/db.pp
new file mode 100644
index 0000000..8bb2be9
--- /dev/null
+++ b/deployment_scripts/puppet/manifests/db.pp
@@ -0,0 +1,53 @@
1notice('MODULAR: trove/db.pp')
2
3$node_name = hiera('node_name')
4$trove_hash = hiera_hash('fuel-plugin-dbaas-trove', {})
5$trove_enabled = pick($trove_hash['metadata']['enabled'], false)
6$mysql_hash = hiera_hash('mysql_hash', {})
7$management_vip = hiera('management_vip', undef)
8$database_vip = hiera('database_vip')
9
10$mysql_root_user = pick($mysql_hash['root_user'], 'root')
11$mysql_db_create = pick($mysql_hash['db_create'], true)
12$mysql_root_password = $mysql_hash['root_password']
13
14$db_user = pick($trove_hash['metadata']['db_user'], 'trove')
15$db_name = pick($trove_hash['metadata']['db_name'], 'trove')
16$db_password = pick($trove_hash['metadata']['db_password'], $mysql_root_password)
17
18$db_host = pick($trove_hash['metadata']['db_host'], $database_vip, 'localhost')
19$db_create = pick($trove_hash['metadata']['db_create'], $mysql_db_create)
20$db_root_user = pick($trove_hash['metadata']['root_user'], $mysql_root_user)
21$db_root_password = pick($trove_hash['metadata']['root_password'], $mysql_root_password)
22
23$allowed_hosts = [ $node_name, 'localhost', '127.0.0.1', '%' ]
24
25if $trove_enabled and $db_create {
26
27 class { 'galera::client':
28 custom_setup_class => hiera('mysql_custom_setup_class', 'galera'),
29 }
30
31 class { 'trove::db::mysql':
32 user => $db_user,
33 password => $db_password,
34 dbname => $db_name,
35 allowed_hosts => $allowed_hosts,
36 }
37
38 class { 'osnailyfacter::mysql_access':
39 db_host => $db_host,
40 db_user => $db_root_user,
41 db_password => $db_root_password,
42 }
43
44 Class['galera::client'] ->
45 Class['osnailyfacter::mysql_access'] ->
46 Class['trove::db::mysql']
47
48}
49
50class mysql::config {}
51include mysql::config
52class mysql::server {}
53include mysql::server \ No newline at end of file
diff --git a/deployment_scripts/puppet/manifests/haproxy.pp b/deployment_scripts/puppet/manifests/haproxy.pp
new file mode 100644
index 0000000..8464beb
--- /dev/null
+++ b/deployment_scripts/puppet/manifests/haproxy.pp
@@ -0,0 +1,48 @@
1notice('MODULAR: trove/haproxy.pp')
2
3$network_metadata = hiera_hash('network_metadata')
4$trove_hash = hiera_hash('fuel-plugin-dbaas-trove', {})
5# enabled by default
6$use_trove = pick($trove_hash['metadata']['enabled'], true)
7$public_ssl_hash = hiera('public_ssl')
8
9$troves_address_map = get_node_to_ipaddr_map_by_network_role(get_nodes_hash_by_roles($network_metadata, ['trove']), 'trove/api')
10
11if ($use_trove) {
12 $server_names = hiera_array('trove_names', keys($troves_address_map))
13 $ipaddresses = hiera_array('trove_ipaddresses', values($troves_address_map))
14 $public_virtual_ip = hiera('public_vip')
15 $internal_virtual_ip = hiera('management_vip')
16
17 # configure trove ha proxy
18 Openstack::Ha::Haproxy_service {
19 internal_virtual_ip => $internal_virtual_ip,
20 ipaddresses => $ipaddresses,
21 public_virtual_ip => $public_virtual_ip,
22 server_names => $server_names,
23 public_ssl => $public_ssl_hash['services'],
24 }
25
26 openstack::ha::haproxy_service { 'trove-api':
27 order => '210',
28 listen_port => 8779,
29 internal => true,
30 public => true,
31 }
32
33 openstack::ha::haproxy_service { 'trove-rabbitmq':
34 order => '211',
35 listen_port => 55671,
36 define_backups => true,
37 internal => true,
38 public => true,
39 haproxy_config_options => {
40 'option' => ['tcpka'],
41 'timeout client' => '48h',
42 'timeout server' => '48h',
43 'balance' => 'roundrobin',
44 'mode' => 'tcp'
45 },
46 balancermember_options => 'check inter 5000 rise 2 fall 3',
47 }
48}
diff --git a/deployment_scripts/puppet/manifests/keystone.pp b/deployment_scripts/puppet/manifests/keystone.pp
new file mode 100644
index 0000000..2d22f34
--- /dev/null
+++ b/deployment_scripts/puppet/manifests/keystone.pp
@@ -0,0 +1,44 @@
1notice('MODULAR: trove/keystone.pp')
2
3$trove_hash = hiera_hash('fuel-plugin-dbaas-trove', {})
4$public_ssl_hash = hiera('public_ssl')
5$public_vip = hiera('public_vip')
6$public_address = $public_ssl_hash['services'] ? {
7 true => $public_ssl_hash['hostname'],
8 default => $public_vip,
9}
10$public_protocol = $public_ssl_hash['services'] ? {
11 true => 'https',
12 default => 'http',
13}
14$admin_protocol = 'http'
15$admin_address = hiera('management_vip')
16$region = pick($trove_hash['metadata']['region'], hiera('region', 'RegionOne'))
17
18$password = pick($trove_hash['metadata']['user_password'], 'password')
19$auth_name = pick($trove_hash['metadata']['auth_name'], 'trove')
20$configure_endpoint = pick($trove_hash['metadata']['configure_endpoint'], true)
21$configure_user = pick($trove_hash['metadata']['configure_user'], true)
22$configure_user_role = pick($trove_hash['metadata']['configure_user_role'], true)
23$service_name = pick($trove_hash['metadata']['service_name'], 'trove')
24$tenant = pick($trove_hash['metadata']['tenant'], 'services')
25
26$port = '8779'
27
28$public_url = "${public_protocol}://${public_address}:${port}/v1.0/%(tenant_id)s"
29$admin_url = "${admin_protocol}://${admin_address}:${port}/v1.0/%(tenant_id)s"
30
31validate_string($public_address)
32validate_string($password)
33
34class { 'trove::keystone::auth':
35 password => $password,
36 auth_name => $auth_name,
37 configure_endpoint => $configure_endpoint,
38 service_name => $service_name,
39 public_url => $public_url,
40 internal_url => $admin_url,
41 admin_url => $admin_url,
42 region => $region,
43 tenant => $tenant,
44} \ No newline at end of file
diff --git a/deployment_scripts/puppet/manifests/rabbitmq.pp b/deployment_scripts/puppet/manifests/rabbitmq.pp
new file mode 100644
index 0000000..ae49aaa
--- /dev/null
+++ b/deployment_scripts/puppet/manifests/rabbitmq.pp
@@ -0,0 +1,147 @@
1notice('MODULAR: trove/rabbitmq.pp')
2
3$network_scheme = hiera_hash('network_scheme', {})
4prepare_network_config($network_scheme)
5
6$queue_provider = hiera('queue_provider', 'rabbitmq')
7
8if $queue_provider == 'rabbitmq' {
9 $trove_hash = hiera_hash('fuel-plugin-dbaas-trove', {})
10 $erlang_cookie = hiera('erlang_cookie', 'EOKOWXQREETZSHFNTPEY')
11 $version = hiera('rabbit_version', '3.3.5')
12 $debug = hiera('debug', false)
13 $deployment_mode = hiera('deployment_mode', 'ha_compact')
14 $amqp_port = pick($trove_hash['rabbit_port'], '55671')
15 $rabbit_hash = hiera_hash('rabbit_hash', {})
16 $enabled = pick($rabbit_hash['enabled'], true)
17 $use_pacemaker = pick($rabbit_hash['pacemaker'], true)
18
19 case $::osfamily {
20 'RedHat': {
21 $command_timeout = "'-s KILL'"
22 $package_provider = 'yum'
23 }
24 'Debian': {
25 $command_timeout = "'--signal=KILL'"
26 $package_provider = 'apt'
27 }
28 default: {
29 fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem},\
30 module ${module_name} only support osfamily RedHat and Debian")
31 }
32 }
33
34 if ($debug) {
35 # FIXME(aschultz): debug wasn't introduced until v3.5.0, when we upgrade
36 # we should change info to debug. Also don't forget to fix tests!
37 $rabbit_levels = '[{connection,info}]'
38 } else {
39 $rabbit_levels = '[{connection,info}]'
40 }
41
42 $cluster_partition_handling = hiera('rabbit_cluster_partition_handling', 'autoheal')
43 $mnesia_table_loading_timeout = hiera('mnesia_table_loading_timeout', '10000')
44 $rabbitmq_bind_ip_address = pick(get_network_role_property('trove/api', 'ipaddr'), 'UNSET')
45
46 # NOTE(bogdando) not a hash. Keep an indentation as is
47 $rabbit_tcp_listen_options = hiera('rabbit_tcp_listen_options',
48 '[
49 binary,
50 {packet, raw},
51 {reuseaddr, true},
52 {backlog, 128},
53 {nodelay, true},
54 {exit_on_close, false},
55 {keepalive, true}
56 ]'
57 )
58 $config_kernel_variables = hiera('rabbit_config_kernel_variables',
59 {
60 'inet_dist_listen_min' => '41055',
61 'inet_dist_listen_max' => '41055',
62 'inet_default_connect_options' => '[{nodelay,true}]',
63 'net_ticktime' => '10',
64 }
65 )
66 $config_variables = hiera('rabbit_config_variables',
67 {
68 'log_levels' => $rabbit_levels,
69 'default_vhost' => "<<\"/\">>",
70 'default_permissions' => '[<<".*">>, <<".*">>, <<".*">>]',
71 'tcp_listen_options' => $rabbit_tcp_listen_options,
72 'cluster_partition_handling' => $cluster_partition_handling,
73 'mnesia_table_loading_timeout' => $mnesia_table_loading_timeout,
74 }
75 )
76
77 $thread_pool_calc = min(100,max(12*$physicalprocessorcount,30))
78
79 if $deployment_mode == 'ha_compact' {
80 $rabbit_pid_file = '/var/run/rabbitmq/p_pid'
81 } else {
82 $rabbit_pid_file = '/var/run/rabbitmq/pid'
83 }
84 $environment_variables = hiera('rabbit_environment_variables',
85 {
86 'SERVER_ERL_ARGS' => "\"+K true +A${thread_pool_calc} +P 1048576\"",
87 'PID_FILE' => $rabbit_pid_file,
88 }
89 )
90
91 if ($enabled) {
92 class { '::rabbitmq':
93 admin_enable => true,
94 repos_ensure => false,
95 package_provider => $package_provider,
96 package_source => undef,
97 service_ensure => 'running',
98 service_manage => true,
99 port => $amqp_port,
100 delete_guest_user => true,
101 default_user => 'trove',
102 default_pass => $trove_hash['metadata']['rabbit_password'],
103 # NOTE(bogdando) set to true and uncomment the lines below, if puppet should create a cluster
104 # We don't want it as far as OCF script creates the cluster
105 config_cluster => false,
106 #erlang_cookie => $erlang_cookie,
107 #wipe_db_on_cookie_change => true,
108 #cluster_nodes => $rabbitmq_cluster_nodes,
109 #cluster_node_type => 'disc',
110 #cluster_partition_handling => $cluster_partition_handling,
111 version => $version,
112 node_ip_address => $rabbitmq_bind_ip_address,
113 config_kernel_variables => $config_kernel_variables,
114 config_variables => $config_variables,
115 environment_variables => $environment_variables,
116 }
117
118 if ($use_pacemaker) {
119 # Install rabbit-fence daemon
120 class { 'cluster::rabbitmq_fence':
121 enabled => $enabled,
122 require => Class['::rabbitmq']
123 }
124 }
125
126 class { 'trove::rabbitmq':
127 enabled => $enabled,
128 # Do not install rabbitmq from trove classes
129 rabbitmq_class => false,
130 userid => $trove_hash['metadata']['rabbit_user'],
131 password => $trove_hash['metadata']['rabbit_password'],
132 require => Class['::rabbitmq'],
133 }
134
135 if ($use_pacemaker) {
136 class { 'pacemaker_wrappers::rabbitmq':
137 command_timeout => $command_timeout,
138 debug => $debug,
139 erlang_cookie => $erlang_cookie,
140 admin_user => $trove_hash['metadata']['rabbit_user'],
141 admin_pass => $trove_hash['metadata']['rabbit_password'],
142 before => Class['trove::rabbitmq'],
143 }
144 }
145 }
146
147} \ No newline at end of file
diff --git a/deployment_scripts/puppet/manifests/trove.pp b/deployment_scripts/puppet/manifests/trove.pp
new file mode 100644
index 0000000..4b4c5ea
--- /dev/null
+++ b/deployment_scripts/puppet/manifests/trove.pp
@@ -0,0 +1,92 @@
1notice('MODULAR: trove/trove.pp')
2
3prepare_network_config(hiera('network_scheme', {}))
4
5$trove_hash = hiera_hash('fuel-plugin-dbaas-trove', {})
6$nova_hash = hiera_hash('nova_hash', {})
7$neutron_config = hiera_hash('neutron_config', {})
8$node_role = hiera('node_role')
9$public_ip = hiera('public_vip')
10$database_ip = hiera('database_vip')
11$management_ip = hiera('management_vip')
12$region = hiera('region', 'RegionOne')
13$service_endpoint = hiera('service_endpoint')
14$debug = hiera('debug', false)
15$verbose = hiera('verbose', true)
16$use_syslog = hiera('use_syslog', true)
17$use_stderr = hiera('use_stderr', false)
18$rabbit_ha_queues = hiera('rabbit_ha_queues')
19$amqp_port = hiera('amqp_port')
20$amqp_hosts = hiera('amqp_hosts')
21$public_ssl = hiera_hash('public_ssl', {})
22
23#################################################################
24
25if $trove_hash['metadata']['enabled'] {
26 $public_protocol = pick($public_ssl['services'], false) ? {
27 true => 'https',
28 default => 'http',
29 }
30
31 $public_address = pick($public_ssl['services'], false) ? {
32 true => pick($public_ssl['hostname']),
33 default => $public_ip,
34 }
35
36 $firewall_rule = '210 trove-api'
37
38 $api_bind_port = '8779'
39 $api_bind_host = get_network_role_property('trove/api', 'ipaddr')
40
41 $trove_user = pick($trove_hash['metadata']['user'], 'trove')
42 $tenant = pick($trove_hash['metadata']['tenant'], 'services')
43 $internal_url = "http://${api_bind_host}:${api_bind_port}"
44 $db_user = pick($trove_hash['metadata']['db_user'], 'trove')
45 $db_name = pick($trove_hash['metadata']['db_name'], 'trove')
46 $db_password = pick($trove_hash['metadata']['db_password'], 's3cr3t')
47 $db_host = pick($trove_hash['metadata']['db_host'], $database_ip)
48 $read_timeout = '60'
49 $sql_connection = "mysql://${db_user}:${db_password}@${db_host}/${db_name}?read_timeout=${read_timeout}"
50
51
52 class { '::trove::client': }
53
54 class { '::trove':
55 database_connection => $sql_connection,
56 rabbit_host => $management_ip,
57 rabbit_password => $trove_hash['metadata']['rabbit_password'],
58 rabbit_port => '55671',
59 rabbit_userid => $trove_hash['metadata']['rabbit_user'],
60 rabbit_use_ssl => false,
61 nova_proxy_admin_pass => $nova_hash['user_password'],
62 nova_proxy_admin_user => 'nova',
63 nova_proxy_admin_tenant_name => pick($nova_hash['tenant_name'], 'services'),
64 }
65
66 class { '::trove::api':
67 debug => true,
68 verbose => true,
69 bind_host => $api_bind_host,
70 auth_url => "http://${service_endpoint}:5000/v2.0/",
71 keystone_password => $trove_hash['metadata']['user_password'],
72 }
73
74 class { '::trove::conductor':
75 debug => true,
76 verbose => true,
77 auth_url => "http://${service_endpoint}:5000/v2.0/",
78 }
79
80 class { '::trove::taskmanager':
81 debug => true,
82 verbose => true,
83 auth_url => "http://${service_endpoint}:5000/v2.0/",
84 }
85
86 firewall { $firewall_rule :
87 dport => $api_bind_port,
88 proto => 'tcp',
89 action => 'accept',
90 }
91
92} \ No newline at end of file
diff --git a/deployment_scripts/puppet/modules/trove/.gitignore b/deployment_scripts/puppet/modules/trove/.gitignore
new file mode 100644
index 0000000..28742ea
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/.gitignore
@@ -0,0 +1,8 @@
1*.swp
2spec/fixtures/modules/*
3spec/fixtures/manifests/site.pp
4Gemfile.lock
5.vendor
6.bundle/
7vendor/
8openstack/
diff --git a/deployment_scripts/puppet/modules/trove/.gitreview b/deployment_scripts/puppet/modules/trove/.gitreview
new file mode 100644
index 0000000..1887f98
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/.gitreview
@@ -0,0 +1,4 @@
1[gerrit]
2host=review.openstack.org
3port=29418
4project=openstack/puppet-trove.git
diff --git a/deployment_scripts/puppet/modules/trove/CHANGELOG.md b/deployment_scripts/puppet/modules/trove/CHANGELOG.md
new file mode 100644
index 0000000..4767b54
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/CHANGELOG.md
@@ -0,0 +1,18 @@
1##2015-10-10 - 6.1.0
2###Summary
3
4This is a feature and bugfix release in the Kilo series.
5
6####Features
7- Introduce trove:config to manage custom options
8
9####Maintenance
10- acceptance: checkout stable/kilo puppet modules
11
12####Bugfixes
13- Fix catalog compilation when not configuring endpoint
14
15##2015-07-08 - 6.0.0
16###Summary
17
18- Initial release of the puppet-trove module
diff --git a/deployment_scripts/puppet/modules/trove/Gemfile b/deployment_scripts/puppet/modules/trove/Gemfile
new file mode 100644
index 0000000..4c6106e
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/Gemfile
@@ -0,0 +1,35 @@
1source 'https://rubygems.org'
2
3group :development, :test do
4 gem 'puppetlabs_spec_helper', :require => false
5 gem 'rspec-puppet', '~> 2.1.0', :require => false
6
7 gem 'metadata-json-lint'
8 gem 'puppet-lint-param-docs'
9 gem 'puppet-lint-absolute_classname-check'
10 gem 'puppet-lint-absolute_template_path'
11 gem 'puppet-lint-trailing_newline-check'
12
13 # Puppet 4.x related lint checks
14 gem 'puppet-lint-unquoted_string-check'
15 gem 'puppet-lint-leading_zero-check'
16 gem 'puppet-lint-variable_contains_upcase'
17 gem 'puppet-lint-numericvariable'
18
19 gem 'beaker-rspec', :require => false
20 gem 'beaker-puppet_install_helper', :require => false
21 gem 'json'
22 gem 'webmock'
23end
24
25group :system_tests do
26 gem 'r10k', :require => 'false'
27end
28
29if puppetversion = ENV['PUPPET_GEM_VERSION']
30 gem 'puppet', puppetversion, :require => false
31else
32 gem 'puppet', :require => false
33end
34
35# vim:ft=ruby
diff --git a/deployment_scripts/puppet/modules/trove/LICENSE b/deployment_scripts/puppet/modules/trove/LICENSE
new file mode 100644
index 0000000..68c771a
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/LICENSE
@@ -0,0 +1,176 @@
1
2 Apache License
3 Version 2.0, January 2004
4 http://www.apache.org/licenses/
5
6 TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
8 1. Definitions.
9
10 "License" shall mean the terms and conditions for use, reproduction,
11 and distribution as defined by Sections 1 through 9 of this document.
12
13 "Licensor" shall mean the copyright owner or entity authorized by
14 the copyright owner that is granting the License.
15
16 "Legal Entity" shall mean the union of the acting entity and all
17 other entities that control, are controlled by, or are under common
18 control with that entity. For the purposes of this definition,
19 "control" means (i) the power, direct or indirect, to cause the
20 direction or management of such entity, whether by contract or
21 otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 outstanding shares, or (iii) beneficial ownership of such entity.
23
24 "You" (or "Your") shall mean an individual or Legal Entity
25 exercising permissions granted by this License.
26
27 "Source" form shall mean the preferred form for making modifications,
28 including but not limited to software source code, documentation
29 source, and configuration files.
30
31 "Object" form shall mean any form resulting from mechanical
32 transformation or translation of a Source form, including but
33 not limited to compiled object code, generated documentation,
34 and conversions to other media types.
35
36 "Work" shall mean the work of authorship, whether in Source or
37 Object form, made available under the License, as indicated by a
38 copyright notice that is included in or attached to the work
39 (an example is provided in the Appendix below).
40
41 "Derivative Works" shall mean any work, whether in Source or Object
42 form, that is based on (or derived from) the Work and for which the
43 editorial revisions, annotations, elaborations, or other modifications
44 represent, as a whole, an original work of authorship. For the purposes
45 of this License, Derivative Works shall not include works that remain
46 separable from, or merely link (or bind by name) to the interfaces of,
47 the Work and Derivative Works thereof.
48
49 "Contribution" shall mean any work of authorship, including
50 the original version of the Work and any modifications or additions
51 to that Work or Derivative Works thereof, that is intentionally
52 submitted to Licensor for inclusion in the Work by the copyright owner
53 or by an individual or Legal Entity authorized to submit on behalf of
54 the copyright owner. For the purposes of this definition, "submitted"
55 means any form of electronic, verbal, or written communication sent
56 to the Licensor or its representatives, including but not limited to
57 communication on electronic mailing lists, source code control systems,
58 and issue tracking systems that are managed by, or on behalf of, the
59 Licensor for the purpose of discussing and improving the Work, but
60 excluding communication that is conspicuously marked or otherwise
61 designated in writing by the copyright owner as "Not a Contribution."
62
63 "Contributor" shall mean Licensor and any individual or Legal Entity
64 on behalf of whom a Contribution has been received by Licensor and
65 subsequently incorporated within the Work.
66
67 2. Grant of Copyright License. Subject to the terms and conditions of
68 this License, each Contributor hereby grants to You a perpetual,
69 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 copyright license to reproduce, prepare Derivative Works of,
71 publicly display, publicly perform, sublicense, and distribute the
72 Work and such Derivative Works in Source or Object form.
73
74 3. Grant of Patent License. Subject to the terms and conditions of
75 this License, each Contributor hereby grants to You a perpetual,
76 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 (except as stated in this section) patent license to make, have made,
78 use, offer to sell, sell, import, and otherwise transfer the Work,
79 where such license applies only to those patent claims licensable
80 by such Contributor that are necessarily infringed by their
81 Contribution(s) alone or by combination of their Contribution(s)
82 with the Work to which such Contribution(s) was submitted. If You
83 institute patent litigation against any entity (including a
84 cross-claim or counterclaim in a lawsuit) alleging that the Work
85 or a Contribution incorporated within the Work constitutes direct
86 or contributory patent infringement, then any patent licenses
87 granted to You under this License for that Work shall terminate
88 as of the date such litigation is filed.
89
90 4. Redistribution. You may reproduce and distribute copies of the
91 Work or Derivative Works thereof in any medium, with or without
92 modifications, and in Source or Object form, provided that You
93 meet the following conditions:
94
95 (a) You must give any other recipients of the Work or
96 Derivative Works a copy of this License; and
97
98 (b) You must cause any modified files to carry prominent notices
99 stating that You changed the files; and
100
101 (c) You must retain, in the Source form of any Derivative Works
102 that You distribute, all copyright, patent, trademark, and
103 attribution notices from the Source form of the Work,
104 excluding those notices that do not pertain to any part of
105 the Derivative Works; and
106
107 (d) If the Work includes a "NOTICE" text file as part of its
108 distribution, then any Derivative Works that You distribute must
109 include a readable copy of the attribution notices contained
110 within such NOTICE file, excluding those notices that do not
111 pertain to any part of the Derivative Works, in at least one
112 of the following places: within a NOTICE text file distributed
113 as part of the Derivative Works; within the Source form or
114 documentation, if provided along with the Derivative Works; or,
115 within a display generated by the Derivative Works, if and
116 wherever such third-party notices normally appear. The contents
117 of the NOTICE file are for informational purposes only and
118 do not modify the License. You may add Your own attribution
119 notices within Derivative Works that You distribute, alongside
120 or as an addendum to the NOTICE text from the Work, provided
121 that such additional attribution notices cannot be construed
122 as modifying the License.
123
124 You may add Your own copyright statement to Your modifications and
125 may provide additional or different license terms and conditions
126 for use, reproduction, or distribution of Your modifications, or
127 for any such Derivative Works as a whole, provided Your use,
128 reproduction, and distribution of the Work otherwise complies with
129 the conditions stated in this License.
130
131 5. Submission of Contributions. Unless You explicitly state otherwise,
132 any Contribution intentionally submitted for inclusion in the Work
133 by You to the Licensor shall be under the terms and conditions of
134 this License, without any additional terms or conditions.
135 Notwithstanding the above, nothing herein shall supersede or modify
136 the terms of any separate license agreement you may have executed
137 with Licensor regarding such Contributions.
138
139 6. Trademarks. This License does not grant permission to use the trade
140 names, trademarks, service marks, or product names of the Licensor,
141 except as required for reasonable and customary use in describing the
142 origin of the Work and reproducing the content of the NOTICE file.
143
144 7. Disclaimer of Warranty. Unless required by applicable law or
145 agreed to in writing, Licensor provides the Work (and each
146 Contributor provides its Contributions) on an "AS IS" BASIS,
147 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 implied, including, without limitation, any warranties or conditions
149 of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 PARTICULAR PURPOSE. You are solely responsible for determining the
151 appropriateness of using or redistributing the Work and assume any
152 risks associated with Your exercise of permissions under this License.
153
154 8. Limitation of Liability. In no event and under no legal theory,
155 whether in tort (including negligence), contract, or otherwise,
156 unless required by applicable law (such as deliberate and grossly
157 negligent acts) or agreed to in writing, shall any Contributor be
158 liable to You for damages, including any direct, indirect, special,
159 incidental, or consequential damages of any character arising as a
160 result of this License or out of the use or inability to use the
161 Work (including but not limited to damages for loss of goodwill,
162 work stoppage, computer failure or malfunction, or any and all
163 other commercial damages or losses), even if such Contributor
164 has been advised of the possibility of such damages.
165
166 9. Accepting Warranty or Additional Liability. While redistributing
167 the Work or Derivative Works thereof, You may choose to offer,
168 and charge a fee for, acceptance of support, warranty, indemnity,
169 or other liability obligations and/or rights consistent with this
170 License. However, in accepting such obligations, You may act only
171 on Your own behalf and on Your sole responsibility, not on behalf
172 of any other Contributor, and only if You agree to indemnify,
173 defend, and hold each Contributor harmless for any liability
174 incurred by, or claims asserted against, such Contributor by reason
175 of your accepting any such warranty or additional liability.
176
diff --git a/deployment_scripts/puppet/modules/trove/README.md b/deployment_scripts/puppet/modules/trove/README.md
new file mode 100644
index 0000000..7739a4f
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/README.md
@@ -0,0 +1,70 @@
1puppet-trove
2=============
3
46.1.0 - 2015.1 - Kilo
5
6#### Table of Contents
7
81. [Overview - What is the trove module?](#overview)
92. [Module Description - What does the module do?](#module-description)
103. [Setup - The basics of getting started with trove](#setup)
114. [Implementation - An under-the-hood peek at what the module is doing](#implementation)
125. [Limitations - OS compatibility, etc.](#limitations)
136. [Development - Guide for contributing to the module](#development)
147. [Contributors - Those with commits](#contributors)
15
16Overview
17--------
18
19The trove module is a part of [OpenStack](https://github.com/openstack), an effort by the Openstack infrastructure team to provide continuous integration testing and code review for Openstack and Openstack community projects as part of the core software. The module itself is used to flexibly configure and manage the database service for Openstack.
20
21Module Description
22------------------
23
24Setup
25-----
26
27**What the trove module affects:**
28
29* trove, the database service for Openstack.
30
31Implementation
32--------------
33
34### trove
35
36trove is a combination of Puppet manifest and ruby code to delivery configuration and extra functionality through types and providers.
37
38Limitations
39-----------
40
41Security
42--------
43
44For security reasons, a separate in-cloud RabbitMQ cluster should be set up for Trove to use. The reason for this is that the guest agent needs to communicate with RabbitMQ, so it is not advisable to give instances access to the same RabbitMQ server that the core OpenStack services are using for communication.
45
46Please note that puppet-trove cannot check if this rule is being followed, so it is the deployer's responsibility to do it.
47
48Beaker-Rspec
49------------
50
51This module has beaker-rspec tests
52
53To run:
54
55``shell
56bundle install
57bundle exec rspec spec/acceptance
58``
59
60Development
61-----------
62
63Developer documentation for the entire puppet-openstack project.
64
65* https://wiki.openstack.org/wiki/Puppet-openstack#Developer_documentation
66
67Contributors
68------------
69
70* https://github.com/enovance/puppet-trove/graphs/contributors
diff --git a/deployment_scripts/puppet/modules/trove/Rakefile b/deployment_scripts/puppet/modules/trove/Rakefile
new file mode 100644
index 0000000..c1eecbd
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/Rakefile
@@ -0,0 +1,73 @@
1require 'puppetlabs_spec_helper/rake_tasks'
2require 'puppet-lint/tasks/puppet-lint'
3require 'json'
4
5modname = JSON.parse(open('metadata.json').read)['name'].split('-')[1]
6
7PuppetLint.configuration.fail_on_warnings = true
8PuppetLint.configuration.send('disable_80chars')
9PuppetLint.configuration.send('disable_class_parameter_defaults')
10
11task(:default).clear
12task :default => [:spec, :lint]
13
14Rake::Task[:spec_prep].clear
15desc 'Create the fixtures directory'
16task :spec_prep do
17 # Allow to test the module with custom dependencies
18 # like you could do with .fixtures file
19 if ENV['PUPPETFILE']
20 puppetfile = ENV['PUPPETFILE']
21 if ENV['GEM_HOME']
22 gem_home = ENV['GEM_HOME']
23 gem_bin_dir = "#{gem_home}" + '/bin/'
24 else
25 gem_bin_dir = ''
26 end
27 r10k = ['env']
28 r10k += ["PUPPETFILE=#{puppetfile}"]
29 r10k += ["PUPPETFILE_DIR=#{Dir.pwd}/spec/fixtures/modules"]
30 r10k += ["#{gem_bin_dir}r10k"]
31 r10k += ['puppetfile', 'install', '-v']
32 sh(*r10k)
33 else
34 # otherwise, use official OpenStack Puppetfile
35 zuul_ref = ENV['ZUUL_REF']
36 zuul_branch = ENV['ZUUL_BRANCH']
37 zuul_url = ENV['ZUUL_URL']
38 repo = 'openstack/puppet-openstack-integration'
39 rm_rf(repo)
40 if File.exists?('/usr/zuul-env/bin/zuul-cloner')
41 zuul_clone_cmd = ['/usr/zuul-env/bin/zuul-cloner']
42 zuul_clone_cmd += ['--cache-dir', '/opt/git']
43 zuul_clone_cmd += ['--zuul-ref', "#{zuul_ref}"]
44 zuul_clone_cmd += ['--zuul-branch', "#{zuul_branch}"]
45 zuul_clone_cmd += ['--zuul-url', "#{zuul_url}"]
46 zuul_clone_cmd += ['git://git.openstack.org', "#{repo}"]
47 sh(*zuul_clone_cmd)
48 else
49 sh("git clone https://git.openstack.org/#{repo} -b stable/kilo #{repo}")
50 end
51 script = ['env']
52 script += ["PUPPETFILE_DIR=#{Dir.pwd}/spec/fixtures/modules"]
53 script += ["ZUUL_REF=#{zuul_ref}"]
54 script += ["ZUUL_BRANCH=#{zuul_branch}"]
55 script += ["ZUUL_URL=#{zuul_url}"]
56 script += ['bash', "#{repo}/install_modules_unit.sh"]
57 sh(*script)
58 end
59 rm_rf("spec/fixtures/modules/#{modname}")
60 ln_s(Dir.pwd, "spec/fixtures/modules/#{modname}")
61 mkdir_p('spec/fixtures/manifests')
62 touch('spec/fixtures/manifests/site.pp')
63end
64
65Rake::Task[:spec_clean].clear
66desc 'Clean up the fixtures directory'
67task :spec_clean do
68 rm_rf('spec/fixtures/modules')
69 rm_rf('openstack')
70 if File.zero?('spec/fixtures/manifests/site.pp')
71 rm_f('spec/fixtures/manifests/site.pp')
72 end
73end
diff --git a/deployment_scripts/puppet/modules/trove/examples/site.pp b/deployment_scripts/puppet/modules/trove/examples/site.pp
new file mode 100644
index 0000000..b24e4ca
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/examples/site.pp
@@ -0,0 +1,38 @@
1# This is an example of site.pp to deploy Trove
2
3class { '::trove::client': }
4
5class { '::trove::keystone::auth':
6 admin_address => '10.0.0.1',
7 internal_address => '10.0.0.1',
8 public_address => '10.0.0.1',
9 password => 'verysecrete',
10 region => 'OpenStack'
11}
12
13class { '::trove::db::mysql':
14 password => 'dbpass',
15 host => '10.0.0.1',
16 allowed_hosts => '10.0.0.1'
17}
18
19class { '::trove':
20 database_connection => 'mysql://trove:secrete@10.0.0.1/trove?charset=utf8',
21 rabbit_hosts => '10.0.0.1',
22 rabbit_password => 'secrete',
23 nova_proxy_admin_pass => 'novapass',
24}
25
26class { '::trove::api':
27 bind_host => '10.0.0.1',
28 auth_url => 'https://identity.openstack.org:5000/v2.0',
29 keystone_password => 'verysecrete'
30}
31
32class { '::trove::conductor':
33 auth_url => 'https://identity.openstack.org:5000/v2.0'
34}
35
36class { '::trove::taskmanager':
37 auth_url => 'https://identity.openstack.org:5000/v2.0'
38}
diff --git a/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove.rb b/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove.rb
new file mode 100644
index 0000000..4a53bba
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove.rb
@@ -0,0 +1,113 @@
1require 'json'
2require 'puppet/util/inifile'
3
4class Puppet::Provider::Trove < Puppet::Provider
5
6 def self.conf_filename
7 '/etc/trove/trove.conf'
8 end
9
10 def self.withenv(hash, &block)
11 saved = ENV.to_hash
12 hash.each do |name, val|
13 ENV[name.to_s] = val
14 end
15
16 yield
17 ensure
18 ENV.clear
19 saved.each do |name, val|
20 ENV[name] = val
21 end
22 end
23
24 def self.trove_credentials
25 @trove_credentials ||= get_trove_credentials
26 end
27
28 def self.get_trove_credentials
29 auth_keys = ['auth_host', 'auth_port', 'auth_protocol',
30 'admin_tenant_name', 'admin_user', 'admin_password']
31 conf = trove_conf
32 if conf and conf['keystone_authtoken'] and
33 auth_keys.all?{|k| !conf['keystone_authtoken'][k].nil?}
34 return Hash[ auth_keys.map \
35 { |k| [k, conf['keystone_authtoken'][k].strip] } ]
36 else
37 raise(Puppet::Error, "File: #{conf_filename} does not contain all \
38required sections. Trove types will not work if trove is not \
39correctly configured.")
40 end
41 end
42
43 def trove_credentials
44 self.class.trove_credentials
45 end
46
47 def self.auth_endpoint
48 @auth_endpoint ||= get_auth_endpoint
49 end
50
51 def self.get_auth_endpoint
52 q = trove_credentials
53 "#{q['auth_protocol']}://#{q['auth_host']}:#{q['auth_port']}/v2.0/"
54 end
55
56 def self.trove_conf
57 return @trove_conf if @trove_conf
58 @trove_conf = Puppet::Util::IniConfig::File.new
59 @trove_conf.read(conf_filename)
60 @trove_conf
61 end
62
63 def self.auth_trove(*args)
64 q = trove_credentials
65 authenv = {
66 :OS_AUTH_URL => self.auth_endpoint,
67 :OS_USERNAME => q['admin_user'],
68 :OS_TENANT_NAME => q['admin_tenant_name'],
69 :OS_PASSWORD => q['admin_password']
70 }
71 begin
72 withenv authenv do
73 trove(args)
74 end
75 rescue Exception => e
76 if (e.message =~ /\[Errno 111\] Connection refused/) or
77 (e.message =~ /\(HTTP 400\)/)
78 sleep 10
79 withenv authenv do
80 trove(args)
81 end
82 else
83 raise(e)
84 end
85 end
86 end
87
88 def auth_trove(*args)
89 self.class.auth_trove(args)
90 end
91
92 def trove_manage(*args)
93 cmd = args.join(" ")
94 output = `#{cmd}`
95 $?.exitstatus
96 end
97
98 def self.reset
99 @trove_conf = nil
100 @trove_credentials = nil
101 end
102
103 def self.list_trove_resources(type, *args)
104 json = auth_trove("--json", "#{type}-list", *args)
105 return JSON.parse(json)
106 end
107
108 def self.get_trove_resource_attrs(type, id)
109 json = auth_trove("--json", "#{type}-show", id)
110 return JSON.parse(json)
111 end
112
113end
diff --git a/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_api_paste_ini/ini_setting.rb b/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_api_paste_ini/ini_setting.rb
new file mode 100644
index 0000000..e63fd1e
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_api_paste_ini/ini_setting.rb
@@ -0,0 +1,27 @@
1Puppet::Type.type(:trove_api_paste_ini).provide(
2 :ini_setting,
3 :parent => Puppet::Type.type(:ini_setting).provider(:ruby)
4) do
5
6 def section
7 resource[:name].split('/', 2).first
8 end
9
10 def setting
11 resource[:name].split('/', 2).last
12 end
13
14 def separator
15 '='
16 end
17
18 def self.file_path
19 '/etc/trove/api-paste.ini'
20 end
21
22 # added for backwards compatibility with older versions of inifile
23 def file_path
24 self.class.file_path
25 end
26
27end
diff --git a/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_conductor_config/ini_setting.rb b/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_conductor_config/ini_setting.rb
new file mode 100644
index 0000000..a4a0f88
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_conductor_config/ini_setting.rb
@@ -0,0 +1,27 @@
1Puppet::Type.type(:trove_conductor_config).provide(
2 :ini_setting,
3 :parent => Puppet::Type.type(:ini_setting).provider(:ruby)
4) do
5
6 def section
7 resource[:name].split('/', 2).first
8 end
9
10 def setting
11 resource[:name].split('/', 2).last
12 end
13
14 def separator
15 '='
16 end
17
18 def self.file_path
19 '/etc/trove/trove-conductor.conf'
20 end
21
22 # added for backwards compatibility with older versions of inifile
23 def file_path
24 self.class.file_path
25 end
26
27end
diff --git a/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_config/ini_setting.rb b/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_config/ini_setting.rb
new file mode 100644
index 0000000..d71365c
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_config/ini_setting.rb
@@ -0,0 +1,27 @@
1Puppet::Type.type(:trove_config).provide(
2 :ini_setting,
3 :parent => Puppet::Type.type(:ini_setting).provider(:ruby)
4) do
5
6 def section
7 resource[:name].split('/', 2).first
8 end
9
10 def setting
11 resource[:name].split('/', 2).last
12 end
13
14 def separator
15 '='
16 end
17
18 def self.file_path
19 '/etc/trove/trove.conf'
20 end
21
22 # added for backwards compatibility with older versions of inifile
23 def file_path
24 self.class.file_path
25 end
26
27end
diff --git a/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_datastore/trove.rb b/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_datastore/trove.rb
new file mode 100644
index 0000000..d356637
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_datastore/trove.rb
@@ -0,0 +1,52 @@
1require File.join(File.dirname(__FILE__), "..","..","..",
2 "puppet/provider/trove")
3
4Puppet::Type.type(:trove_datastore).provide(
5 :trove,
6 :parent => Puppet::Provider::Trove
7) do
8 desc <<-EOT
9 Trove provider to manage datastore type.
10 EOT
11
12 commands :trove => "trove"
13
14 mk_resource_methods
15
16 def self.instances
17 list_trove_resources("datastore").collect do |attrs|
18 new(
19 :ensure => :present,
20 :name => attrs["name"],
21 :id => attrs["id"]
22 )
23 end
24 end
25
26 def self.prefetch(resources)
27 instances_ = instances
28 resources.keys.each do |name|
29 if provider = instances_.find{ |instance| instance.name == name }
30 resources[name].provider = provider
31 end
32 end
33 end
34
35 def exists?
36 @property_hash[:ensure] == :present
37 end
38
39 def create
40 if trove_manage(['trove-manage', 'datastore_update',
41 "#{@resource[:name]}", "''"]) != 0
42 fail("Failed to create datastore #{@resource[:name]}")
43 end
44
45 if trove_manage(['trove-manage', 'datastore_update',
46 "#{@resource[:name]}", "#{@resource[:version]}"]) != 0
47 fail("Failed to set version for datastore #{@resource[:name]}")
48 end
49 end
50
51end
52
diff --git a/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_datastore_version/trove.rb b/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_datastore_version/trove.rb
new file mode 100644
index 0000000..f02ba23
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_datastore_version/trove.rb
@@ -0,0 +1,60 @@
1require File.join(File.dirname(__FILE__), "..","..","..",
2 "puppet/provider/trove")
3
4Puppet::Type.type(:trove_datastore_version).provide(
5 :trove,
6 :parent => Puppet::Provider::Trove
7) do
8 desc <<-EOT
9 Trove provider to manage datastore version type.
10 EOT
11
12 commands :trove => "trove"
13
14 mk_resource_methods
15
16 def self.prefetch(resource)
17 @datastore_version_hash = nil
18 end
19
20 def self.datastore_version_hash(datastore)
21 @datastore_version_hash ||= build_datastore_version_hash(datastore)
22 end
23
24 def datastore_version_hash(datastore)
25 self.class.datastore_version_hash(datastore)
26 end
27
28 def self.instances
29 []
30 end
31
32 def exists?
33 datastore_version_hash(resource[:datastore])[resource[:name]]
34 end
35
36 def create
37 cmd = ['trove-manage', 'datastore_version_update',
38 "#{@resource[:datastore]}", "#{@resource[:name]}",
39 "#{@resource[:manager]}", "#{@resource[:image_id]}",
40 "#{@resource[:packages]}", "#{@resource[:active]}"]
41 if trove_manage(cmd) != 0
42 fail("Failed to create datastore version #{@resource[:name]}")
43 end
44 end
45
46 def destroy
47 fail("Datastore version cannot be removed")
48 end
49
50 private
51
52 def self.build_datastore_version_hash(datastore)
53 dvs = {}
54 list_trove_resources("datastore-version", datastore).collect do |attrs|
55 dvs[attrs["name"]] = attrs
56 end
57 dvs
58 end
59
60end
diff --git a/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_guestagent_config/ini_setting.rb b/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_guestagent_config/ini_setting.rb
new file mode 100644
index 0000000..d527f3e
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_guestagent_config/ini_setting.rb
@@ -0,0 +1,27 @@
1Puppet::Type.type(:trove_guestagent_config).provide(
2 :ini_setting,
3 :parent => Puppet::Type.type(:ini_setting).provider(:ruby)
4) do
5
6 def section
7 resource[:name].split('/', 2).first
8 end
9
10 def setting
11 resource[:name].split('/', 2).last
12 end
13
14 def separator
15 '='
16 end
17
18 def self.file_path
19 '/etc/trove/trove-guestagent.conf'
20 end
21
22 # added for backwards compatibility with older versions of inifile
23 def file_path
24 self.class.file_path
25 end
26
27end
diff --git a/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_taskmanager_config/ini_setting.rb b/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_taskmanager_config/ini_setting.rb
new file mode 100644
index 0000000..5aa9539
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_taskmanager_config/ini_setting.rb
@@ -0,0 +1,27 @@
1Puppet::Type.type(:trove_taskmanager_config).provide(
2 :ini_setting,
3 :parent => Puppet::Type.type(:ini_setting).provider(:ruby)
4) do
5
6 def section
7 resource[:name].split('/', 2).first
8 end
9
10 def setting
11 resource[:name].split('/', 2).last
12 end
13
14 def separator
15 '='
16 end
17
18 def self.file_path
19 '/etc/trove/trove-taskmanager.conf'
20 end
21
22 # added for backwards compatibility with older versions of inifile
23 def file_path
24 self.class.file_path
25 end
26
27end
diff --git a/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_api_paste_ini.rb b/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_api_paste_ini.rb
new file mode 100644
index 0000000..1ff1a5b
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_api_paste_ini.rb
@@ -0,0 +1,42 @@
1Puppet::Type.newtype(:trove_api_paste_ini) do
2
3 ensurable
4
5 newparam(:name, :namevar => true) do
6 desc 'Section/setting name to manage from /etc/trove/api-paste.ini'
7 newvalues(/\S+\/\S+/)
8 end
9
10 newproperty(:value) do
11 desc 'The value of the setting to be defined.'
12 munge do |value|
13 value = value.to_s.strip
14 value.capitalize! if value =~ /^(true|false)$/i
15 value
16 end
17
18 def is_to_s( currentvalue )
19 if resource.secret?
20 return '[old secret redacted]'
21 else
22 return currentvalue
23 end
24 end
25
26 def should_to_s( newvalue )
27 if resource.secret?
28 return '[new secret redacted]'
29 else
30 return newvalue
31 end
32 end
33 end
34
35 newparam(:secret, :boolean => true) do
36 desc 'Whether to hide the value from Puppet logs. Defaults to `false`.'
37
38 newvalues(:true, :false)
39
40 defaultto false
41 end
42end
diff --git a/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_conductor_config.rb b/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_conductor_config.rb
new file mode 100644
index 0000000..6450a47
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_conductor_config.rb
@@ -0,0 +1,42 @@
1Puppet::Type.newtype(:trove_conductor_config) do
2
3 ensurable
4
5 newparam(:name, :namevar => true) do
6 desc 'Section/setting name to manage from /etc/trove/trove-conductor.conf'
7 newvalues(/\S+\/\S+/)
8 end
9
10 newproperty(:value) do
11 desc 'The value of the setting to be defined.'
12 munge do |value|
13 value = value.to_s.strip
14 value.capitalize! if value =~ /^(true|false)$/i
15 value
16 end
17
18 def is_to_s( currentvalue )
19 if resource.secret?
20 return '[old secret redacted]'
21 else
22 return currentvalue
23 end
24 end
25
26 def should_to_s( newvalue )
27 if resource.secret?
28 return '[new secret redacted]'
29 else
30 return newvalue
31 end
32 end
33 end
34
35 newparam(:secret, :boolean => true) do
36 desc 'Whether to hide the value from Puppet logs. Defaults to `false`.'
37
38 newvalues(:true, :false)
39
40 defaultto false
41 end
42end
diff --git a/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_config.rb b/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_config.rb
new file mode 100644
index 0000000..f1d14d2
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_config.rb
@@ -0,0 +1,42 @@
1Puppet::Type.newtype(:trove_config) do
2
3 ensurable
4
5 newparam(:name, :namevar => true) do
6 desc 'Section/setting name to manage from /etc/trove/trove.conf'
7 newvalues(/\S+\/\S+/)
8 end
9
10 newproperty(:value) do
11 desc 'The value of the setting to be defined.'
12 munge do |value|
13 value = value.to_s.strip
14 value.capitalize! if value =~ /^(true|false)$/i
15 value
16 end
17
18 def is_to_s( currentvalue )
19 if resource.secret?
20 return '[old secret redacted]'
21 else
22 return currentvalue
23 end
24 end
25
26 def should_to_s( newvalue )
27 if resource.secret?
28 return '[new secret redacted]'
29 else
30 return newvalue
31 end
32 end
33 end
34
35 newparam(:secret, :boolean => true) do
36 desc 'Whether to hide the value from Puppet logs. Defaults to `false`.'
37
38 newvalues(:true, :false)
39
40 defaultto false
41 end
42end
diff --git a/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_datastore.rb b/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_datastore.rb
new file mode 100644
index 0000000..7aa9483
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_datastore.rb
@@ -0,0 +1,26 @@
1Puppet::Type.newtype(:trove_datastore) do
2
3 @doc = "Manage creation of Trove datastores"
4
5 ensurable
6
7 newparam(:name, :namevar => true) do
8 desc "Datastore version name)"
9 newvalues(/^.*$/)
10 end
11
12 newparam(:version) do
13 desc "Datastore version name"
14 end
15
16 newproperty(:id) do
17 validate do |v|
18 raise(Puppet::Error, 'This is a read only property')
19 end
20 end
21
22 validate do
23 raise(Puppet::Error, 'Version must be set') unless self[:version]
24 end
25end
26
diff --git a/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_datastore_version.rb b/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_datastore_version.rb
new file mode 100644
index 0000000..856e06d
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_datastore_version.rb
@@ -0,0 +1,38 @@
1Puppet::Type.newtype(:trove_datastore_version) do
2
3 @doc = "Manage creation of Trove datastore versions"
4
5 ensurable
6
7 newparam(:name, :namevar => true) do
8 desc "Datastore version"
9 end
10
11 newparam(:datastore) do
12 desc "Datastore name)"
13 end
14
15 newparam(:manager) do
16 desc "Manager name"
17 end
18
19 newparam(:image_id) do
20 desc "Glance image id"
21 end
22
23 newparam(:packages) do
24 desc "Packages to install"
25 end
26
27 newparam(:active) do
28 desc "State"
29 end
30
31 validate do
32 raise(Puppet::Error, 'Datastore must be set') unless self[:datastore]
33 raise(Puppet::Error, 'Manager must be set') unless self[:manager]
34 raise(Puppet::Error, 'Image must be set') unless self[:image_id]
35 raise(Puppet::Error, 'Packages must be set') unless self[:packages]
36 raise(Puppet::Error, 'State must be set') unless self[:active]
37 end
38end
diff --git a/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_guestagent_config.rb b/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_guestagent_config.rb
new file mode 100644
index 0000000..06072f8
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_guestagent_config.rb
@@ -0,0 +1,42 @@
1Puppet::Type.newtype(:trove_guestagent_config) do
2
3 ensurable
4
5 newparam(:name, :namevar => true) do
6 desc 'Section/setting name to manage from /etc/trove/trove-guestagent.conf'
7 newvalues(/\S+\/\S+/)
8 end
9
10 newproperty(:value) do
11 desc 'The value of the setting to be defined.'
12 munge do |value|
13 value = value.to_s.strip
14 value.capitalize! if value =~ /^(true|false)$/i
15 value
16 end
17
18 def is_to_s( currentvalue )
19 if resource.secret?
20 return '[old secret redacted]'
21 else
22 return currentvalue
23 end
24 end
25
26 def should_to_s( newvalue )
27 if resource.secret?
28 return '[new secret redacted]'
29 else
30 return newvalue
31 end
32 end
33 end
34
35 newparam(:secret, :boolean => true) do
36 desc 'Whether to hide the value from Puppet logs. Defaults to `false`.'
37
38 newvalues(:true, :false)
39
40 defaultto false
41 end
42end
diff --git a/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_taskmanager_config.rb b/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_taskmanager_config.rb
new file mode 100644
index 0000000..25af376
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_taskmanager_config.rb
@@ -0,0 +1,42 @@
1Puppet::Type.newtype(:trove_taskmanager_config) do
2
3 ensurable
4
5 newparam(:name, :namevar => true) do
6 desc 'Section/setting name to manage from /etc/trove/trove-taskmanager.conf'
7 newvalues(/\S+\/\S+/)
8 end
9
10 newproperty(:value) do
11 desc 'The value of the setting to be defined.'
12 munge do |value|
13 value = value.to_s.strip
14 value.capitalize! if value =~ /^(true|false)$/i
15 value
16 end
17
18 def is_to_s( currentvalue )
19 if resource.secret?
20 return '[old secret redacted]'
21 else
22 return currentvalue
23 end
24 end
25
26 def should_to_s( newvalue )
27 if resource.secret?
28 return '[new secret redacted]'
29 else
30 return newvalue
31 end
32 end
33 end
34
35 newparam(:secret, :boolean => true) do
36 desc 'Whether to hide the value from Puppet logs. Defaults to `false`.'
37
38 newvalues(:true, :false)
39
40 defaultto false
41 end
42end
diff --git a/deployment_scripts/puppet/modules/trove/manifests/api.pp b/deployment_scripts/puppet/modules/trove/manifests/api.pp
new file mode 100644
index 0000000..a2f2d95
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/manifests/api.pp
@@ -0,0 +1,370 @@
1#
2# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
3#
4# Author: Emilien Macchi <emilien.macchi@enovance.com>
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17#
18# == Class trove::api
19#
20# Configure API service in trove
21#
22# == Parameters
23#
24# [*manage_service*]
25# (optional) Whether to start/stop the service
26# Defaults to true
27#
28# [*ensure_package*]
29# (optional) Whether the trove api package will be installed
30# Defaults to 'present'
31#
32# [*keystone_password*]
33# (required) Password used to authentication.
34#
35# [*verbose*]
36# (optional) Rather to log the trove api service at verbose level.
37# Default: false
38#
39# [*debug*]
40# (optional) Rather to log the trove api service at debug level.
41# Default: false
42#
43# [*bind_host*]
44# (optional) The address of the host to bind to.
45# Default: 0.0.0.0
46#
47# [*bind_port*]
48# (optional) The port the server should bind to.
49# Default: 8779
50#
51# [*backlog*]
52# (optional) Backlog requests when creating socket
53# Default: 4096
54#
55# [*workers*]
56# (optional) Number of trove API worker processes to start
57# Default: $::processorcount
58#
59# [*log_file*]
60# (optional) The path of file used for logging
61# If set to boolean false, it will not log to any file.
62# Default: /var/log/trove/trove-api.log
63#
64# [*log_dir*]
65# (optional) directory to which trove logs are sent.
66# If set to boolean false, it will not log to any directory.
67# Defaults to '/var/log/trove'
68#
69# [*auth_host*]
70# (optional) Host running auth service.
71# Defaults to '127.0.0.1'.
72#
73# [*auth_url*]
74# (optional) Authentication URL.
75# Defaults to 'http://localhost:5000/v2.0'.
76#
77# [*auth_port*]
78# (optional) Port to use for auth service on auth_host.
79# Defaults to '35357'.
80#
81# [*auth_protocol*]
82# (optional) Protocol to use for auth.
83# Defaults to 'http'.
84#
85# [*keystone_tenant*]
86# (optional) Tenant to authenticate to.
87# Defaults to services.
88#
89# [*keystone_user*]
90# (optional) User to authenticate as with keystone.
91# Defaults to 'trove'.
92#
93# [*enabled*]
94# (optional) Whether to enable services.
95# Defaults to true.
96#
97# [*use_syslog*]
98# (optional) Use syslog for logging.
99# Defaults to false.
100#
101# [*log_facility*]
102# (optional) Syslog facility to receive log lines.
103# Defaults to 'LOG_USER'.
104#
105# [*purge_config*]
106# (optional) Whether to set only the specified config options
107# in the api config.
108# Defaults to false.
109#
110# [*cert_file*]
111# (optinal) Certificate file to use when starting API server securely
112# Defaults to false, not set
113#
114# [*key_file*]
115# (optional) Private key file to use when starting API server securely
116# Defaults to false, not set
117#
118# [*ca_file*]
119# (optional) CA certificate file to use to verify connecting clients
120# Defaults to false, not set
121#
122class trove::api(
123 $keystone_password,
124 $verbose = false,
125 $debug = false,
126 $bind_host = '0.0.0.0',
127 $bind_port = '8779',
128 $backlog = '4096',
129 $workers = $::processorcount,
130 $log_file = '/var/log/trove/trove-api.log',
131 $log_dir = '/var/log/trove',
132 $auth_host = '127.0.0.1',
133 $auth_url = false,
134 $auth_port = '35357',
135 $auth_protocol = 'http',
136 $keystone_tenant = 'services',
137 $keystone_user = 'trove',
138 $enabled = true,
139 $use_syslog = false,
140 $log_facility = 'LOG_USER',
141 $purge_config = false,
142 $cert_file = false,
143 $key_file = false,
144 $ca_file = false,
145 $manage_service = true,
146 $ensure_package = 'present',
147) inherits trove {
148
149 require ::keystone::python
150 include ::trove::params
151
152 Trove_config<||> ~> Exec['post-trove_config']
153 Trove_config<||> ~> Service['trove-api']
154 Package['trove-api'] -> Trove_api_paste_ini<||>
155 Trove_api_paste_ini<||> ~> Service['trove-api']
156 # Trove db sync is broken in Ubuntu packaging
157 # This is a temporary fix until it's fixed in packaging.
158 # https://bugs.launchpad.net/ubuntu/+source/openstack-trove/+bug/1451134
159 file { '/etc/trove/trove.conf':
160 require => File['/etc/trove'],
161 }
162 File['/etc/trove/trove.conf'] -> Trove_config<||>
163 Trove_config<||> -> Package[$::trove::params::api_package_name]
164
165 if $::trove::database_connection {
166 if($::trove::database_connection =~ /mysql:\/\/\S+:\S+@\S+\/\S+/) {
167 require 'mysql::bindings'
168 require 'mysql::bindings::python'
169 } elsif($::trove::database_connection =~ /postgresql:\/\/\S+:\S+@\S+\/\S+/) {
170
171 } elsif($::trove::database_connection =~ /sqlite:\/\//) {
172
173 } else {
174 fail("Invalid db connection ${::trove::database_connection}")
175 }
176 trove_config {
177 'database/connection': value => $::trove::database_connection;
178 'database/idle_timeout': value => $::trove::database_idle_timeoutl;
179 }
180 }
181
182 # basic service config
183 trove_config {
184 'DEFAULT/verbose': value => $verbose;
185 'DEFAULT/debug': value => $debug;
186 'DEFAULT/bind_host': value => $bind_host;
187 'DEFAULT/bind_port': value => $bind_port;
188 'DEFAULT/backlog': value => $backlog;
189 'DEFAULT/trove_api_workers': value => $workers;
190 'DEFAULT/nova_proxy_admin_user': value => $::trove::nova_proxy_admin_user;
191 'DEFAULT/nova_proxy_admin_pass': value => $::trove::nova_proxy_admin_pass;
192 'DEFAULT/nova_proxy_admin_tenant_name': value => $::trove::nova_proxy_admin_tenant_name;
193 'DEFAULT/control_exchange': value => $::trove::control_exchange;
194 }
195
196 if $auth_url {
197 trove_config { 'DEFAULT/trove_auth_url': value => $auth_url; }
198 } else {
199 trove_config { 'DEFAULT/trove_auth_url': value => "${auth_protocol}://${auth_host}:5000/v2.0"; }
200 }
201
202 # auth config
203 trove_config {
204 'keystone_authtoken/auth_host': value => $auth_host;
205 'keystone_authtoken/auth_port': value => $auth_port;
206 'keystone_authtoken/auth_protocol': value => $auth_protocol;
207 'keystone_authtoken/admin_tenant_name': value => $keystone_tenant;
208 'keystone_authtoken/admin_user': value => $keystone_user;
209 'keystone_authtoken/admin_password': value => $keystone_password, secret => true;
210 }
211
212 # SSL Options
213 if $cert_file {
214 trove_config {
215 'DEFAULT/cert_file' : value => $cert_file;
216 }
217 } else {
218 trove_config {
219 'DEFAULT/cert_file': ensure => absent;
220 }
221 }
222 if $key_file {
223 trove_config {
224 'DEFAULT/key_file' : value => $key_file;
225 }
226 } else {
227 trove_config {
228 'DEFAULT/key_file': ensure => absent;
229 }
230 }
231 if $ca_file {
232 trove_config {
233 'DEFAULT/ca_file' : value => $ca_file;
234 }
235 } else {
236 trove_config {
237 'DEFAULT/ca_file': ensure => absent;
238 }
239 }
240
241 # Logging
242 if $log_file {
243 trove_config {
244 'DEFAULT/log_file': value => $log_file;
245 }
246 } else {
247 trove_config {
248 'DEFAULT/log_file': ensure => absent;
249 }
250 }
251
252 if $log_dir {
253 trove_config {
254 'DEFAULT/log_dir': value => $log_dir;
255 }
256 } else {
257 trove_config {
258 'DEFAULT/log_dir': ensure => absent;
259 }
260 }
261
262 # Syslog
263 if $use_syslog {
264 trove_config {
265 'DEFAULT/use_syslog' : value => true;
266 'DEFAULT/syslog_log_facility' : value => $log_facility;
267 }
268 } else {
269 trove_config {
270 'DEFAULT/use_syslog': value => false;
271 }
272 }
273
274 resources { 'trove_config':
275 purge => $purge_config,
276 }
277
278 if $::trove::rpc_backend == 'trove.openstack.common.rpc.impl_kombu' {
279 if ! $::trove::rabbit_password {
280 fail('When rpc_backend is rabbitmq, you must set rabbit password')
281 }
282 if $::trove::rabbit_hosts {
283 trove_config { 'oslo_messaging_rabbit/rabbit_hosts': value => join($::trove::rabbit_hosts, ',') }
284 trove_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true }
285 } else {
286 trove_config { 'oslo_messaging_rabbit/rabbit_host': value => $::trove::rabbit_host }
287 trove_config { 'oslo_messaging_rabbit/rabbit_port': value => $::trove::rabbit_port }
288 trove_config { 'oslo_messaging_rabbit/rabbit_hosts': value => "${::trove::rabbit_host}:${::trove::rabbit_port}" }
289 trove_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false }
290 }
291
292 trove_config {
293 'oslo_messaging_rabbit/rabbit_userid': value => $::trove::rabbit_user;
294 'oslo_messaging_rabbit/rabbit_password': value => $::trove::rabbit_password, secret => true;
295 'oslo_messaging_rabbit/rabbit_virtual_host': value => $::trove::rabbit_virtual_host;
296 'oslo_messaging_rabbit/rabbit_use_ssl': value => $::trove::rabbit_use_ssl;
297 'oslo_messaging_rabbit/kombu_reconnect_delay': value => $::trove::kombu_reconnect_delay;
298 }
299
300 if $::trove::rabbit_use_ssl {
301
302 if $::trove::kombu_ssl_ca_certs {
303 trove_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': value => $::trove::kombu_ssl_ca_certs; }
304 } else {
305 trove_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': ensure => absent; }
306 }
307
308 if $::trove::kombu_ssl_certfile or $::trove::kombu_ssl_keyfile {
309 trove_config {
310 'oslo_messaging_rabbit/kombu_ssl_certfile': value => $::trove::kombu_ssl_certfile;
311 'oslo_messaging_rabbit/kombu_ssl_keyfile': value => $::trove::kombu_ssl_keyfile;
312 }
313 } else {
314 trove_config {
315 'oslo_messaging_rabbit/kombu_ssl_certfile': ensure => absent;
316 'oslo_messaging_rabbit/kombu_ssl_keyfile': ensure => absent;
317 }
318 }
319
320 if $::trove::kombu_ssl_version {
321 trove_config { 'oslo_messaging_rabbit/kombu_ssl_version': value => $::trove::kombu_ssl_version; }
322 } else {
323 trove_config { 'oslo_messaging_rabbit/kombu_ssl_version': ensure => absent; }
324 }
325
326 } else {
327 trove_config {
328 'oslo_messaging_rabbit/kombu_ssl_ca_certs': ensure => absent;
329 'oslo_messaging_rabbit/kombu_ssl_certfile': ensure => absent;
330 'oslo_messaging_rabbit/kombu_ssl_keyfile': ensure => absent;
331 'oslo_messaging_rabbit/kombu_ssl_version': ensure => absent;
332 }
333 }
334 }
335
336 if $::trove::rpc_backend == 'trove.openstack.common.rpc.impl_qpid' {
337 trove_config {
338 'DEFAULT/qpid_hostname': value => $::trove::qpid_hostname;
339 'DEFAULT/qpid_port': value => $::trove::qpid_port;
340 'DEFAULT/qpid_username': value => $::trove::qpid_username;
341 'DEFAULT/qpid_password': value => $::trove::qpid_password, secret => true;
342 'DEFAULT/qpid_heartbeat': value => $::trove::qpid_heartbeat;
343 'DEFAULT/qpid_protocol': value => $::trove::qpid_protocol;
344 'DEFAULT/qpid_tcp_nodelay': value => $::trove::qpid_tcp_nodelay;
345 }
346 if is_array($::trove::qpid_sasl_mechanisms) {
347 trove_config {
348 'DEFAULT/qpid_sasl_mechanisms': value => join($::trove::qpid_sasl_mechanisms, ' ');
349 }
350 }
351 elsif $::trove::qpid_sasl_mechanisms {
352 trove_config {
353 'DEFAULT/qpid_sasl_mechanisms': value => $::trove::qpid_sasl_mechanisms;
354 }
355 }
356 else {
357 trove_config {
358 'DEFAULT/qpid_sasl_mechanisms': ensure => absent;
359 }
360 }
361 }
362
363 trove::generic_service { 'api':
364 enabled => $enabled,
365 manage_service => $manage_service,
366 ensure_package => $ensure_package,
367 package_name => $::trove::params::api_package_name,
368 service_name => $::trove::params::api_service_name,
369 }
370}
diff --git a/deployment_scripts/puppet/modules/trove/manifests/client.pp b/deployment_scripts/puppet/modules/trove/manifests/client.pp
new file mode 100644
index 0000000..1c25529
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/manifests/client.pp
@@ -0,0 +1,40 @@
1#
2# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
3#
4# Author: Emilien Macchi <emilien.macchi@enovance.com>
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17
18# trove::client
19#
20# Manages the trove client package on systems
21#
22# === Parameters:
23#
24# [*package_ensure*]
25# (optional) The state of the package
26# Defaults to present
27#
28#
29class trove::client (
30 $package_ensure = present
31) {
32
33 include ::trove::params
34
35 package { 'python-troveclient':
36 ensure => $package_ensure,
37 name => $::trove::params::client_package_name,
38 }
39
40}
diff --git a/deployment_scripts/puppet/modules/trove/manifests/conductor.pp b/deployment_scripts/puppet/modules/trove/manifests/conductor.pp
new file mode 100644
index 0000000..570e452
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/manifests/conductor.pp
@@ -0,0 +1,224 @@
1# == Class: trove::conductor
2#
3# Manages trove conductor package and service
4#
5# === Parameters:
6#
7# [*enabled*]
8# (optional) Whether to enable the trove-conductor service
9# Defaults to true
10#
11# [*manage_service*]
12# (optional) Whether to start/stop the service
13# Defaults to true
14#
15# [*ensure_package*]
16# (optional) The state of the trove conductor package
17# Defaults to 'present'
18#
19# [*verbose*]
20# (optional) Rather to log the trove api service at verbose level.
21# Default: false
22#
23# [*debug*]
24# (optional) Rather to log the trove api service at debug level.
25# Default: false
26#
27# [*log_file*]
28# (optional) The path of file used for logging
29# If set to boolean false, it will not log to any file.
30# Default: /var/log/trove/trove-conductor.log
31#
32# [*log_dir*]
33# (optional) directory to which trove logs are sent.
34# If set to boolean false, it will not log to any directory.
35# Defaults to '/var/log/trove'
36#
37# [*use_syslog*]
38# (optional) Use syslog for logging.
39# Defaults to false.
40#
41# [*log_facility*]
42# (optional) Syslog facility to receive log lines.
43# Defaults to 'LOG_USER'.
44#
45# [*auth_url*]
46# (optional) Authentication URL.
47# Defaults to 'http://localhost:5000/v2.0'.
48#
49# [*conductor_manager*]
50# (optional) Trove conductor manager.
51# Defaults to 'trove.conductor.manager.Manager'.
52#
53class trove::conductor(
54 $enabled = true,
55 $manage_service = true,
56 $ensure_package = 'present',
57 $verbose = false,
58 $debug = false,
59 $log_file = '/var/log/trove/trove-conductor.log',
60 $log_dir = '/var/log/trove',
61 $use_syslog = false,
62 $log_facility = 'LOG_USER',
63 $auth_url = 'http://localhost:5000/v2.0',
64 $conductor_manager = 'trove.conductor.manager.Manager',
65) inherits trove {
66
67 include ::trove::params
68
69 Trove_conductor_config<||> ~> Exec['post-trove_config']
70 Trove_conductor_config<||> ~> Service['trove-conductor']
71 # Trove db sync is broken in Ubuntu packaging
72 # This is a temporary fix until it's fixed in packaging.
73 # https://bugs.launchpad.net/ubuntu/+source/openstack-trove/+bug/1451134
74 file { '/etc/trove/trove-conductor.conf':
75 require => File['/etc/trove'],
76 }
77 File['/etc/trove/trove-conductor.conf'] -> Trove_conductor_config<||>
78 Trove_conductor_config<||> -> Package[$::trove::params::conductor_package_name]
79
80 if $::trove::database_connection {
81 if($::trove::database_connection =~ /mysql:\/\/\S+:\S+@\S+\/\S+/) {
82 require 'mysql::bindings'
83 require 'mysql::bindings::python'
84 } elsif($::trove::database_connection =~ /postgresql:\/\/\S+:\S+@\S+\/\S+/) {
85
86 } elsif($::trove::database_connection =~ /sqlite:\/\//) {
87
88 } else {
89 fail("Invalid db connection ${::trove::database_connection}")
90 }
91 trove_conductor_config {
92 'database/connection': value => $::trove::database_connection;
93 'database/idle_timeout': value => $::trove::database_idle_timeoutl;
94 }
95 }
96
97 # basic service config
98 trove_conductor_config {
99 'DEFAULT/verbose': value => $verbose;
100 'DEFAULT/debug': value => $debug;
101 'DEFAULT/trove_auth_url': value => $auth_url;
102 'DEFAULT/nova_proxy_admin_user': value => $::trove::nova_proxy_admin_user;
103 'DEFAULT/nova_proxy_admin_tenant_name': value => $::trove::nova_proxy_admin_tenant_name;
104 'DEFAULT/nova_proxy_admin_pass': value => $::trove::nova_proxy_admin_pass;
105 'DEFAULT/control_exchange': value => $::trove::control_exchange;
106 }
107
108 if $::trove::rpc_backend == 'trove.openstack.common.rpc.impl_kombu' {
109 if ! $::trove::rabbit_password {
110 fail('When rpc_backend is rabbitmq, you must set rabbit password')
111 }
112 if $::trove::rabbit_hosts {
113 trove_conductor_config { 'oslo_messaging_rabbit/rabbit_hosts': value => join($::trove::rabbit_hosts, ',') }
114 trove_conductor_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true }
115 } else {
116 trove_conductor_config { 'oslo_messaging_rabbit/rabbit_host': value => $::trove::rabbit_host }
117 trove_conductor_config { 'oslo_messaging_rabbit/rabbit_port': value => $::trove::rabbit_port }
118 trove_conductor_config { 'oslo_messaging_rabbit/rabbit_hosts': value => "${::trove::rabbit_host}:${::trove::rabbit_port}" }
119 trove_conductor_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false }
120 }
121
122 trove_conductor_config {
123 'oslo_messaging_rabbit/rabbit_userid': value => $::trove::rabbit_user;
124 'oslo_messaging_rabbit/rabbit_password': value => $::trove::rabbit_password, secret => true;
125 'oslo_messaging_rabbit/rabbit_virtual_host': value => $::trove::rabbit_virtual_host;
126 'oslo_messaging_rabbit/rabbit_use_ssl': value => $::trove::rabbit_use_ssl;
127 'oslo_messaging_rabbit/kombu_reconnect_delay': value => $::trove::kombu_reconnect_delay;
128 }
129
130 if $::trove::rabbit_use_ssl {
131
132 if $::trove::kombu_ssl_ca_certs {
133 trove_conductor_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': value => $::trove::kombu_ssl_ca_certs; }
134 } else {
135 trove_conductor_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': ensure => absent; }
136 }
137
138 if $::trove::kombu_ssl_certfile or $::trove::kombu_ssl_keyfile {
139 trove_conductor_config {
140 'oslo_messaging_rabbit/kombu_ssl_certfile': value => $::trove::kombu_ssl_certfile;
141 'oslo_messaging_rabbit/kombu_ssl_keyfile': value => $::trove::kombu_ssl_keyfile;
142 }
143 } else {
144 trove_conductor_config {
145 'oslo_messaging_rabbit/kombu_ssl_certfile': ensure => absent;
146 'oslo_messaging_rabbit/kombu_ssl_keyfile': ensure => absent;
147 }
148 }
149
150 if $::trove::kombu_ssl_version {
151 trove_conductor_config { 'oslo_messaging_rabbit/kombu_ssl_version': value => $::trove::kombu_ssl_version; }
152 } else {
153 trove_conductor_config { 'oslo_messaging_rabbit/kombu_ssl_version': ensure => absent; }
154 }
155
156 } else {
157 trove_conductor_config {
158 'oslo_messaging_rabbit/kombu_ssl_ca_certs': ensure => absent;
159 'oslo_messaging_rabbit/kombu_ssl_certfile': ensure => absent;
160 'oslo_messaging_rabbit/kombu_ssl_keyfile': ensure => absent;
161 'oslo_messaging_rabbit/kombu_ssl_version': ensure => absent;
162 }
163 }
164 }
165
166 if $::trove::rpc_backend == 'trove.openstack.common.rpc.impl_qpid' {
167 trove_conductor_config {
168 'DEFAULT/qpid_hostname': value => $::trove::qpid_hostname;
169 'DEFAULT/qpid_port': value => $::trove::qpid_port;
170 'DEFAULT/qpid_username': value => $::trove::qpid_username;
171 'DEFAULT/qpid_password': value => $::trove::qpid_password, secret => true;
172 'DEFAULT/qpid_heartbeat': value => $::trove::qpid_heartbeat;
173 'DEFAULT/qpid_protocol': value => $::trove::qpid_protocol;
174 'DEFAULT/qpid_tcp_nodelay': value => $::trove::qpid_tcp_nodelay;
175 }
176 if is_array($::trove::qpid_sasl_mechanisms) {
177 trove_conductor_config {
178 'DEFAULT/qpid_sasl_mechanisms': value => join($::trove::qpid_sasl_mechanisms, ' ');
179 }
180 }
181 }
182
183 # Logging
184 if $log_file {
185 trove_conductor_config {
186 'DEFAULT/log_file': value => $log_file;
187 }
188 } else {
189 trove_conductor_config {
190 'DEFAULT/log_file': ensure => absent;
191 }
192 }
193
194 if $log_dir {
195 trove_conductor_config {
196 'DEFAULT/log_dir': value => $log_dir;
197 }
198 } else {
199 trove_conductor_config {
200 'DEFAULT/log_dir': ensure => absent;
201 }
202 }
203
204 # Syslog
205 if $use_syslog {
206 trove_conductor_config {
207 'DEFAULT/use_syslog' : value => true;
208 'DEFAULT/syslog_log_facility' : value => $log_facility;
209 }
210 } else {
211 trove_conductor_config {
212 'DEFAULT/use_syslog': value => false;
213 }
214 }
215
216 trove::generic_service { 'conductor':
217 enabled => $enabled,
218 manage_service => $manage_service,
219 package_name => $::trove::params::conductor_package_name,
220 service_name => $::trove::params::conductor_service_name,
221 ensure_package => $ensure_package,
222 }
223
224}
diff --git a/deployment_scripts/puppet/modules/trove/manifests/config.pp b/deployment_scripts/puppet/modules/trove/manifests/config.pp
new file mode 100644
index 0000000..93d6313
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/manifests/config.pp
@@ -0,0 +1,84 @@
1#
2# Copyright (C) 2015 UnitedStack <devops@unitedstack.com>
3#
4# Author: Xingchao Yu <xingchao@unitedstack.com>
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17#
18# == Class: trove::config
19#
20# This class is used to manage arbitrary trove configurations.
21#
22# === Parameters
23#
24# [*trove_config*]
25# (optional) Allow configuration of arbitrary trove configurations.
26# The value is an hash of trove_config resources.
27# Defaults to {}
28#
29# [*trove_taskmanager_config*]
30# (optional) Allow configuration of arbitrary trove taskmanager configurations.
31# The value is an hash of trove_taskmanager_config resources.
32# Defaults to {}
33#
34# [*trove_conductor_config*]
35# (optional) Allow configuration of arbitrary trove conductor configurations.
36# The value is an hash of trove_conductor_config resources.
37# Defaults to {}
38#
39# [*trove_guestagent_config*]
40# (optional) Allow configuration of arbitrary trove guestagent configurations.
41# The value is an hash of trove_guestagent_config resources.
42# Defaults to {}
43#
44# [*trove_api_paste_ini*]
45# (optional) Allow configuration of arbitrary trove paste api configurations.
46# The value is an hash of trove_paste_api_ini resources.
47# Defaults to {}
48#
49# Example:
50# { 'DEFAULT/foo' => { value => 'fooValue'},
51# 'DEFAULT/bar' => { value => 'barValue'}
52# }
53#
54# In yaml format, Example:
55# trove_config:
56# DEFAULT/foo:
57# value: fooValue
58# DEFAULT/bar:
59# value: barValue
60#
61# NOTE: The configuration MUST NOT be already handled by this module
62# or Puppet catalog compilation will fail with duplicate resources.
63#
64class trove::config (
65 $trove_config = {},
66 $trove_taskmanager_config = {},
67 $trove_conductor_config = {},
68 $trove_guestagent_config = {},
69 $trove_api_paste_ini = {},
70) {
71
72 validate_hash($trove_config)
73 validate_hash($trove_taskmanager_config)
74 validate_hash($trove_conductor_config)
75 validate_hash($trove_guestagent_config)
76 validate_hash($trove_api_paste_ini)
77
78 create_resources('trove_config', $trove_config)
79 create_resources('trove_taskmanager_config', $trove_taskmanager_config)
80 create_resources('trove_conductor_config', $trove_conductor_config)
81 create_resources('trove_guestagent_config', $trove_guestagent_config)
82 create_resources('trove_api_paste_ini', $trove_api_paste_ini)
83
84}
diff --git a/deployment_scripts/puppet/modules/trove/manifests/db/mysql.pp b/deployment_scripts/puppet/modules/trove/manifests/db/mysql.pp
new file mode 100644
index 0000000..6748de8
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/manifests/db/mysql.pp
@@ -0,0 +1,83 @@
1#
2# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
3#
4# Author: Emilien Macchi <emilien.macchi@enovance.com>
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17#
18# == Class: trove::db::mysql
19#
20# The trove::db::mysql class creates a MySQL database for trove.
21# It must be used on the MySQL server
22#
23# === Parameters
24#
25# [*password*]
26# (required) Password that will be used for the trove db user.
27#
28# [*dbname*]
29# (optional) Name of trove database.
30# Defaults to trove
31#
32# [*user*]
33# (optional) Name of trove user.
34# Defaults to trove
35#
36# [*host*]
37# (optional) Host where user should be allowed all privileges for database.
38# Defaults to 127.0.0.1
39#
40# [*allowed_hosts*]
41# (optional) Hosts allowed to use the database
42# Defaults to undef.
43#
44# [*charset*]
45# (optional) Charset of trove database
46# Defaults 'utf8'.
47#
48# [*collate*]
49# (optional) Charset collate of trove database
50# Defaults 'utf8_general_ci'.
51#
52# [*mysql_module*]
53# (optional) Deprecated. Does nothing
54#
55class trove::db::mysql(
56 $password,
57 $dbname = 'trove',
58 $user = 'trove',
59 $host = '127.0.0.1',
60 $allowed_hosts = undef,
61 $charset = 'utf8',
62 $collate = 'utf8_general_ci',
63 $mysql_module = undef,
64) {
65
66 if $mysql_module {
67 warning('The mysql_module parameter is deprecated. The latest 2.x mysql module will be used.')
68 }
69
70 validate_string($password)
71
72 ::openstacklib::db::mysql { 'trove':
73 user => $user,
74 password_hash => mysql_password($password),
75 dbname => $dbname,
76 host => $host,
77 charset => $charset,
78 collate => $collate,
79 allowed_hosts => $allowed_hosts,
80 }
81
82 ::Openstacklib::Db::Mysql['trove'] ~> Exec<| title == 'trove-db-sync' |>
83}
diff --git a/deployment_scripts/puppet/modules/trove/manifests/db/postgresql.pp b/deployment_scripts/puppet/modules/trove/manifests/db/postgresql.pp
new file mode 100644
index 0000000..f976319
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/manifests/db/postgresql.pp
@@ -0,0 +1,47 @@
1# == Class: trove::db::postgresql
2#
3# Class that configures postgresql for trove
4# Requires the Puppetlabs postgresql module.
5#
6# === Parameters
7#
8# [*password*]
9# (Required) Password to connect to the database.
10#
11# [*dbname*]
12# (Optional) Name of the database.
13# Defaults to 'trove'.
14#
15# [*user*]
16# (Optional) User to connect to the database.
17# Defaults to 'trove'.
18#
19# [*encoding*]
20# (Optional) The charset to use for the database.
21# Default to undef.
22#
23# [*privileges*]
24# (Optional) Privileges given to the database user.
25# Default to 'ALL'
26#
27class trove::db::postgresql(
28 $password,
29 $dbname = 'trove',
30 $user = 'trove',
31 $encoding = undef,
32 $privileges = 'ALL',
33) {
34
35 Class['trove::db::postgresql'] -> Service<| title == 'trove' |>
36
37 ::openstacklib::db::postgresql { 'trove':
38 password_hash => postgresql_password($user, $password),
39 dbname => $dbname,
40 user => $user,
41 encoding => $encoding,
42 privileges => $privileges,
43 }
44
45 ::Openstacklib::Db::Postgresql['trove'] ~> Exec<| title == 'trove-manage db_sync' |>
46
47}
diff --git a/deployment_scripts/puppet/modules/trove/manifests/db/sync.pp b/deployment_scripts/puppet/modules/trove/manifests/db/sync.pp
new file mode 100644
index 0000000..97d69db
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/manifests/db/sync.pp
@@ -0,0 +1,28 @@
1#
2# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
3#
4# Author: Emilien Macchi <emilien.macchi@enovance.com>
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17#
18# Class to execute "trove-manage db_sync
19#
20class trove::db::sync {
21 exec { 'trove-manage db_sync':
22 path => '/usr/bin',
23 user => 'trove',
24 refreshonly => true,
25 subscribe => Trove_config['database/connection'],
26 require => Package['trove-api'],
27 }
28}
diff --git a/deployment_scripts/puppet/modules/trove/manifests/generic_service.pp b/deployment_scripts/puppet/modules/trove/manifests/generic_service.pp
new file mode 100644
index 0000000..9466642
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/manifests/generic_service.pp
@@ -0,0 +1,91 @@
1#
2# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
3#
4# Author: Emilien Macchi <emilien.macchi@enovance.com>
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17#
18# == Define: trove::generic_service
19#
20# This defined type implements basic trove services.
21# It is introduced to attempt to consolidate
22# common code.
23#
24# It also allows users to specify ad-hoc services
25# as needed
26#
27# This define creates a service resource with title trove-${name} and
28# conditionally creates a package resource with title trove-${name}
29#
30# === Parameters:
31#
32# [*package_name*]
33# (mandatory) The package name (for the generic_service)
34#
35# [*service_name*]
36# (mandatory) The service name (for the generic_service)
37#
38# [*enabled*]
39# (optional) Define if the service must be enabled or not
40# Defaults to false.
41#
42# [*manage_service*]
43# (optional) Manage or not the service (if a service_name is provided).
44# Defaults to true.
45#
46# [*ensure_package*]
47# (optional) Control the ensure parameter for the package ressource.
48# Defaults to 'present'.
49#
50define trove::generic_service(
51 $package_name,
52 $service_name,
53 $enabled = false,
54 $manage_service = true,
55 $ensure_package = 'present'
56) {
57
58 include ::trove::params
59 include ::trove::db::sync
60
61 $trove_title = "trove-${name}"
62 Exec['post-trove_config'] ~> Service<| title == $trove_title |>
63 Exec<| title == 'trove-db-sync' |> ~> Service<| title == $trove_title |>
64
65 if ($package_name) {
66 if !defined(Package[$package_name]) {
67 package { $trove_title:
68 ensure => $ensure_package,
69 name => $package_name,
70 notify => Service[$trove_title],
71 }
72 }
73 }
74
75 if $service_name {
76 if $manage_service {
77 if $enabled {
78 $service_ensure = 'running'
79 } else {
80 $service_ensure = 'stopped'
81 }
82 }
83
84 service { $trove_title:
85 ensure => $service_ensure,
86 name => $service_name,
87 enable => $enabled,
88 hasstatus => true,
89 }
90 }
91}
diff --git a/deployment_scripts/puppet/modules/trove/manifests/guestagent.pp b/deployment_scripts/puppet/modules/trove/manifests/guestagent.pp
new file mode 100644
index 0000000..f8dcbcc
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/manifests/guestagent.pp
@@ -0,0 +1,213 @@
1# == Class: trove::guestagent
2#
3# Manages trove guest agent package and service
4#
5# === Parameters:
6#
7# [*enabled*]
8# (optional) Whether to enable the trove guest agent service
9# Defaults to true
10#
11# [*manage_service*]
12# (optional) Whether to start/stop the service
13# Defaults to true
14#
15# [*ensure_package*]
16# (optional) The state of the trove guest agent package
17# Defaults to 'present'
18#
19# [*verbose*]
20# (optional) Rather to log the trove guest agent service at verbose level.
21# Default: false
22#
23# [*debug*]
24# (optional) Rather to log the trove guest agent service at debug level.
25# Default: false
26#
27# [*log_file*]
28# (optional) The path of file used for logging
29# If set to boolean false, it will not log to any file.
30# Default: /var/log/trove/guestagent.log
31#
32# [*log_dir*]
33# (optional) directory to which trove logs are sent.
34# If set to boolean false, it will not log to any directory.
35# Defaults to '/var/log/trove'
36#
37# [*use_syslog*]
38# (optional) Use syslog for logging.
39# Defaults to false.
40#
41# [*log_facility*]
42# (optional) Syslog facility to receive log lines.
43# Defaults to 'LOG_USER'.
44#
45# [*auth_url*]
46# (optional) Authentication URL.
47# Defaults to 'http://localhost:5000/v2.0'.
48#
49# [*swift_url*]
50# (optional) Swift URL.
51# Defaults to 'http://localhost:8080/v1/AUTH_'.
52#
53# [*control_exchange*]
54# (optional) Control exchange.
55# Defaults to 'trove'.
56#
57class trove::guestagent(
58 $enabled = true,
59 $manage_service = true,
60 $ensure_package = 'present',
61 $verbose = false,
62 $debug = false,
63 $log_file = '/var/log/trove/guestagent.log',
64 $log_dir = '/var/log/trove',
65 $use_syslog = false,
66 $log_facility = 'LOG_USER',
67 $auth_url = 'http://localhost:5000/v2.0',
68 $swift_url = 'http://localhost:8080/v1/AUTH_',
69 $control_exchange = 'trove'
70) inherits trove {
71
72 include ::trove::params
73
74 Trove_guestagent_config<||> ~> Exec['post-trove_config']
75 Trove_guestagent_config<||> ~> Service['trove-guestagent']
76 # Trove db sync is broken in Ubuntu packaging
77 # This is a temporary fix until it's fixed in packaging.
78 # https://bugs.launchpad.net/ubuntu/+source/openstack-trove/+bug/1451134
79 file { '/etc/trove/trove-guestagent.conf':
80 require => File['/etc/trove'],
81 }
82 File['/etc/trove/trove-guestagent.conf'] -> Trove_guestagent_config<||>
83 Trove_guestagent_config<||> -> Package[$::trove::params::guestagent_package_name]
84
85 # basic service config
86 trove_guestagent_config {
87 'DEFAULT/verbose': value => $verbose;
88 'DEFAULT/debug': value => $debug;
89 'DEFAULT/trove_auth_url': value => $auth_url;
90 'DEFAULT/swift_url': value => $swift_url;
91 'DEFAULT/nova_proxy_admin_user': value => $::trove::nova_proxy_admin_user;
92 'DEFAULT/nova_proxy_admin_tenant_name': value => $::trove::nova_proxy_admin_tenant_name;
93 'DEFAULT/nova_proxy_admin_pass': value => $::trove::nova_proxy_admin_pass;
94 'DEFAULT/control_exchange': value => $control_exchange;
95 }
96
97 if $::trove::rpc_backend == 'trove.openstack.common.rpc.impl_kombu' {
98 if ! $::trove::rabbit_password {
99 fail('When rpc_backend is rabbitmq, you must set rabbit password')
100 }
101 if $::trove::rabbit_hosts {
102 trove_guestagent_config { 'oslo_messaging_rabbit/rabbit_hosts': value => join($::trove::rabbit_hosts, ',') }
103 trove_guestagent_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true }
104 } else {
105 trove_guestagent_config { 'oslo_messaging_rabbit/rabbit_host': value => $::trove::rabbit_host }
106 trove_guestagent_config { 'oslo_messaging_rabbit/rabbit_port': value => $::trove::rabbit_port }
107 trove_guestagent_config { 'oslo_messaging_rabbit/rabbit_hosts': value => "${::trove::rabbit_host}:${::trove::rabbit_port}" }
108 trove_guestagent_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false }
109 }
110
111 trove_guestagent_config {
112 'oslo_messaging_rabbit/rabbit_userid': value => $::trove::rabbit_user;
113 'oslo_messaging_rabbit/rabbit_password': value => $::trove::rabbit_password, secret => true;
114 'oslo_messaging_rabbit/rabbit_virtual_host': value => $::trove::rabbit_virtual_host;
115 'oslo_messaging_rabbit/rabbit_use_ssl': value => $::trove::rabbit_use_ssl;
116 'oslo_messaging_rabbit/kombu_reconnect_delay': value => $::trove::kombu_reconnect_delay;
117 }
118
119 if $::trove::rabbit_use_ssl {
120
121 if $::trove::kombu_ssl_ca_certs {
122 trove_guestagent_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': value => $::trove::kombu_ssl_ca_certs; }
123 } else {
124 trove_guestagent_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': ensure => absent; }
125 }
126
127 if $::trove::kombu_ssl_certfile or $::trove::kombu_ssl_keyfile {
128 trove_guestagent_config {
129 'oslo_messaging_rabbit/kombu_ssl_certfile': value => $::trove::kombu_ssl_certfile;
130 'oslo_messaging_rabbit/kombu_ssl_keyfile': value => $::trove::kombu_ssl_keyfile;
131 }
132 } else {
133 trove_guestagent_config {
134 'oslo_messaging_rabbit/kombu_ssl_certfile': ensure => absent;
135 'oslo_messaging_rabbit/kombu_ssl_keyfile': ensure => absent;
136 }
137 }
138
139 if $::trove::kombu_ssl_version {
140 trove_guestagent_config { 'oslo_messaging_rabbit/kombu_ssl_version': value => $::trove::kombu_ssl_version; }
141 } else {
142 trove_guestagent_config { 'oslo_messaging_rabbit/kombu_ssl_version': ensure => absent; }
143 }
144
145 } else {
146 trove_guestagent_config {
147 'oslo_messaging_rabbit/kombu_ssl_ca_certs': ensure => absent;
148 'oslo_messaging_rabbit/kombu_ssl_certfile': ensure => absent;
149 'oslo_messaging_rabbit/kombu_ssl_keyfile': ensure => absent;
150 'oslo_messaging_rabbit/kombu_ssl_version': ensure => absent;
151 }
152 }
153 }
154
155 if $::trove::rpc_backend == 'trove.openstack.common.rpc.impl_qpid' {
156 trove_guestagent_config {
157 'DEFAULT/qpid_hostname': value => $::trove::qpid_hostname;
158 'DEFAULT/qpid_port': value => $::trove::qpid_port;
159 'DEFAULT/qpid_username': value => $::trove::qpid_username;
160 'DEFAULT/qpid_password': value => $::trove::qpid_password, secret => true;
161 'DEFAULT/qpid_heartbeat': value => $::trove::qpid_heartbeat;
162 'DEFAULT/qpid_protocol': value => $::trove::qpid_protocol;
163 'DEFAULT/qpid_tcp_nodelay': value => $::trove::qpid_tcp_nodelay;
164 }
165 if is_array($::trove::qpid_sasl_mechanisms) {
166 trove_guestagent_config {
167 'DEFAULT/qpid_sasl_mechanisms': value => join($::trove::qpid_sasl_mechanisms, ' ');
168 }
169 }
170 }
171
172 # Logging
173 if $log_file {
174 trove_guestagent_config {
175 'DEFAULT/log_file': value => $log_file;
176 }
177 } else {
178 trove_guestagent_config {
179 'DEFAULT/log_file': ensure => absent;
180 }
181 }
182
183 if $log_dir {
184 trove_guestagent_config {
185 'DEFAULT/log_dir': value => $log_dir;
186 }
187 } else {
188 trove_guestagent_config {
189 'DEFAULT/log_dir': ensure => absent;
190 }
191 }
192
193 # Syslog
194 if $use_syslog {
195 trove_guestagent_config {
196 'DEFAULT/use_syslog' : value => true;
197 'DEFAULT/syslog_log_facility' : value => $log_facility;
198 }
199 } else {
200 trove_guestagent_config {
201 'DEFAULT/use_syslog': value => false;
202 }
203 }
204
205 trove::generic_service { 'guestagent':
206 enabled => $enabled,
207 manage_service => $manage_service,
208 package_name => $::trove::params::guestagent_package_name,
209 service_name => $::trove::params::guestagent_service_name,
210 ensure_package => $ensure_package,
211 }
212
213}
diff --git a/deployment_scripts/puppet/modules/trove/manifests/init.pp b/deployment_scripts/puppet/modules/trove/manifests/init.pp
new file mode 100644
index 0000000..bc1b45b
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/manifests/init.pp
@@ -0,0 +1,259 @@
1#
2# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
3#
4# Author: Emilien Macchi <emilien.macchi@enovance.com>
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17
18# trove::init
19#
20# Trove base config
21#
22# == Parameters
23#
24# [*rabbit_host*]
25# (optional) Location of rabbitmq installation.
26# Note that, for security reasons, this rabbitmq host should not be the
27# same that the core openstack services are using for communication. See
28# http://lists.openstack.org/pipermail/openstack-dev/2015-April/061759.html
29# Defaults to 'localhost'
30#
31# [*rabbit_hosts*]
32# (optional) List of clustered rabbit servers.
33# Note that, for security reasons, these rabbitmq hosts should not be the
34# same that the core openstack services are using for communication. See
35# http://lists.openstack.org/pipermail/openstack-dev/2015-April/061759.html
36# Defaults to false
37#
38# [*rabbit_port*]
39# (optional) Port for rabbitmq instance.
40# Defaults to '5672'
41#
42# [*rabbit_password*]
43# (optional) Password used to connect to rabbitmq.
44# Defaults to 'guest'
45#
46# [*rabbit_userid*]
47# (optional) User used to connect to rabbitmq.
48# Defaults to 'guest'
49#
50# [*rabbit_virtual_host*]
51# (optional) The RabbitMQ virtual host.
52# Defaults to '/'
53#
54# [*rabbit_use_ssl*]
55# (optional) Connect over SSL for RabbitMQ
56# Defaults to false
57#
58# [*rabbit_notification_topic*]
59# (optional) Notification topic.
60# Defaults to false.
61#
62# [*kombu_ssl_ca_certs*]
63# (optional) SSL certification authority file (valid only if SSL enabled).
64# Defaults to undef
65#
66# [*kombu_ssl_certfile*]
67# (optional) SSL cert file (valid only if SSL enabled).
68# Defaults to undef
69#
70# [*kombu_ssl_keyfile*]
71# (optional) SSL key file (valid only if SSL enabled).
72# Defaults to undef
73#
74# [*kombu_ssl_version*]
75# (optional) SSL version to use (valid only if SSL enabled).
76# Valid values are TLSv1, SSLv23 and SSLv3. SSLv2 may be
77# available on some distributions.
78# Defaults to 'TLSv1'
79#
80# [*amqp_durable_queues*]
81# (optional) Define queues as "durable" to rabbitmq.
82# Defaults to false
83#
84# [*qpid_hostname*]
85# (optional) Location of qpid server
86# Defaults to 'localhost'
87#
88# [*qpid_port*]
89# (optional) Port for qpid server
90# Defaults to '5672'
91#
92# [*qpid_username*]
93# (optional) Username to use when connecting to qpid
94# Defaults to 'guest'
95#
96# [*qpid_password*]
97# (optional) Password to use when connecting to qpid
98# Defaults to 'guest'
99#
100# [*qpid_heartbeat*]
101# (optional) Seconds between connection keepalive heartbeats
102# Defaults to 60
103#
104# [*qpid_protocol*]
105# (optional) Transport to use, either 'tcp' or 'ssl''
106# Defaults to 'tcp'
107#
108# [*qpid_sasl_mechanisms*]
109# (optional) Enable one or more SASL mechanisms
110# Defaults to false
111#
112# [*qpid_tcp_nodelay*]
113# (optional) Disable Nagle algorithm
114# Defaults to true
115#
116# [*rpc_backend*]
117# (optional) The rpc backend implementation to use, can be:
118# trove.openstack.common.rpc.impl_kombu (for rabbitmq)
119# trove.openstack.common.rpc.impl_qpid (for qpid)
120# Defaults to 'trove.openstack.common.rpc.impl_kombu'
121#
122# [*mysql_module*]
123# (optional) Deprecated. Does nothing.
124# Defaults to undef.
125#
126# [*database_connection*]
127# (optional) Connection url to connect to trove database.
128# Defaults to 'sqlite:////var/lib/trove/trove.sqlite'
129#
130# [*database_idle_timeout*]
131# (optional) Timeout before idle db connections are reaped.
132# Defaults to 3600
133#
134# [*nova_compute_url*]
135# (optional) URL without the tenant segment.
136# Defaults to false.
137#
138# [*nova_proxy_admin_user*]
139# (optional) Admin username used to connect to nova.
140# Defaults to 'admin'
141#
142# [*nova_proxy_admin_pass*]
143# (required) Admin password used to connect to nova.
144#
145# [*nova_proxy_admin_tenant_name*]
146# (optional) Admin tenant name used to connect to nova.
147# Defaults to 'admin'
148#
149# [*control_exchange*]
150# (optional) Control exchange.
151# Defaults to 'trove'.
152#
153# [*cinder_url*]
154# (optional) URL without the tenant segment.
155# Defaults to false.
156#
157# [*swift_url*]
158# (optional) Swift URL ending in AUTH_.
159# Defaults to false.
160#
161# [*use_neutron*]
162# (optional) Use Neutron
163# Defaults to true
164#
165# [*package_ensure*]
166# (optional) The state of the package.
167# Defaults to 'present'
168#
169class trove(
170 $nova_proxy_admin_pass,
171 $rabbit_host = 'localhost',
172 $rabbit_hosts = false,
173 $rabbit_password = 'guest',
174 $rabbit_port = '5672',
175 $rabbit_userid = 'guest',
176 $rabbit_virtual_host = '/',
177 $rabbit_use_ssl = false,
178 $rabbit_notification_topic = 'notifications',
179 $kombu_ssl_ca_certs = undef,
180 $kombu_ssl_certfile = undef,
181 $kombu_ssl_keyfile = undef,
182 $kombu_ssl_version = 'TLSv1',
183 $amqp_durable_queues = false,
184 $database_connection = 'sqlite:////var/lib/trove/trove.sqlite',
185 $database_idle_timeout = 3600,
186 $rpc_backend = 'trove.openstack.common.rpc.impl_kombu',
187 $nova_compute_url = false,
188 $nova_proxy_admin_user = 'admin',
189 $nova_proxy_admin_tenant_name = 'admin',
190 $control_exchange = 'trove',
191 $cinder_url = false,
192 $swift_url = false,
193 $use_neutron = true,
194 $package_ensure = 'present',
195 # DEPRECATED PARAMETERS
196 $mysql_module = undef,
197) {
198 include ::trove::params
199
200 if $mysql_module {
201 warning('The mysql_module parameter is deprecated. The latest 2.x mysql module will be used.')
202 }
203
204 exec { 'post-trove_config':
205 command => '/bin/echo "Trove config has changed"',
206 refreshonly => true,
207 }
208
209 Trove_datastore<||> -> Trove_datastore_version<||>
210
211 if $nova_compute_url {
212 trove_config { 'DEFAULT/nova_compute_url': value => $nova_compute_url }
213 }
214 else {
215 trove_config { 'DEFAULT/nova_compute_url': ensure => absent }
216 }
217
218 if $cinder_url {
219 trove_config { 'DEFAULT/cinder_url': value => $cinder_url }
220 }
221 else {
222 trove_config { 'DEFAULT/cinder_url': ensure => absent }
223 }
224
225 if $swift_url {
226 trove_config { 'DEFAULT/swift_url': value => $swift_url }
227 }
228 else {
229 trove_config { 'DEFAULT/swift_url': ensure => absent }
230 }
231
232 if $::osfamily == 'RedHat' {
233 # TO-DO(mmagr): Conditional should be removed as soon as following bug
234 # is really fixed. On Ubuntu trove-common is not installable without already
235 # running database and correctly filled trove.conf:
236 # https://bugs.launchpad.net/ubuntu/+source/openstack-trove/+bug/1365561
237 package { 'trove':
238 ensure => $package_ensure,
239 name => $::trove::params::common_package_name
240 }
241 $group_require = Package['trove']
242 } else {
243 $group_require = undef
244 }
245
246 group { 'trove':
247 ensure => 'present',
248 name => 'trove',
249 system => true,
250 require => $group_require
251 }
252
253 file { '/etc/trove/':
254 ensure => directory,
255 group => 'trove',
256 require => Group['trove']
257 }
258
259}
diff --git a/deployment_scripts/puppet/modules/trove/manifests/keystone/auth.pp b/deployment_scripts/puppet/modules/trove/manifests/keystone/auth.pp
new file mode 100644
index 0000000..b76309a
--- /dev/null
+++ b/deployment_scripts/puppet/modules/trove/manifests/keystone/auth.pp
@@ -0,0 +1,220 @@
1#
2# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
3#
4# Author: Emilien Macchi <emilien.macchi@enovance.com>
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17#
18# trove::keystone::auth
19#
20# Configures Trove user, service and endpoint in Keystone.
21#
22# === Parameters
23#
24# [*password*]
25# (required) Password for Trove user.
26#
27# [*auth_name*]
28# Username for Trove service. Defaults to 'trove'.
29#
30# [*email*]
31# Email for Trove user. Defaults to 'trove@localhost'.
32#
33# [*tenant*]
34# Tenant for Trove user. Defaults to 'services'.
35#
36# [*configure_endpoint*]
37# Should Trove endpoint be configured? Defaults to 'true'.
38#
39# [*service_type*]
40# Type of service. Defaults to 'database'.
41#
42# [*service_name*]
43# (optional) Name of the service.
44# Defaults to the value of auth_name.
45#
46# [*region*]
47# Region for endpoint. Defaults to 'RegionOne'.
48#
49# [*public_url*]
50# (optional) The endpoint's public url. (Defaults to 'http://127.0.0.1:8779/v1.0/%(tenant_id)s')
51# This url should *not* contain any trailing '/'.
52#
53# [*admin_url*]
54# (optional) The endpoint's admin url. (Defaults to 'http://127.0.0.1:8779/v1.0/%(tenant_id)s')
55# This url should *not* contain any trailing '/'.
56#
57# [*internal_url*]
58# (optional) The endpoint's internal url. (Defaults to 'http://127.0.0.1:8779/v1.0/%(tenant_id)s')
59# This url should *not* contain any trailing '/'.
60#
61# [*port*]
62# (optional) DEPRECATED: Use public_url, internal_url and admin_url instead.
63# Default port for endpoints. (Defaults to 9001)
64# Setting this parameter overrides public_url, internal_url and admin_url parameters.
65#
66# [*public_port*]
67# (optional) DEPRECATED: Use public_url instead.
68# Default port for endpoints. (Defaults to $port)
69# Setting this parameter overrides public_url parameter.
70#
71# [*public_protocol*]
72# (optional) DEPRECATED: Use public_url instead.
73# Protocol for public endpoint. (Defaults to 'http')
74# Setting this parameter overrides public_url parameter.
75#
76# [*public_address*]
77# (optional) DEPRECATED: Use public_url instead.
78# Public address for endpoint. (Defaults to '127.0.0.1')
79# Setting this parameter overrides public_url parameter.
80#
81# [*internal_protocol*]
82# (optional) DEPRECATED: Use internal_url instead.
83# Protocol for internal endpoint. (Defaults to 'http')
84# Setting this parameter overrides internal_url parameter.
85#
86# [*internal_address*]
87# (optional) DEPRECATED: Use internal_url instead.
88# Internal address for endpoint. (Defaults to '127.0.0.1')
89# Setting this parameter overrides internal_url parameter.
90#
91# [*admin_protocol*]
92# (optional) DEPRECATED: Use admin_url instead.
93# Protocol for admin endpoint. (Defaults to 'http')
94# Setting this parameter overrides admin_url parameter.
95#
96# [*admin_address*]
97# (optional) DEPRECATED: Use admin_url instead.
98# Admin address for endpoint. (Defaults to '127.0.0.1')
99# Setting this parameter overrides admin_url parameter.
100#
101# === Deprecation notes
102#
103# If any value is provided for public_protocol, public_address or port parameters,
104# public_url will be completely ignored. The same applies for internal and admin parameters.
105#
106# === Examples
107#
108# class { 'trove::keystone::auth':
109# public_url => 'https://10.0.0.10:8779/v1.0/%(tenant_id)s',
110# internal_url => 'https://10.0.0.11:8779/v1.0/%(tenant_id)s',
111# admin_url => 'https://10.0.0.11:8779/v1.0/%(tenant_id)s',
112# }
113#
114class trove::keystone::auth (
115 $password,
116 $auth_name = 'trove',
117 $email = 'trove@localhost',
118 $tenant = 'services',
119 $configure_endpoint = true,
120 $service_name = undef,
121 $service_type = 'database',
122 $region = 'RegionOne',
123 $public_url = 'http://127.0.0.1:8779/v1.0/%(tenant_id)s',
124 $admin_url = 'http://127.0.0.1:8779/v1.0/%(tenant_id)s',
125 $internal_url = 'http://127.0.0.1:8779/v1.0/%(tenant_id)s',
126 # DEPRECATED PARAMETERS
127 $port = undef,
128 $public_port = undef,
129 $public_protocol = undef,
130 $public_address = undef,
131 $internal_protocol = undef,
132 $internal_address = undef,
133 $admin_protocol = undef,
134 $admin_address = undef,