Add glance registry puppet resource

Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
This commit is contained in:
Bogdan Dobrelya 2015-07-28 11:59:03 +02:00
parent 9737373d37
commit 1b400b27e3
7 changed files with 336 additions and 3 deletions

View File

@ -1,13 +1,13 @@
Glance (API) resource for puppet handler
# Glance (API) resource for puppet handler
Controlls a live cycle of the glance entities,
like the main puppet class, auth, DB, AMQP, packages,
keystone user, role and endpoint, API service. Also configures
glance file backend.
Parameters
# Parameters
source https://github.com/openstack/puppet-glance/tree/5.1.0/manifests
source https://github.com/openstack/puppet-glance/tree/5.1.0/manifests/init.pp
``package_ensure``
Ensure state for package.

View File

@ -0,0 +1,116 @@
# Glance registry resource for puppet handler
Configures glance registry service.
# Parameters
source https://github.com/openstack/puppet-glance/tree/5.1.0/manifests/registry.pp
``keystone_password``
(required) The keystone password for administrative user
``package_ensure``
(optional) Ensure state for package. Defaults to 'present'. On RedHat
platforms this setting is ignored and the setting from the glance class is
used because there is only one glance package.
``verbose``
(optional) Enable verbose logs (true|false). Defaults to false.
``debug``
(optional) Enable debug logs (true|false). Defaults to false.
``bind_host``
(optional) The address of the host to bind to. Defaults to '0.0.0.0'.
``bind_port``
(optional) The port the server should bind to. Defaults to '9191'.
``log_file``
(optional) Log file for glance-registry.
If set to boolean false, it will not log to any file.
Defaults to '/var/log/glance/registry.log'.
``log_dir``
(optional) directory to which glance logs are sent.
If set to boolean false, it will not log to any directory.
Defaults to '/var/log/glance'
``sql_idle_timeout``
(optional) Deprecated. Use database_idle_timeout instead
Defaults to false
``sql_connection``
(optional) Deprecated. Use database_connection instead.
Defaults to false
``database_connection``
(optional) Connection url to connect to nova database.
Defaults to 'sqlite:///var/lib/glance/glance.sqlite'
``database_idle_timeout``
(optional) Timeout before idle db connections are reaped.
Defaults to 3600
``auth_type``
(optional) Authentication type. Defaults to 'keystone'.
``auth_host``
(optional) Address of the admin authentication endpoint.
Defaults to '127.0.0.1'.
``auth_port``
(optional) Port of the admin authentication endpoint. Defaults to '35357'.
``auth_admin_prefix``
(optional) path part of the auth url.
This allow admin auth URIs like http://auth_host:35357/keystone/admin.
(where '/keystone/admin' is auth_admin_prefix)
Defaults to false for empty. If defined, should be a string with a leading '/' and no trailing '/'.
``auth_protocol``
(optional) Protocol to communicate with the admin authentication endpoint.
Defaults to 'http'. Should be 'http' or 'https'.
``auth_uri``
(optional) Complete public Identity API endpoint.
``keystone_tenant``
(optional) administrative tenant name to connect to keystone.
Defaults to 'services'.
``keystone_user``
(optional) administrative user name to connect to keystone.
Defaults to 'glance'.
``use_syslog``
(optional) Use syslog for logging.
Defaults to false.
``log_facility``
(optional) Syslog facility to receive log lines.
Defaults to LOG_USER.
``purge_config``
(optional) Whether to create only the specified config values in
the glance registry config file.
Defaults to false.
``cert_file``
(optinal) Certificate file to use when starting registry server securely
Defaults to false, not set
``key_file``
(optional) Private key file to use when starting registry server securely
Defaults to false, not set
``ca_file``
(optional) CA certificate file to use to verify connecting clients
Defaults to false, not set
``sync_db``
(Optional) Run db sync on the node.
Defaults to true
``mysql_module``
(optional) Deprecated. Does nothing.

View File

@ -0,0 +1,6 @@
$resource = hiera($::resource_name)
class {'glance::registry':
enabled => false,
package_ensure => 'absent',
}

View File

@ -0,0 +1,72 @@
$resource = hiera($::resource_name)
$ip = $resource['input']['ip']['value']
$db_user = $resource['input']['db_user']['value']
$db_password = $resource['input']['db_password']['value']
$db_name = $resource['input']['db_name']['value']
$keystone_password = $resource['input']['keystone_password']['value']
$package_ensure = $resource['input']['package_ensure']['value']
$verbose = $resource['input']['verbose']['value']
$debug = $resource['input']['debug']['value']
$bind_host = $resource['input']['bind_host']['value']
$bind_port = $resource['input']['bind_port']['value']
$log_file = $resource['input']['log_file']['value']
$log_dir = $resource['input']['log_dir']['value']
$database_connection = $resource['input']['database_connection']['value']
$database_idle_timeout = $resource['input']['database_idle_timeout']['value']
$auth_type = $resource['input']['auth_type']['value']
$auth_host = $resource['input']['auth_host']['value']
$auth_port = $resource['input']['auth_port']['value']
$auth_admin_prefix = $resource['input']['auth_admin_prefix']['value']
$auth_uri = $resource['input']['auth_uri']['value']
$auth_protocol = $resource['input']['auth_protocol']['value']
$keystone_tenant = $resource['input']['keystone_tenant']['value']
$keystone_user = $resource['input']['keystone_user']['value']
$pipeline = $resource['input']['pipeline']['value']
$use_syslog = $resource['input']['use_syslog']['value']
$log_facility = $resource['input']['log_facility']['value']
$purge_config = $resource['input']['purge_config']['value']
$cert_file = $resource['input']['cert_file']['value']
$key_file = $resource['input']['key_file']['value']
$ca_file = $resource['input']['ca_file']['value']
$sync_db = $resource['input']['sync_db']['value']
$mysql_module = $resource['input']['mysql_module']['value']
$sql_idle_timeout = $resource['input']['sql_idle_timeout']['value']
$sql_connection = $resource['input']['sql_connection']['value']
include glance::params
class {'glance::registry':
keystone_password => $keystone_password,
enabled => true,
manage_service => true,
package_ensure => $package_ensure,
verbose => $verbose,
debug => $debug,
bind_host => $bind_host,
bind_port => $bind_port,
log_file => $log_file,
log_dir => $log_dir,
database_connection => "mysql://${db_user}:${db_password}@${ip}/${db_name}",
database_idle_timeout => $database_idle_timeout,
auth_type => $auth_type,
auth_host => $auth_host,
auth_port => $auth_port,
auth_admin_prefix => $auth_admin_prefix,
auth_uri => $auth_uri,
auth_protocol => $auth_protocol,
keystone_tenant => $keystone_tenant,
keystone_user => $keystone_user,
pipeline => $pipeline,
use_syslog => $use_syslog,
log_facility => $log_facility,
purge_config => $purge_config,
cert_file => $cert_file,
key_file => $key_file,
ca_file => $ca_file,
sync_db => $sync_db,
mysql_module => $mysql_module,
sql_idle_timeout => $sql_idle_timeout,
}

View File

@ -0,0 +1 @@
notify { "noop update": }

View File

@ -0,0 +1,128 @@
id: glance_registry_puppet
handler: puppet
puppet_module: glance
version: 1.0.0
input:
package_ensure:
schema: str
value: 'present'
verbose:
schema: bool
value: false
debug:
schema: bool
value: false
bind_host:
schema: str
value: '0.0.0.0'
bind_port:
schema: int
value: 9191
log_file:
schema: str
value: '/var/log/glance/registry.log'
log_dir:
schema: str
value: '/var/log/glance'
database_connection:
schema: str
value: 'sqlite:///var/lib/glance/glance.sqlite'
database_idle_timeout:
schema: int
value: 3600
auth_type:
schema: str
value: 'keystone'
auth_host:
schema: str
value: '127.0.0.1'
auth_port:
schema: int
value: 35357
auth_admin_prefix:
schema: str
value: ''
auth_uri:
schema: str
value: ''
auth_protocol:
schema: str
value: 'http'
keystone_tenant:
schema: str!
value: 'services'
keystone_user:
schema: str!
value: 'glance'
pipeline:
schema: str
value: 'keystone'
use_syslog:
schema: bool
value: false
log_facility:
schema: str
value: 'LOG_USER'
purge_config:
schema: bool
value: false
cert_file:
schema: str
value: ''
key_file:
schema: str
value: ''
ca_file:
schema: str
value: ''
sync_db:
schema: bool
value: true
mysql_module:
schema: str
value: ''
sql_idle_timeout:
schema: str
value: ''
sql_connection:
schema: str
value: ''
git:
schema: {repository: str!, branch: str!}
value: {repository: 'https://github.com/openstack/puppet-glance', branch: '5.1.0'}
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
db_user:
schema: str!
value: glance
db_password:
schema: str!
value: glance
db_name:
schema: str!
value: glance
db_host:
schema: str!
value:
keystone_host:
schema: str!
value: ''
keystone_port:
schema: int!
value: ''
keystone_password:
schema: str!
value: ''
tags: [resource/glance_registry_service, resources/glance_registry, resource/glance]

View File

@ -0,0 +1,10 @@
import requests
from solar.core.log import log
def test(resource):
log.debug('Testing glance_registry_puppet')
requests.get(
'http://%s:%s' % (resource.args['ip'].value, resource.args['port'].value)
)