puppet-magnum/manifests/api.pp
Nate Potter 3d873f56c1 Initial commit of api.pp
This patch sets up the inital framework for the magnum-api.

Change-Id: Iad65be9f8487e582b713ad8b90e5d12b9664642c
Depends-on: I6b6e5dea0ba9dfd386eb61e2cea546a1a561e53a
2016-01-13 18:39:16 +00:00

121 lines
3.2 KiB
Puppet

# == Class: magnum::api
#
# Setup and configure the Magnum API endpoint
#
# === Parameters
#
# [*admin_password*]
# (Required) The password to set for the magnum user in keystone.
#
# [*package_ensure*]
# (Optional) Sets the ensure parameter for the package resource.
# Defaults to 'present'
#
# [*enabled*]
# (Optional) Define if the service should be enabled or not.
# Defaults to true
#
# [*port*]
# (Optional) The port for the Magnum API server.
# Defaults to '9511'
#
# [*host_ip*]
# (Optional) The listen IP for the Magnum API server.
# Defaults to '127.0.0.1'
#
# [*max_limit*]
# (Optional) The maximum number of items returned in a single response
# from a collection resource.
# Defaults to '1000'
#
# [*auth_uri*]
# (Optional) Complete public identity API endpoint.
# Defaults to 'http://localhost:5000/'
#
# [*identity_uri*]
# (Optional) Complete admin identity API endpoint.
# Defaults to 'http://localhost:35357/'
#
# [*auth_version*]
# (Optional) API version of the admin identity API endpoint. For example,
# use 'v3' for the keystone version 3 API.
# Defaults to false
#
# [*admin_tenant_name*]
# (Optional) The name of the tenant to create in keystone for use by Magnum services.
# Defaults to 'services'
#
# [*admin_user*]
# (Optional) The name of the user to create in keystone for use by Magnum services.
# Defaults to 'magnum'
#
class magnum::api(
$admin_password,
$package_ensure = 'present',
$enabled = true,
$port = '9511',
$host_ip = '127.0.0.1',
$max_limit = '1000',
$auth_uri = 'http://localhost:5000/',
$identity_uri = 'http://localhost:35357/',
$auth_version = false,
$admin_tenant_name = 'services',
$admin_user = 'magnum',
) {
include ::magnum::params
include ::magnum::policy
Magnum_config<||> ~> Service['magnum-api']
Class['magnum::policy'] ~> Service['magnum-api']
# Configure API conf
magnum_config {
'api/port' : value => $port;
'api/host_ip' : value => $host_ip;
'api/max_limit' : value => $max_limit;
}
# Install package
if $::magnum::params::api_package {
Package['magnum-api'] -> Class['magnum::policy']
Package['magnum-api'] -> Service['magnum-api']
package { 'magnum-api':
ensure => $package_ensure,
name => $::magnum::params::api_package,
tag => ['openstack', 'magnum-package'],
}
}
if $enabled {
$ensure = 'running'
} else {
$ensure = 'stopped'
}
# Manage service
service { 'magnum-api':
ensure => $ensure,
name => $::magnum::params::api_service,
enable => $enabled,
hasstatus => true,
tag => 'magnum-service',
}
if $auth_version {
magnum_config { 'keystone_authtoken/auth_version' : value => $auth_version; }
} else {
magnum_config { 'keystone_authtoken/auth_version' : ensure => absent; }
}
magnum_config {
'keystone_authtoken/auth_uri' : value => $auth_uri;
'keystone_authtoken/identity_uri' : value => $identity_uri;
'keystone_authtoken/admin_tenant_name' : value => $admin_tenant_name;
'keystone_authtoken/admin_user' : value => $admin_user;
'keystone_authtoken/admin_password' : value => $admin_password, secret => true;
}
}