| 1 |
# == Class: etcddiscovery |
| 2 |
# |
| 3 |
# Cinder base package & configuration |
| 4 |
# |
| 5 |
# === Parameters |
| 6 |
# |
| 7 |
# [*package_ensure*] |
| 8 |
# (Optional) Ensure state for package. |
| 9 |
# Defaults to 'present' |
| 10 |
# |
| 11 |
# [*prefix_url*] |
| 12 |
# (Optional) Prefix URL. |
| 13 |
# Defaults to 'http://example.com' |
| 14 |
# |
| 15 |
# [*web_service_address*] |
| 16 |
# (Optional) Address where to bind. |
| 17 |
# :8087 works, as well as IP:8087 |
| 18 |
# Defaults to ':8087' |
| 19 |
# |
| 20 |
# [*endpoint_location*] |
| 21 |
# (Optional) Where is located your ETCD cluster? |
| 22 |
# Default to: 'http://127.0.0.1:2379' |
| 23 |
# |
| 24 |
# [*enabled*] |
| 25 |
# (optional) The state of the service (boolean value) |
| 26 |
# Defaults to true |
| 27 |
# |
| 28 |
# [*manage_service*] |
| 29 |
# (optional) Whether to start/stop the service (boolean value) |
| 30 |
# Defaults to true |
| 31 |
# |
| 32 |
class etcddiscovery ( |
| 33 |
$package_ensure = 'present', |
| 34 |
$package_name = 'etcd-discovery', |
| 35 |
$prefix_url = 'http://example.com', |
| 36 |
$web_service_address = ':8087', |
| 37 |
$endpoint_location = 'http://127.0.0.1:2379', |
| 38 |
$enabled = true, |
| 39 |
) inherits etcddiscovery::params{ |
| 40 |
|
| 41 |
include etcddiscovery::deps |
| 42 |
|
| 43 |
package { 'etcddiscovery': |
| 44 |
ensure => $package_ensure, |
| 45 |
name => $package_name, |
| 46 |
tag => ['openstack', 'etcddiscovery'], |
| 47 |
} |
| 48 |
|
| 49 |
etcddiscovery_config { |
| 50 |
'server/prefix_url': value => $prefix_url; |
| 51 |
'server/web_service_address': value => $web_service_address; |
| 52 |
'etcd/endpoint_location': value => $endpoint_location; |
| 53 |
} |
| 54 |
|
| 55 |
if $enabled { |
| 56 |
if $manage_service { |
| 57 |
$ensure = 'running' |
| 58 |
} |
| 59 |
} else { |
| 60 |
if $manage_service { |
| 61 |
$ensure = 'stopped' |
| 62 |
} |
| 63 |
} |
| 64 |
|
| 65 |
service { 'etcd-discovery': |
| 66 |
ensure => $ensure, |
| 67 |
name => $::etcddiscovery::params::etcddiscovery_service, |
| 68 |
enable => $enabled, |
| 69 |
hasstatus => true, |
| 70 |
tag => 'etcddiscovery-service', |
| 71 |
} |
| 72 |
} |