File: api.pp

package info (click to toggle)
puppet-module-murano 23.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 928 kB
  • sloc: ruby: 2,856; python: 38; sh: 10; makefile: 10
file content (70 lines) | stat: -rw-r--r-- 1,668 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
# == Class: murano::api
#
#  murano api package & service
#
# === Parameters
#
# [*manage_service*]
#  (Optional) Should the service be enabled
#  Defaults to true
#
# [*enabled*]
#  (Optional) Whether the service should be managed by Puppet
#  Defaults to true
#
# [*package_ensure*]
#  (Optional) Ensure state for package
#  Defaults to 'present'
#
# [*host*]
#  (Optional) Host on which murano api should listen
#  Defaults to $facts['os_service_default'].
#
# [*port*]
#  (Optional) Port on which murano api should listen
#  Defaults to $facts['os_service_default'].
#
# [*workers*]
#  (optional) number of workers for Murano Api
#  defaults to $facts['os_workers']
#
class murano::api(
  Boolean $manage_service = true,
  Boolean $enabled        = true,
  $package_ensure         = 'present',
  $host                   = $facts['os_service_default'],
  $port                   = $facts['os_service_default'],
  $workers                = $facts['os_workers'],
) {

  include murano::deps
  include murano::params
  include murano::policy

  if $manage_service {
    if $enabled {
      $service_ensure = 'running'
    } else {
      $service_ensure = 'stopped'
    }

    service { 'murano-api':
      ensure => $service_ensure,
      name   => $::murano::params::api_service_name,
      enable => $enabled,
      tag    => 'murano-service',
    }
  }

  murano_config {
    'DEFAULT/bind_host': value => $host;
    'DEFAULT/bind_port': value => $port;
    'murano/api_workers': value => $workers;
  }

  package { 'murano-api':
    ensure => $package_ensure,
    name   => $::murano::params::api_package_name,
    tag    => ['openstack', 'murano-package'],
  }
}