2016-02-17 13:22:08 -05:00
|
|
|
# Configure the Glance service
|
|
|
|
#
|
|
|
|
# [*backend*]
|
|
|
|
# (optional) Glance backend to use.
|
2016-02-25 18:34:15 +03:00
|
|
|
# Can be 'file', 'swift' or 'rbd'.
|
2016-02-17 13:22:08 -05:00
|
|
|
# Defaults to 'file'.
|
|
|
|
#
|
|
|
|
class openstack_integration::glance (
|
|
|
|
$backend = 'file',
|
|
|
|
) {
|
2015-12-23 22:54:56 +01:00
|
|
|
|
2019-12-08 12:59:28 +01:00
|
|
|
include openstack_integration::config
|
|
|
|
include openstack_integration::params
|
2016-03-01 18:50:40 -05:00
|
|
|
|
|
|
|
if $::openstack_integration::config::ssl {
|
|
|
|
openstack_integration::ssl_key { 'glance':
|
|
|
|
}
|
2021-02-01 10:49:31 +01:00
|
|
|
$key_file = undef
|
|
|
|
$crt_file = undef
|
2018-03-27 04:28:42 +00:00
|
|
|
} else {
|
|
|
|
$key_file = undef
|
|
|
|
$crt_file = undef
|
2016-03-01 18:50:40 -05:00
|
|
|
}
|
2016-02-26 19:13:28 -05:00
|
|
|
|
2017-09-15 08:33:55 -04:00
|
|
|
openstack_integration::mq_user { 'glance':
|
2015-12-23 22:54:56 +01:00
|
|
|
password => 'an_even_bigger_secret',
|
2017-09-15 08:33:55 -04:00
|
|
|
before => Anchor['glance::service::begin'],
|
2017-01-06 08:57:09 -05:00
|
|
|
}
|
|
|
|
|
2019-12-08 12:59:28 +01:00
|
|
|
class { 'glance::db::mysql':
|
2015-12-23 22:54:56 +01:00
|
|
|
password => 'glance',
|
|
|
|
}
|
2019-12-08 12:59:28 +01:00
|
|
|
include glance
|
|
|
|
include glance::client
|
|
|
|
class { 'glance::keystone::auth':
|
2021-02-01 10:49:31 +01:00
|
|
|
public_url => "http://${::openstack_integration::config::ip_for_url}:9292",
|
|
|
|
internal_url => "http://${::openstack_integration::config::ip_for_url}:9292",
|
|
|
|
admin_url => "http://${::openstack_integration::config::ip_for_url}:9292",
|
2016-03-01 18:50:40 -05:00
|
|
|
password => 'a_big_secret',
|
2015-12-23 22:54:56 +01:00
|
|
|
}
|
2019-12-08 12:59:28 +01:00
|
|
|
class { 'glance::api::authtoken':
|
2018-04-24 20:25:27 +08:00
|
|
|
password => 'a_big_secret',
|
|
|
|
user_domain_name => 'Default',
|
|
|
|
project_domain_name => 'Default',
|
|
|
|
auth_url => $::openstack_integration::config::keystone_admin_uri,
|
|
|
|
www_authenticate_uri => $::openstack_integration::config::keystone_auth_uri,
|
|
|
|
memcached_servers => $::openstack_integration::config::memcached_servers,
|
2016-08-29 16:36:01 -04:00
|
|
|
}
|
2016-02-17 13:22:08 -05:00
|
|
|
case $backend {
|
|
|
|
'file': {
|
2020-11-09 22:43:16 +09:00
|
|
|
glance::backend::multistore::file { 'file1': }
|
|
|
|
$default_backend = 'file1'
|
2016-02-17 13:22:08 -05:00
|
|
|
}
|
|
|
|
'rbd': {
|
2020-11-09 22:43:16 +09:00
|
|
|
glance::backend::multistore::rbd { 'rbd1':
|
2016-02-17 13:22:08 -05:00
|
|
|
rbd_store_user => 'openstack',
|
|
|
|
rbd_store_pool => 'glance',
|
|
|
|
}
|
|
|
|
# make sure ceph pool exists before running Glance API
|
|
|
|
Exec['create-glance'] -> Service['glance-api']
|
2020-11-09 22:43:16 +09:00
|
|
|
$default_backend = 'rbd1'
|
2016-02-17 13:22:08 -05:00
|
|
|
}
|
2016-02-25 18:34:15 +03:00
|
|
|
'swift': {
|
2020-11-09 22:43:16 +09:00
|
|
|
glance::backend::multistore::swift { 'swift1':
|
2016-02-25 18:34:15 +03:00
|
|
|
swift_store_user => 'services:glance',
|
|
|
|
swift_store_key => 'a_big_secret',
|
|
|
|
swift_store_create_container_on_put => 'True',
|
2016-04-01 13:17:16 -04:00
|
|
|
swift_store_auth_address => "${::openstack_integration::config::keystone_auth_uri}/v3",
|
|
|
|
swift_store_auth_version => '3',
|
2016-02-25 18:34:15 +03:00
|
|
|
}
|
2020-11-09 22:43:16 +09:00
|
|
|
$default_backend = 'swift1'
|
2016-02-25 18:34:15 +03:00
|
|
|
}
|
2016-02-17 13:22:08 -05:00
|
|
|
default: {
|
|
|
|
fail("Unsupported backend (${backend})")
|
|
|
|
}
|
|
|
|
}
|
2020-11-09 22:43:16 +09:00
|
|
|
|
|
|
|
$enabled_backends = ["${default_backend}:${backend}"]
|
|
|
|
|
2019-12-08 12:59:28 +01:00
|
|
|
class { 'glance::api::logging':
|
2018-11-27 23:24:00 +01:00
|
|
|
debug => true,
|
|
|
|
}
|
2021-04-30 17:39:27 +09:00
|
|
|
class { 'glance::api::db':
|
2016-01-08 13:26:10 -05:00
|
|
|
database_connection => 'mysql+pymysql://glance:glance@127.0.0.1/glance?charset=utf8',
|
2021-04-30 17:39:27 +09:00
|
|
|
}
|
|
|
|
class { 'glance::api':
|
|
|
|
workers => 2,
|
|
|
|
enabled_backends => $enabled_backends,
|
|
|
|
default_backend => $default_backend,
|
|
|
|
bind_host => $::openstack_integration::config::host,
|
|
|
|
cert_file => $crt_file,
|
|
|
|
key_file => $key_file,
|
2015-12-23 22:54:56 +01:00
|
|
|
}
|
2021-05-23 22:24:14 +09:00
|
|
|
class { 'glance::cron::db_purge': }
|
2019-12-08 12:59:28 +01:00
|
|
|
class { 'glance::notify::rabbitmq':
|
2017-01-06 08:57:09 -05:00
|
|
|
default_transport_url => os_transport_url({
|
|
|
|
'transport' => $::openstack_integration::config::messaging_default_proto,
|
|
|
|
'host' => $::openstack_integration::config::host,
|
|
|
|
'port' => $::openstack_integration::config::messaging_default_port,
|
|
|
|
'username' => 'glance',
|
|
|
|
'password' => 'an_even_bigger_secret',
|
|
|
|
}),
|
|
|
|
notification_transport_url => os_transport_url({
|
|
|
|
'transport' => $::openstack_integration::config::messaging_notify_proto,
|
2016-11-09 09:41:17 -07:00
|
|
|
'host' => $::openstack_integration::config::host,
|
2017-01-06 08:57:09 -05:00
|
|
|
'port' => $::openstack_integration::config::messaging_notify_port,
|
2016-11-09 09:41:17 -07:00
|
|
|
'username' => 'glance',
|
|
|
|
'password' => 'an_even_bigger_secret',
|
|
|
|
}),
|
2017-01-06 08:57:09 -05:00
|
|
|
notification_driver => 'messagingv2',
|
|
|
|
rabbit_use_ssl => $::openstack_integration::config::ssl,
|
2015-12-23 22:54:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|