File: networking_baremetal.pp

package info (click to toggle)
puppet-module-neutron 25.0.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,708 kB
  • sloc: ruby: 12,680; python: 38; sh: 15; makefile: 10
file content (185 lines) | stat: -rw-r--r-- 6,440 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# == Class: neutron::agents::ml2::networking_baremetal
#
# Setups networking-baremetal Neutron agent for ML2 plugin.
#
# === Parameters
#
# [*enabled*]
#   (required) Whether or not to enable the agent.
#   Defaults to true.
#
# [*password*]
#   (required) Password for connection to ironic in admin context.
#
# [*manage_service*]
#   (optional) Whether to start/stop the service
#   Defaults to true
#
# [*package_ensure*]
#   (optional) Package ensure state.
#   Defaults to 'present'.
#
# [*cafile*]
#   (optional) PEM encoded Certificate Authority to use when verifying HTTPs
#   connections.
#   Defaults to $facts['os_service_default']
#
# [*certfile*]
#   (optional) PEM encoded client certificate cert file
#   Defaults to $facts['os_service_default']
#
# [*keyfile*]
#   (optional) PEM encoded client certificate key file
#   Defaults to $facts['os_service_default']
#
# [*insecure*]
#   (optional) Verify HTTPS connections. (boolean)
#   Defaults to $facts['os_service_default']
#
# [*auth_type*]
#   (optional) An authentication type to use with an OpenStack Identity server.
#   The value should contain auth plugin name
#   Defaults to 'password'
#
# [*auth_url*]
#   (optional) Authorization URL for connection to ironic in admin context.
#   If version independent identity plugin is used available versions will be
#   determined using auth_url
#   Defaults to 'http://127.0.0.1:5000'
#
# [*endpoint_override*]
#   (optional) The ironic endpoint URL for requests
#   Defaults to $facts['os_service_default']
#
# [*user_domain_name*]
#   (Optional) Name of domain for $username
#   Defaults to 'Default'
#
# [*username*]
#   (optional) Username for connection to ironic in admin context
#   Defaults to 'ironic'
#
# [*project_domain_name*]
#   (Optional) Domain name containing project
#   Defaults to 'Default'
#
# [*project_name*]
#   (optional) Project name to scope to
#   Defaults to 'services'
#
# [*system_scope*]
#   (Optional) Scope for system operations
#   Defaults to $facts['os_service_default']
#
# [*region_name*]
#   (optional) Name of region to use. Useful if keystone manages more than one
#   region.
#   Defaults to $facts['os_service_default']
#
# [*status_code_retry_delay*]
#   (optional) Interval between retries in case of conflict error (HTTP 409).
#   Defaults to $facts['os_service_default']
#
# [*status_code_retries*]
#   (optional) Maximum number of retries in case of conflict error (HTTP 409).
#   Defaults to $facts['os_service_default']
#
# [*valid_interfaces*]
#   (Optional) List of interfaces, in order of preference for endpoint URL.
#   Defaults to $facts['os_service_default']
#
# [*purge_config*]
#   (optional) Whether to set only the specified config options in the
#   ironic-neutron-agent config.
#   Defaults to false.
#
# [*report_interval*]
#   (optional) Set the agent report interval. By default the global report
#   interval in neutron.conf ([agent]/report_interval) is used. This parameter
#   can be used to override the reporting interval for the
#   ironic-neutron-agent.
#   Defaults to $facts['os_service_default']
#
class neutron::agents::ml2::networking_baremetal (
  $password,
  Boolean $enabled         = true,
  Boolean $manage_service  = true,
  $package_ensure          = 'present',
  $endpoint_override       = $facts['os_service_default'],
  $cafile                  = $facts['os_service_default'],
  $certfile                = $facts['os_service_default'],
  $keyfile                 = $facts['os_service_default'],
  $insecure                = $facts['os_service_default'],
  $auth_type               = 'password',
  $auth_url                = 'http://127.0.0.1:5000',
  $user_domain_name        = 'Default',
  $username                = 'ironic',
  $project_domain_name     = 'Default',
  $project_name            = 'services',
  $system_scope            = $facts['os_service_default'],
  $region_name             = $facts['os_service_default'],
  $status_code_retry_delay = $facts['os_service_default'],
  $status_code_retries     = $facts['os_service_default'],
  $valid_interfaces        = $facts['os_service_default'],
  Boolean $purge_config    = false,
  $report_interval         = $facts['os_service_default'],
) {

  include neutron::deps
  include neutron::params

  resources { 'ironic_neutron_agent_config':
    purge => $purge_config,
  }

  if is_service_default($system_scope) {
    $project_name_real = $project_name
    $project_domain_name_real = $project_domain_name
  } else {
    $project_name_real = $facts['os_service_default']
    $project_domain_name_real = $facts['os_service_default']
  }

  ironic_neutron_agent_config {
    'ironic/endpoint_override':       value => $endpoint_override;
    'ironic/cafile':                  value => $cafile;
    'ironic/certfile':                value => $certfile;
    'ironic/keyfile':                 value => $keyfile;
    'ironic/insecure':                value => $insecure;
    'ironic/auth_type':               value => $auth_type;
    'ironic/auth_url':                value => $auth_url;
    'ironic/user_domain_name':        value => $user_domain_name;
    'ironic/username':                value => $username;
    'ironic/password':                value => $password, secret => true;
    'ironic/project_domain_name':     value => $project_domain_name_real;
    'ironic/project_name':            value => $project_name_real;
    'ironic/system_scope':            value => $system_scope;
    'ironic/region_name':             value => $region_name;
    'ironic/status_code_retry_delay': value => $status_code_retry_delay;
    'ironic/status_code_retries':     value => $status_code_retries;
    'ironic/valid_interfaces':        value => join(any2array($valid_interfaces), ',');
    'agent/report_interval':          value => $report_interval;
  }

  package { 'python-ironic-neutron-agent':
    ensure => $package_ensure,
    name   => $::neutron::params::networking_baremetal_agent_package,
    tag    => ['openstack', 'neutron-package'],
  }

  if $manage_service {
    if $enabled {
      $service_ensure = 'running'
    } else {
      $service_ensure = 'stopped'
    }
    service { 'ironic-neutron-agent-service':
      ensure => $service_ensure,
      name   => $::neutron::params::networking_baremetal_agent_service,
      enable => $enabled,
      tag    => 'neutron-service',
    }
    Ironic_neutron_agent_config<||> ~> Service['ironic-neutron-agent-service']
  }

}