Add cinder api puppet resource
Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
This commit is contained in:
parent
5f7129c98c
commit
800054cc90
106
resources/cinder_api_puppet/README.md
Normal file
106
resources/cinder_api_puppet/README.md
Normal file
@ -0,0 +1,106 @@
|
||||
# Cinder API resource for puppet handler
|
||||
#
|
||||
# source https://github.com/openstack/puppet-cinder/blob/5.1.0/manifests/api.pp
|
||||
#
|
||||
# Setup and configure the cinder API endpoint
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*keystone_password*]
|
||||
# The password to use for authentication (keystone)
|
||||
#
|
||||
# [*keystone_enabled*]
|
||||
# (optional) Use keystone for authentification
|
||||
# Defaults to true
|
||||
#
|
||||
# [*keystone_tenant*]
|
||||
# (optional) The tenant of the auth user
|
||||
# Defaults to services
|
||||
#
|
||||
# [*keystone_user*]
|
||||
# (optional) The name of the auth user
|
||||
# Defaults to cinder
|
||||
#
|
||||
# [*keystone_auth_host*]
|
||||
# (optional) The keystone host
|
||||
# Defaults to localhost
|
||||
#
|
||||
# [*keystone_auth_port*]
|
||||
# (optional) The keystone auth port
|
||||
# Defaults to 35357
|
||||
#
|
||||
# [*keystone_auth_protocol*]
|
||||
# (optional) The protocol used to access the auth host
|
||||
# Defaults to http.
|
||||
#
|
||||
# [*os_region_name*]
|
||||
# (optional) Some operations require cinder to make API requests
|
||||
# to Nova. This sets the keystone region to be used for these
|
||||
# requests. For example, boot-from-volume.
|
||||
# Defaults to undef.
|
||||
#
|
||||
# [*keystone_auth_admin_prefix*]
|
||||
# (optional) The admin_prefix used to admin endpoint of the auth host
|
||||
# This allow admin auth URIs like http://auth_host:35357/keystone.
|
||||
# (where '/keystone' is the admin prefix)
|
||||
# Defaults to false for empty. If defined, should be a string with a
|
||||
# leading '/' and no trailing '/'.
|
||||
#
|
||||
# [*service_port*]
|
||||
# (optional) The cinder api port
|
||||
# Defaults to 5000
|
||||
#
|
||||
# [*service_workers*]
|
||||
# (optional) Number of cinder-api workers
|
||||
# Defaults to $::processorcount
|
||||
#
|
||||
# [*package_ensure*]
|
||||
# (optional) The state of the package
|
||||
# Defaults to present
|
||||
#
|
||||
# [*bind_host*]
|
||||
# (optional) The cinder api bind address
|
||||
# Defaults to 0.0.0.0
|
||||
#
|
||||
# [*enabled*]
|
||||
# (optional) The state of the service
|
||||
# Defaults to true
|
||||
#
|
||||
# [*manage_service*]
|
||||
# (optional) Whether to start/stop the service
|
||||
# Defaults to true
|
||||
#
|
||||
# [*ratelimits*]
|
||||
# (optional) The state of the service
|
||||
# Defaults to undef. If undefined the default ratelimiting values are used.
|
||||
#
|
||||
# [*ratelimits_factory*]
|
||||
# (optional) Factory to use for ratelimiting
|
||||
# Defaults to 'cinder.api.v1.limits:RateLimitingMiddleware.factory'
|
||||
#
|
||||
# [*default_volume_type*]
|
||||
# (optional) default volume type to use.
|
||||
# This should contain the name of the default volume type to use.
|
||||
# If not configured, it produces an error when creating a volume
|
||||
# without specifying a type.
|
||||
# Defaults to 'false'.
|
||||
#
|
||||
# [*validate*]
|
||||
# (optional) Whether to validate the service is working after any service refreshes
|
||||
# Defaults to false
|
||||
#
|
||||
# [*validation_options*]
|
||||
# (optional) Service validation options
|
||||
# Should be a hash of options defined in openstacklib::service_validation
|
||||
# If empty, defaults values are taken from openstacklib function.
|
||||
# Default command list volumes.
|
||||
# Require validate set at True.
|
||||
# Example:
|
||||
# glance::api::validation_options:
|
||||
# glance-api:
|
||||
# command: check_cinder-api.py
|
||||
# path: /usr/bin:/bin:/usr/sbin:/sbin
|
||||
# provider: shell
|
||||
# tries: 5
|
||||
# try_sleep: 10
|
||||
# Defaults to {}
|
4
resources/cinder_api_puppet/actions/remove.pp
Normal file
4
resources/cinder_api_puppet/actions/remove.pp
Normal file
@ -0,0 +1,4 @@
|
||||
class {'cinder::api':
|
||||
enabled => false,
|
||||
package_ensure => 'absent'
|
||||
}
|
51
resources/cinder_api_puppet/actions/run.pp
Normal file
51
resources/cinder_api_puppet/actions/run.pp
Normal file
@ -0,0 +1,51 @@
|
||||
$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_enabled = $resource['input']['keystone_enabled']['value']
|
||||
$keystone_tenant = $resource['input']['keystone_tenant']['value']
|
||||
$keystone_user = $resource['input']['keystone_user']['value']
|
||||
$keystone_auth_host = $resource['input']['keystone_auth_host']['value']
|
||||
$keystone_auth_port = $resource['input']['keystone_auth_port']['value']
|
||||
$keystone_auth_protocol = $resource['input']['keystone_auth_protocol']['value']
|
||||
$keystone_auth_admin_prefix = $resource['input']['keystone_auth_admin_prefix']['value']
|
||||
$keystone_auth_uri = $resource['input']['keystone_auth_uri']['value']
|
||||
$os_region_name = $resource['input']['os_region_name']['value']
|
||||
$service_port = $resource['input']['service_port']['value']
|
||||
$service_workers = $resource['input']['service_workers']['value']
|
||||
$package_ensure = $resource['input']['package_ensure']['value']
|
||||
$bind_host = $resource['input']['bind_host']['value']
|
||||
$enabled = $resource['input']['enabled']['value']
|
||||
$manage_service = $resource['input']['manage_service']['value']
|
||||
$ratelimits = $resource['input']['ratelimits']['value']
|
||||
$default_volume_type = $resource['input']['default_volume_type']['value']
|
||||
$ratelimits_factory = $resource['input']['ratelimits_factory']['value']
|
||||
$validate = $resource['input']['validate']['value']
|
||||
$validation_options = $resource['input']['validation_options']['value']
|
||||
|
||||
class {'cinder::api':
|
||||
keystone_enabled => $keystone_enabled,
|
||||
keystone_tenant => $keystone_tenant,
|
||||
keystone_user => $keystone_user,
|
||||
keystone_auth_host => $keystone_auth_host,
|
||||
keystone_auth_port => $keystone_auth_port,
|
||||
keystone_auth_protocol => $keystone_auth_protocol,
|
||||
keystone_auth_admin_prefix => $keystone_auth_admin_prefix,
|
||||
keystone_auth_uri => $keystone_auth_uri,
|
||||
os_region_name => $os_region_name,
|
||||
service_port => $service_port,
|
||||
service_workers => $service_workers,
|
||||
package_ensure => $package_ensure,
|
||||
bind_host => $bind_host,
|
||||
enabled => $enabled,
|
||||
manage_service => $manage_service,
|
||||
ratelimits => $ratelimits,
|
||||
default_volume_type => $default_volume_type,
|
||||
ratelimits_factory => $ratelimits_factory,
|
||||
validate => $validate,
|
||||
validation_options => $validation_options,
|
||||
}
|
81
resources/cinder_api_puppet/meta.yaml
Normal file
81
resources/cinder_api_puppet/meta.yaml
Normal file
@ -0,0 +1,81 @@
|
||||
id: cinder_api_puppet
|
||||
handler: puppet
|
||||
puppet_module: cinder_api
|
||||
version: 1.0.0
|
||||
input:
|
||||
keystone_enabled:
|
||||
schema: bool
|
||||
value: true
|
||||
keystone_tenant:
|
||||
schema: str
|
||||
value: 'services'
|
||||
keystone_user:
|
||||
schema: str
|
||||
value: 'cinder'
|
||||
keystone_auth_host:
|
||||
schema: str
|
||||
value: 'localhost'
|
||||
keystone_auth_port:
|
||||
schema: int
|
||||
value: 35357
|
||||
keystone_auth_protocol:
|
||||
schema: str
|
||||
value: 'http'
|
||||
keystone_auth_admin_prefix:
|
||||
schema: bool
|
||||
value: false
|
||||
keystone_auth_uri:
|
||||
schema: bool
|
||||
value: false
|
||||
os_region_name:
|
||||
schema: str
|
||||
value: undef
|
||||
service_port:
|
||||
schema: int
|
||||
value: 5000
|
||||
service_workers:
|
||||
schema: str
|
||||
value: $::processorcount
|
||||
package_ensure:
|
||||
schema: str
|
||||
value: 'present'
|
||||
bind_host:
|
||||
schema: str
|
||||
value: '0.0.0.0'
|
||||
enabled:
|
||||
schema: bool
|
||||
value: true
|
||||
manage_service:
|
||||
schema: bool
|
||||
value: true
|
||||
ratelimits:
|
||||
schema: str
|
||||
value: undef
|
||||
default_volume_type:
|
||||
schema: bool
|
||||
value: false
|
||||
ratelimits_factory:
|
||||
schema: str
|
||||
value:
|
||||
validate:
|
||||
schema: bool
|
||||
value: false
|
||||
validation_options:
|
||||
schema: {}
|
||||
value: {}
|
||||
|
||||
git:
|
||||
schema: {repository: str!, branch: str!}
|
||||
value: {repository: 'https://github.com/openstack/puppet-cinder_api', branch: '5.1.0'}
|
||||
|
||||
ip:
|
||||
schema: str!
|
||||
value:
|
||||
ssh_key:
|
||||
schema: str!
|
||||
value:
|
||||
ssh_user:
|
||||
schema: str!
|
||||
value:
|
||||
|
||||
tags: [resource/cinder_api_service, resources/cinder_api]
|
10
resources/cinder_api_puppet/test.py
Normal file
10
resources/cinder_api_puppet/test.py
Normal file
@ -0,0 +1,10 @@
|
||||
import requests
|
||||
|
||||
from solar.core.log import log
|
||||
|
||||
|
||||
def test(resource):
|
||||
log.debug('Testing cinder_api_puppet')
|
||||
requests.get(
|
||||
'http://%s:%s' % (resource.args['ip'].value, resource.args['port'].value)
|
||||
)
|
Loading…
x
Reference in New Issue
Block a user