File: coordination.pp

package info (click to toggle)
puppet-module-oslo 27.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 992 kB
  • sloc: ruby: 2,436; python: 33; sh: 10; makefile: 10
file content (73 lines) | stat: -rw-r--r-- 2,085 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# == Define: oslo::coordination
#
# Setup and configure coordination settings.
#
# === Parameters
#
# [*backend_url*]
#   (Optional) Coordination backend URL.
#   Defaults to $facts['os_service_default']
#
# [*manage_backend_package*]
#   (Optional) Whether to install the backend package.
#   Defaults to true.
#
# [*package_ensure*]
#   (Optional) ensure state for package.
#   Defaults to 'present'
#
# [*manage_config*]
#   (Optional) Whether to manage the configuration parameters.
#   Defaults to true.
#
define oslo::coordination (
  $backend_url                            = $facts['os_service_default'],
  Boolean $manage_backend_package         = true,
  Stdlib::Ensure::Package $package_ensure = present,
  Boolean $manage_config                  = true,
) {
  include oslo::params

  if $manage_backend_package and !is_service_default($backend_url) {
    case $backend_url {
      /^redis:\/\//: {
        stdlib::ensure_packages('python-redis', {
          name   => $oslo::params::python_redis_package_name,
          ensure => $package_ensure,
          tag    => ['openstack'],
        })
      }
      /^etcd3\+http[s]?:\/\//: {
        stdlib::ensure_packages('python-etcd3gw', {
          name   => $oslo::params::python_etcd3gw_package_name,
          ensure => $package_ensure,
          tag    => ['openstack'],
        })
      }
      /^memcached:\/\//: {
        stdlib::ensure_packages('python-pymemcache', {
          name   => $oslo::params::python_pymemcache_package_name,
          ensure => $package_ensure,
          tag    => ['openstack'],
        })
      }
      /^(kazoo|zookeeper):\/\//: {
        stdlib::ensure_packages('python-kazoo', {
          name   => $oslo::params::python_kazoo_package_name,
          ensure => $package_ensure,
          tag    => ['openstack'],
        })
      }
      default: {
        # Nothing to do
      }
    }
  }

  if $manage_config {
    $coordination_options = {
      'coordination/backend_url' => { value => $backend_url, secret => true },
    }
    create_resources($name, $coordination_options)
  }
}