diff --git a/manifests/api/config.pp b/manifests/api/config.pp new file mode 100644 index 00000000..de716851 --- /dev/null +++ b/manifests/api/config.pp @@ -0,0 +1,20 @@ +# +# Can be used to specify configuration +# sections in glance-api.conf +# +# It will assume that the config +# +# +define glance::api::config( + $config = {}, + $file_name = regsubst($name, ':', '_', 'G'), + $content = template("glance/api/${name}.erb"), + $order = undef +) { + concat::fragment { $name: + target => '/etc/glance/glance-api.conf', + content => $content, + order => $order, + } +} + diff --git a/manifests/backend.pp b/manifests/backend.pp new file mode 100644 index 00000000..7c678bd0 --- /dev/null +++ b/manifests/backend.pp @@ -0,0 +1,15 @@ +# +# used to model the line in the file +# that configures which storage backend +# to use +# +class glance::backend( + $default_store +) { + glance::api::config { 'backend': + config => { + 'default_store' => $default_store + }, + order => '02', + } +} diff --git a/manifests/backend/file.pp b/manifests/backend/file.pp new file mode 100644 index 00000000..6be21f78 --- /dev/null +++ b/manifests/backend/file.pp @@ -0,0 +1,23 @@ +# +# used to configure file backends for glance +# +# $filesystem_store_datadir - Location where dist images are stored when +# default_store == file. +# Optional. Default: /var/lib/glance/images/ +class glance::backend::file( + $filesystem_store_datadir = '/var/lib/glance/images/' +) inherits glance::api { + + # set file as default store + class { 'glance::backend': + default_store => 'file', + } + + # configure directory where files should be stored + glance::api::config { 'file': + config => { + 'filesystem_store_datadir' => $filesystem_store_datadir + }, + order => '05', + } +} diff --git a/manifests/backend/swift.pp b/manifests/backend/swift.pp new file mode 100644 index 00000000..3a2874be --- /dev/null +++ b/manifests/backend/swift.pp @@ -0,0 +1,40 @@ +# +# configures the storage backend for glance +# as a swift instance +# +# $swift_store_auth_address - Optional. Default: '127.0.0.1:8080/v1.0/', +# +# $swift_store_user - Optional. Default:'jdoe', +# +# $swift_store_key - Optional. Default: 'a86850deb2742ec3cb41518e26aa2d89', +# +# $swift_store_container - 'glance', +# +# $swift_store_create_container_on_put - 'False' +class glance::backend::swift( + $swift_store_user, + $swift_store_key, + $swift_store_auth_address = '127.0.0.1:8080/v1.0/', + $swift_store_container = 'glance', + $swift_store_create_container_on_put = 'False', +) inherits glance::api { + + # specify swift as backend + class { 'glance::backend': + default_store => 'swift', + } + + glance::api::config { 'swift': + config => { + 'swift_store_user' => $swift_store_user, + 'swift_store_key' => $swift_store_key, + 'swift_store_auth_address' => $swift_store_auth_address, + 'swift_store_container' => $swift_store_container, + 'swift_store_create_container_on_put' => $swift_store_create_container_on_put + }, + order => '05', + # this just needs to configure a section + # in glance-api.conf + } + +} diff --git a/manifests/notify.pp b/manifests/notify.pp new file mode 100644 index 00000000..5554de97 --- /dev/null +++ b/manifests/notify.pp @@ -0,0 +1,15 @@ +# +# used to model the line in the file +# that configures which storage backend +# to use +# +class glance::notify( + $notifier_strategy +) { + glance::api::config { 'notify': + config => { + 'notifier_strategy' => $notifier_strategy, + }, + order => '06', + } +} diff --git a/manifests/notify/qpid.pp b/manifests/notify/qpid.pp new file mode 100644 index 00000000..87d3f18a --- /dev/null +++ b/manifests/notify/qpid.pp @@ -0,0 +1,16 @@ +# +# used to configure qpid notifications for glance +# +class glance::notify::qpid( +) inherits glance::api { + + class { 'glance::notify': + notifier_strategy => 'qpid', + } + + glance::api::config { 'qpid': + config => { + }, + order => '07', + } +} diff --git a/manifests/notify/rabbitmq.pp b/manifests/notify/rabbitmq.pp new file mode 100644 index 00000000..817a7f9b --- /dev/null +++ b/manifests/notify/rabbitmq.pp @@ -0,0 +1,17 @@ +# +# used to configure qpid notifications for glance +# +class glance::notify::rabbitmq( + # TODO be able to pass in rabbitmq params +) inherits glance::api { + + class { 'glance::notify': + notifier_strategy => 'rabbit', + } + + glance::api::config { 'rabbitmq': + config => { + }, + order => '07', + } +} diff --git a/templates/api/backend.erb b/templates/api/backend.erb new file mode 100644 index 00000000..16ea21b2 --- /dev/null +++ b/templates/api/backend.erb @@ -0,0 +1,5 @@ +# Which backend store should Glance use by default is not specified +# in a request to add a new image to Glance? Default: 'file' +# Available choices are 'file', 'swift', and 's3' +# ================= Storage Backend ============================ +default_store = <%= config['default_store'] %> diff --git a/templates/api/file.erb b/templates/api/file.erb new file mode 100644 index 00000000..801776b9 --- /dev/null +++ b/templates/api/file.erb @@ -0,0 +1,5 @@ +# ============ Filesystem Store Options ======================== + +# Directory that the Filesystem backend store +# writes image data to +filesystem_store_datadir = <%= config['filesystem_store_datadir'] %> diff --git a/templates/api/footer.erb b/templates/api/footer.erb new file mode 100644 index 00000000..9878fad6 --- /dev/null +++ b/templates/api/footer.erb @@ -0,0 +1,21 @@ +# ============ Delayed Delete Options ============================= + +# Turn on/off delayed delete +delayed_delete = False + +# Delayed delete time in seconds +scrub_time = 43200 + +# Directory that the scrubber will use to remind itself of what to delete +# Make sure this is also set in glance-scrubber.conf +scrubber_datadir = /var/lib/glance/scrubber + +# =============== Image Cache Options ============================= + +# Base directory that the Image Cache uses +image_cache_dir = /var/lib/glance/image-cache/ + +<% if config['auth_type'] == 'keystone' -%> +[paste_deploy] +flavor = keystone +<% end -%> diff --git a/templates/api/header.erb b/templates/api/header.erb new file mode 100644 index 00000000..44d1c808 --- /dev/null +++ b/templates/api/header.erb @@ -0,0 +1,82 @@ +[DEFAULT] +# Show more verbose log output (sets INFO log level output) +verbose = <%= config['log_verbose'] %> + +# Show debugging output in logs (sets DEBUG log level output) +debug = <%= config['log_debug'] %> + +# Address to bind the API server +bind_host = <%= config['bind_host'] %> + +# Port the bind the API server to +bind_port = <%= config['bind_port'] %> + + +# Log to this file. Make sure you do not set the same log +# file for both the API and registry servers! +log_file = <%= config['log_file'] %> + +# Backlog requests when creating socket +backlog = <%= config['backlog'] %> +# Backlog requests when creating socket + +# Number of Glance API worker processes to start. +# On machines with more than one CPU increasing this value +# may improve performance (especially if using SSL with +# compression turned on). It is typically recommended to set +# this value to the number of CPUs present on your machine. +workers = <%= config['workers'] %> + +# Role used to identify an authenticated user as administrator +#admin_role = admin + +# ================= Syslog Options ============================ + +# Send logs to syslog (/dev/log) instead of to file specified +# by `log_file` +use_syslog = False + +# Facility to use. If unset defaults to LOG_USER. +# syslog_log_facility = LOG_LOCAL0 + +# ================= SSL Options =============================== + +# Certificate file to use when starting API server securely +# cert_file = /path/to/certfile + +# Private key file to use when starting API server securely +# key_file = /path/to/keyfile + +# ================= Security Options ========================== + +# AES key for encrypting store 'location' metadata, including +# -- if used -- Swift or S3 credentials +# Should be set to a random string of length 16, 24 or 32 bytes +# metadata_encryption_key = <16, 24 or 32 char registry metadata key> + +# ============ Registry Options =============================== + +# Address to find the registry server +registry_host = <%= config['registry_host'] %> + +# Port the registry server is listening on +registry_port = <%= config['registry_port'] %> + +# What protocol to use when connecting to the registry server? +# Set to https for secure HTTP communication +registry_client_protocol = http + +# The path to the key file to use in SSL connections to the +# registry server, if any. Alternately, you may set the +# GLANCE_CLIENT_KEY_FILE environ variable to a filepath of the key file +# registry_client_key_file = /path/to/key/file + +# The path to the cert file to use in SSL connections to the +# registry server, if any. Alternately, you may set the +# GLANCE_CLIENT_CERT_FILE environ variable to a filepath of the cert file +# registry_client_cert_file = /path/to/cert/file + +# The path to the certifying authority cert file to use in SSL connections +# to the registry server, if any. Alternately, you may set the +# GLANCE_CLIENT_CA_FILE environ variable to a filepath of the CA cert file +# registry_client_ca_file = /path/to/ca/file diff --git a/templates/api/notify.erb b/templates/api/notify.erb new file mode 100644 index 00000000..c62b7190 --- /dev/null +++ b/templates/api/notify.erb @@ -0,0 +1,7 @@ +# ============ Notification System Options ===================== + +# Notifications can be sent when images are create, updated or deleted. +# There are three methods of sending notifications, logging (via the +# log_file directive), rabbit (via a rabbitmq queue), qpid (via a Qpid +# message queue), or noop (no notifications sent, the default) +notifier_strategy = <%= config['notifier_strategy'] %> diff --git a/templates/api/qpid.erb b/templates/api/qpid.erb new file mode 100644 index 00000000..dd7f8ff1 --- /dev/null +++ b/templates/api/qpid.erb @@ -0,0 +1,18 @@ +# Configuration options if sending notifications via Qpid (these are +# the defaults) +#qpid_notification_exchange = glance +#qpid_notification_topic = glance_notifications +#qpid_host = localhost +#qpid_port = 5672 +#qpid_username = +#qpid_password = +#qpid_sasl_mechanisms = +#qpid_reconnect_timeout = 0 +#qpid_reconnect_limit = 0 +#qpid_reconnect_interval_min = 0 +#qpid_reconnect_interval_max = 0 +#qpid_reconnect_interval = 0 +#qpid_heartbeat = 5 +# Set to 'ssl' to enable SSL +#qpid_protocol = tcp +#qpid_tcp_nodelay = True diff --git a/templates/api/rabbitmq.erb b/templates/api/rabbitmq.erb new file mode 100644 index 00000000..f48d9377 --- /dev/null +++ b/templates/api/rabbitmq.erb @@ -0,0 +1,10 @@ +# Configuration options if sending notifications via rabbitmq (these are +# the defaults) +#rabbit_host = localhost +#rabbit_port = 5672 +#rabbit_use_ssl = false +#rabbit_userid = guest +#rabbit_password = guest +#rabbit_virtual_host = / +#rabbit_notification_exchange = glance +#rabbit_notification_topic = glance_notifications diff --git a/templates/api/swift.erb b/templates/api/swift.erb new file mode 100644 index 00000000..94696491 --- /dev/null +++ b/templates/api/swift.erb @@ -0,0 +1,38 @@ +# ============ Swift Store Options ============================= + +# Address where the Swift authentication service lives +swift_store_auth_address = <%= config['swift_store_auth_address'] %> + +# User to authenticate against the Swift authentication service +swift_store_user = <%= config['swift_store_user'] %> + +# Auth key for the user authenticating against the +# Swift authentication service +swift_store_key = <%= config['swift_store_key'] %> + +# Container within the account that the account should use +# for storing images in Swift +swift_store_container = <%= config['swift_store_container'] %> + +# Do we create the container if it does not exist? +swift_store_create_container_on_put = <%= config['swift_store_create_container_on_put'] %> + + +# What size, in MB, should Glance start chunking image files +# and do a large object manifest in Swift? By default, this is +# the maximum object size in Swift, which is 5GB +swift_store_large_object_size = 5120 + +# When doing a large object manifest, what size, in MB, should +# Glance write chunks to Swift? This amount of data is written +# to a temporary disk buffer during the process of chunking +# the image file, and the default is 200MB +swift_store_large_object_chunk_size = 200 + +# Whether to use ServiceNET to communicate with the Swift storage servers. +# (If you aren't RACKSPACE, leave this False!) +# +# To use ServiceNET for authentication, prefix hostname of +# `swift_store_auth_address` with 'snet-'. +# Ex. https://example.com/v1.0/ -> https://snet-example.com/v1.0/ +swift_enable_snet = False