diff --git a/manifests/api.pp b/manifests/api.pp new file mode 100644 index 00000000..3b3fa936 --- /dev/null +++ b/manifests/api.pp @@ -0,0 +1,32 @@ +class glance::api( + $verbose = 'false', + $default_store = 'file', + $bind_host = '0.0.0.0', + $bind_port = '9292', + $registry_host = '0.0.0.0', + $registry_port = '9191', + $log_file = '/var/log/glance/api.log', + $filesystem_store_datadir = '/var/lib/glance/images/', + $swift_store_auth_address = '127.0.0.1:8080/v1.0/', + $swift_store_user = 'jdoe', + $swift_store_key = 'a86850deb2742ec3cb41518e26aa2d89', + $swift_store_container = 'glance', + $swift_store_create_container_on_put = 'False' +) inherits glance { + + file { "/etc/glance/glance-api.conf": + ensure => present, + owner => 'glance', + group => 'root', + mode => 640, + content => template('glance/glance-api.conf.erb'), + require => Class["glance"] + } + + service { "glance-api": + ensure => running, + enable => true, + subscribe => File["/etc/glance/glance-api.conf"], + require => Class["glance"] + } +} diff --git a/manifests/init.pp b/manifests/init.pp new file mode 100644 index 00000000..d9d56958 --- /dev/null +++ b/manifests/init.pp @@ -0,0 +1,10 @@ +class glance { + file { '/etc/glance/': + ensure => directory, + owner => 'glance', + group => 'root', + mode => 770, + require => Package['glance'] + } + package { 'glance': ensure => present } +} diff --git a/manifests/registry.pp b/manifests/registry.pp new file mode 100644 index 00000000..0e726fa7 --- /dev/null +++ b/manifests/registry.pp @@ -0,0 +1,25 @@ +class glance::registry( + $verbose = 'true', + $debug = 'true', + $bind_host = '0.0.0.0', + $bind_port = '9191', + $log_file = '/var/log/glance/registry.log', + $sql_connection = 'sqlite://var/lib/glance/glance.sqlite', + $sql_idle_timeout = '3600' +) inherits glance { + file { "/etc/glance/glance-registry.conf": + ensure => present, + owner => 'glance', + group => 'root', + mode => 640, + content => template('glance/glance-registry.conf.erb'), + require => Class["glance"] + } + service { "glance-registry": + ensure => running, + enable => true, + subscribe => File["/etc/glance/glance-registry.conf"], + require => Class["glance"] + } + +} diff --git a/templates/glance-api.conf-sample b/templates/glance-api.conf-sample new file mode 100644 index 00000000..4551b102 --- /dev/null +++ b/templates/glance-api.conf-sample @@ -0,0 +1,67 @@ +[DEFAULT] +# Show more verbose log output (sets INFO log level output) +verbose = True + +# Show debugging output in logs (sets DEBUG log level output) +debug = False + +# 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' +default_store = file + +# Address to bind the API server +bind_host = 0.0.0.0 + +# Port the bind the API server to +bind_port = 9292 + +# Address to find the registry server +registry_host = 0.0.0.0 + +# Port the registry server is listening on +registry_port = 9191 + +# Log to this file. Make sure you do not set the same log +# file for both the API and registry servers! +log_file = /var/log/glance/api.log + +# ============ Filesystem Store Options ======================== + +# Directory that the Filesystem backend store +# writes image data to +filesystem_store_datadir = /var/lib/glance/images/ + +# ============ Swift Store Options ============================= + +# Address where the Swift authentication service lives +swift_store_auth_address = 127.0.0.1:8080/v1.0/ + +# User to authenticate against the Swift authentication service +swift_store_user = jdoe + +# Auth key for the user authenticating against the +# Swift authentication service +swift_store_key = a86850deb2742ec3cb41518e26aa2d89 + +# Container within the account that the account should use +# for storing images in Swift +swift_store_container = glance + +# Do we create the container if it does not exist? +swift_store_create_container_on_put = False + +[pipeline:glance-api] +pipeline = versionnegotiation apiv1app + +[pipeline:versions] +pipeline = versionsapp + +[app:versionsapp] +paste.app_factory = glance.api.versions:app_factory + +[app:apiv1app] +paste.app_factory = glance.api.v1:app_factory + +[filter:versionnegotiation] +paste.filter_factory = glance.api.middleware.version_negotiation:filter_factory diff --git a/templates/glance-api.conf.erb b/templates/glance-api.conf.erb new file mode 100644 index 00000000..b9fbc7c5 --- /dev/null +++ b/templates/glance-api.conf.erb @@ -0,0 +1,67 @@ +[DEFAULT] +# Show more verbose log output (sets INFO log level output) +verbose = <%= verbose %> + +# Show debugging output in logs (sets DEBUG log level output) +debug = False + +# 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' +default_store = <%= default_store %> + +# Address to bind the API server +bind_host = <%= bind_host %> + +# Port the bind the API server to +bind_port = <%= bind_port %> + +# Address to find the registry server +registry_host = <%= registry_host %> + +# Port the registry server is listening on +registry_port = <%= registry_port %> + +# Log to this file. Make sure you do not set the same log +# file for both the API and registry servers! +log_file = <%= log_file %> + +# ============ Filesystem Store Options ======================== + +# Directory that the Filesystem backend store +# writes image data to +filesystem_store_datadir = <%= filesystem_store_datadir %> + +# ============ Swift Store Options ============================= + +# Address where the Swift authentication service lives +swift_store_auth_address = <%= swift_store_auth_address %> + +# User to authenticate against the Swift authentication service +swift_store_user = <%= swift_store_user %> + +# Auth key for the user authenticating against the +# Swift authentication service +swift_store_key = <%= swift_store_key %> + +# Container within the account that the account should use +# for storing images in Swift +swift_store_container = <%= swift_store_container %> + +# Do we create the container if it does not exist? +swift_store_create_container_on_put = <%= swift_store_create_container_on_put %> + +[pipeline:glance-api] +pipeline = versionnegotiation apiv1app + +[pipeline:versions] +pipeline = versionsapp + +[app:versionsapp] +paste.app_factory = glance.api.versions:app_factory + +[app:apiv1app] +paste.app_factory = glance.api.v1:app_factory + +[filter:versionnegotiation] +paste.filter_factory = glance.api.middleware.version_negotiation:filter_factory diff --git a/templates/glance-registry.conf-sample b/templates/glance-registry.conf-sample new file mode 100644 index 00000000..2e1f3362 --- /dev/null +++ b/templates/glance-registry.conf-sample @@ -0,0 +1,33 @@ +[DEFAULT] +# Show more verbose log output (sets INFO log level output) +verbose = True + +# Show debugging output in logs (sets DEBUG log level output) +debug = False + +# Address to bind the registry server +bind_host = 0.0.0.0 + +# Port the bind the registry server to +bind_port = 9191 + +# Log to this file. Make sure you do not set the same log +# file for both the API and registry servers! +log_file = /var/log/glance/registry.log + +# SQLAlchemy connection string for the reference implementation +# registry server. Any valid SQLAlchemy connection string is fine. +# See: http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/connections.html#sqlalchemy.create_engine +sql_connection = sqlite:///glance.sqlite + +# Period in seconds after which SQLAlchemy should reestablish its connection +# to the database. +# +# MySQL uses a default `wait_timeout` of 8 hours, after which it will drop +# idle connections. This can result in 'MySQL Gone Away' exceptions. If you +# notice this, you can lower this value to ensure that SQLAlchemy reconnects +# before MySQL can drop the connection. +sql_idle_timeout = 3600 + +[app:glance-registry] +paste.app_factory = glance.registry.server:app_factory diff --git a/templates/glance-registry.conf.erb b/templates/glance-registry.conf.erb new file mode 100644 index 00000000..c0b8b2a1 --- /dev/null +++ b/templates/glance-registry.conf.erb @@ -0,0 +1,33 @@ +[DEFAULT] +# Show more verbose log output (sets INFO log level output) +verbose = <%= verbose %> + +# Show debugging output in logs (sets DEBUG log level output) +debug = False + +# Address to bind the registry server +bind_host = 0.0.0.0 + +# Port the bind the registry server to +bind_port = <%= 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 = /var/log/glance/registry.log + +# SQLAlchemy connection string for the reference implementation +# registry server. Any valid SQLAlchemy connection string is fine. +# See: http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/connections.html#sqlalchemy.create_engine +sql_connection = sqlite:///glance.sqlite + +# Period in seconds after which SQLAlchemy should reestablish its connection +# to the database. +# +# MySQL uses a default `wait_timeout` of 8 hours, after which it will drop +# idle connections. This can result in 'MySQL Gone Away' exceptions. If you +# notice this, you can lower this value to ensure that SQLAlchemy reconnects +# before MySQL can drop the connection. +sql_idle_timeout = <%= sql_idle_timeout %> + +[app:glance-registry] +paste.app_factory = glance.registry.server:app_factory diff --git a/tests/api.pp b/tests/api.pp new file mode 100644 index 00000000..b7f05dba --- /dev/null +++ b/tests/api.pp @@ -0,0 +1 @@ +class { 'glance::api': } diff --git a/tests/init.pp b/tests/init.pp new file mode 100644 index 00000000..57cf401a --- /dev/null +++ b/tests/init.pp @@ -0,0 +1 @@ +class { 'glance': } diff --git a/tests/registry.pp b/tests/registry.pp new file mode 100644 index 00000000..55987674 --- /dev/null +++ b/tests/registry.pp @@ -0,0 +1 @@ +class { 'glance::registry': }