File: service_instance.pp

package info (click to toggle)
puppet-module-manila 25.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,804 kB
  • sloc: ruby: 4,767; python: 38; makefile: 10; sh: 10
file content (132 lines) | stat: -rw-r--r-- 5,155 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# ==define manila::backend::service_instance
#
# ===Parameters
#
# [*service_instance_user*]
#   (required) User in service instance.
#
# [*service_instance_password*]
#   (required) Password to service instance user.
#
# [*create_service_image*]
#   (optional) Upload the service image to glance.
#   Defaults to: true
#
# [*service_image_name*]
#   (optional) Name of image in glance, that will be used to create
#    service instance.
#   Defaults to: 'manila-service-image'
#
# [*service_image_location*]
#   (optional) URL or pathname to the service image. This will be
#   loaded into Glance. This is required when create_service_image is true.
#
# [*service_instance_name_template*]
#   (optional) Name of service instance.
#   Defaults to: 'manila_service_instance_%s'
#
# [*manila_service_keypair_name*]
#   (optional) Name of keypair that will be created and used
#    for service instance.
#   Defaults to: 'manila-service'
#
# [*path_to_public_key*]
#   (optional) Path to hosts public key.
#   Defaults to: '~/.ssh/id_rsa.pub'
#
# [*path_to_private_key*]
#   (optional) Path to hosts private key.
#   Defaults to: '~/.ssh/id_rsa'
#
# [*max_time_to_build_instance*]
#   (optional) Maximum time to wait for creating service instance.
#   Defaults to: 300
#
# [*service_instance_security_group*]
#   (optional) Name of security group, that will be used for
#    service instance creation.
#   Defaults to: 'manila-service'
#
# [*service_instance_flavor_id*]
#   (optional) ID of flavor, that will be used for service instance
#    creation.
#   Defaults to: 1
#
# [*service_network_name*]
#   (optional) Name of manila service network.
#   Defaults to: 'manila_service_network'
#
# [*service_network_cidr*]
#   (optional) CIDR of manila service network.
#   Defaults to: '10.254.0.0/16'
#
# [*service_network_division_mask*]
#   (optional) This mask is used for dividing service network into
#    subnets, IP capacity of subnet with this mask directly
#    defines possible amount of created service VMs
#    per tenant's subnet.
#   Defaults to: 28
#
# [*interface_driver*]
#   (optional) Vif driver.
#   Defaults to: 'manila.network.linux.interface.OVSInterfaceDriver'
#
# [*connect_share_server_to_tenant_network*]
#   (optional) Attach share server directly to share network.
#   Defaults to: false
#
define manila::backend::service_instance (
  $service_instance_user,
  $service_instance_password,
  Boolean $create_service_image           = true,
  $service_image_name                     = 'manila-service-image',
  $service_image_location                 = undef,
  $service_instance_name_template         = 'manila_service_instance_%s',
  $manila_service_keypair_name            = 'manila-service',
  $path_to_public_key                     = '~/.ssh/id_rsa.pub',
  $path_to_private_key                    = '~/.ssh/id_rsa',
  $max_time_to_build_instance             = 300,
  $service_instance_security_group        = 'manila-service',
  $service_instance_flavor_id             = 1,
  $service_network_name                   = 'manila_service_network',
  $service_network_cidr                   = '10.254.0.0/16',
  $service_network_division_mask          = 28,
  $interface_driver                       = 'manila.network.linux.interface.OVSInterfaceDriver',
  $connect_share_server_to_tenant_network = false,
) {

  include manila::deps

  if $create_service_image {
    if $service_image_location {
      glance_image { $service_image_name:
        ensure           => present,
        is_public        => 'yes',
        container_format => 'bare',
        disk_format      => 'qcow2',
        source           => $service_image_location,
      }
    }
    else {
      fail('Missing required parameter service_image_location')
    }
  }

  manila_config {
    "${name}/service_image_name":                     value => $service_image_name;
    "${name}/service_instance_name_template":         value => $service_instance_name_template;
    "${name}/service_instance_user":                  value => $service_instance_user;
    "${name}/service_instance_password":              value => $service_instance_password, secret => true;
    "${name}/manila_service_keypair_name":            value => $manila_service_keypair_name;
    "${name}/path_to_public_key":                     value => $path_to_public_key;
    "${name}/path_to_private_key":                    value => $path_to_private_key;
    "${name}/max_time_to_build_instance":             value => $max_time_to_build_instance;
    "${name}/service_instance_security_group":        value => $service_instance_security_group;
    "${name}/service_instance_flavor_id":             value => $service_instance_flavor_id;
    "${name}/service_network_name":                   value => $service_network_name;
    "${name}/service_network_cidr":                   value => $service_network_cidr;
    "${name}/service_network_division_mask":          value => $service_network_division_mask;
    "${name}/interface_driver":                       value => $interface_driver;
    "${name}/connect_share_server_to_tenant_network": value => $connect_share_server_to_tenant_network;
  }
}