Smooth out hiera values
- get hiera data just once - pass functions params instead of get them inline Change-Id: If94783b6dcf878109d2f90da99fcdcbabb8d26fe
This commit is contained in:
parent
a88d8a1378
commit
65f80ef389
|
@ -1,3 +1,2 @@
|
|||
notice('MODULAR: hiera-override')
|
||||
include opendaylight
|
||||
class { '::opendaylight::hiera_override': }
|
||||
|
|
|
@ -2,9 +2,8 @@ notice('MODULAR: odl-common_config.pp')
|
|||
|
||||
include opendaylight
|
||||
$use_neutron = hiera('use_neutron', false)
|
||||
$odl = hiera('opendaylight')
|
||||
$odl = $opendaylight::odl_settings
|
||||
$management_vip = hiera('management_vip')
|
||||
$odl_settings = hiera('opendaylight')
|
||||
$ovsdb_managers = odl_ovsdb_managers($opendaylight::odl_mgmt_ips)
|
||||
|
||||
if $use_neutron {
|
||||
|
@ -13,7 +12,7 @@ if $use_neutron {
|
|||
ensure => installed,
|
||||
}
|
||||
|
||||
unless $odl_settings['enable_bgpvpn'] {
|
||||
unless $odl['enable_bgpvpn'] {
|
||||
exec { 'ovs-set-manager':
|
||||
command => "ovs-vsctl set-manager $ovsdb_managers",
|
||||
path => '/usr/bin'
|
||||
|
@ -110,7 +109,7 @@ if $use_neutron {
|
|||
|
||||
# With bgpvpn feature enabled the connectivity to the outside world
|
||||
# is solved in another way.
|
||||
unless $odl_settings['enable_bgpvpn'] {
|
||||
unless $odl['enable_bgpvpn'] {
|
||||
if $ext_interface {
|
||||
exec { 'ovs-set-provider-mapping':
|
||||
command => "ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) other_config:provider_mappings=br-ex:${ext_interface}",
|
||||
|
@ -126,7 +125,7 @@ if $use_neutron {
|
|||
}
|
||||
|
||||
# Setup the trunk end points. when the sdnvpn feature is activated this is needed.
|
||||
if $odl_settings['enable_bgpvpn'] {
|
||||
if $odl['enable_bgpvpn'] {
|
||||
$file_setupTEPs = '/tmp/setup_TEPs.py'
|
||||
file { $file_setupTEPs:
|
||||
ensure => file,
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
notice('MODULAR: odl-dashboard.pp')
|
||||
|
||||
include opendaylight
|
||||
|
||||
$cluster_id = hiera('deployment_id')
|
||||
$master_ip = hiera('master_ip')
|
||||
$network_metadata = hiera_hash('network_metadata', {})
|
||||
$os_public_vip = $network_metadata['vips']['public']['ipaddr']
|
||||
$odl = hiera('opendaylight')
|
||||
$port = $odl['metadata']['jetty_port']
|
||||
$odl = $opendaylight::odl_settings
|
||||
$port = $opendaylight::jetty_port
|
||||
$user = $odl['metadata']['default_credentials']['user']
|
||||
$password = $odl['metadata']['default_credentials']['password']
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module Puppet::Parser::Functions
|
||||
newfunction(:odl_karaf_features, :type => :rvalue) do |args|
|
||||
odl_settings = function_hiera(['opendaylight'])
|
||||
newfunction(:odl_karaf_features, :arity => 1, :type => :rvalue) do |args|
|
||||
odl_settings = args[0]
|
||||
features_set = odl_settings['metadata']['odl_features']
|
||||
|
||||
enabled_features = []
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
module Puppet::Parser::Functions
|
||||
newfunction(:odl_ovsdb_managers, :type => :rvalue) do |args|
|
||||
raise Puppet::ParseError, 'Only one argument with array of IP addresses should be provided!' if args.size != 1
|
||||
raise Puppet::ParseError, 'Argument should be array of IP addresses' unless args[0].is_a? Array
|
||||
ips = args[0]
|
||||
managers = []
|
||||
ips.each do |manager|
|
||||
managers << "tcp:#{manager}:6640"
|
||||
end
|
||||
managers.join(' ')
|
||||
newfunction(:odl_ovsdb_managers, :arity => 1, :type => :rvalue) do |args|
|
||||
|
||||
managers = args.flat_map { |ip| "tcp:#{ip}:6640" }
|
||||
managers.join(' ')
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,11 +15,12 @@
|
|||
#
|
||||
class opendaylight::ha::haproxy {
|
||||
|
||||
include opendaylight
|
||||
|
||||
$public_vip = hiera('public_vip')
|
||||
$management_vip = hiera('management_vip')
|
||||
$odl = hiera('opendaylight')
|
||||
$api_port = $odl['rest_api_port']
|
||||
$jetty_port = $odl['metadata']['jetty_port']
|
||||
$api_port = $opendaylight::rest_api_port
|
||||
$jetty_port = $opendaylight::jetty_port
|
||||
|
||||
# defaults for any haproxy_service within this class
|
||||
Openstack::Ha::Haproxy_service {
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
class opendaylight::install (
|
||||
$rest_port = $opendaylight::rest_api_port,
|
||||
$bind_address = undef,
|
||||
) {
|
||||
) inherits opendaylight {
|
||||
|
||||
$management_vip = hiera('management_vip')
|
||||
$odl = hiera('opendaylight')
|
||||
$conf_dir = '/opt/opendaylight/etc'
|
||||
$jetty_port = $opendaylight::jetty_port
|
||||
|
||||
if $odl['enable_l3_odl'] {
|
||||
$manage_l3_traffic = 'yes'
|
||||
} else {
|
||||
$manage_l3_traffic = 'no'
|
||||
$manage_l3_traffic = $opendaylight::odl_settings['enable_l3_odl'] ? {
|
||||
true => 'yes',
|
||||
default => 'no',
|
||||
}
|
||||
|
||||
package { 'opendaylight':
|
||||
|
@ -57,7 +55,7 @@ class opendaylight::install (
|
|||
|
||||
create_ini_settings($karaf_custom_properties, $karaf_custom_properties_file)
|
||||
|
||||
$enabled_features = odl_karaf_features()
|
||||
$enabled_features = odl_karaf_features($opendaylight::odl_settings)
|
||||
|
||||
ini_setting {'karaf_features':
|
||||
ensure => present,
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
class opendaylight::service {
|
||||
include opendaylight
|
||||
include opendaylight::ha::haproxy
|
||||
|
||||
$management_vip = hiera('management_vip')
|
||||
$odl = hiera('opendaylight')
|
||||
$odl = $opendaylight::odl_settings
|
||||
$user = $odl['metadata']['default_credentials']['user']
|
||||
$password = $odl['metadata']['default_credentials']['password']
|
||||
|
||||
$rest_port = $odl['rest_api_port']
|
||||
$rest_port = $opendaylight::rest_api_port
|
||||
|
||||
if $odl['enable_bgpvpn'] {
|
||||
$odl_up_testing_site = "ovsdb:1"
|
||||
|
@ -15,7 +15,10 @@ class opendaylight::service {
|
|||
}
|
||||
if roles_include(['primary-controller']) {
|
||||
exec { 'wait-until-odl-ready':
|
||||
command => "curl -o /dev/null --fail --silent --head -u ${user}:${password} http://${management_vip}:${rest_port}/restconf/operational/network-topology:network-topology/topology/${odl_up_testing_site}",
|
||||
command => join([
|
||||
"curl -o /dev/null --fail --silent --head -u ${user}:${password}",
|
||||
"http://${management_vip}:${rest_port}/restconf/operational/network-topology:network-topology/topology/${odl_up_testing_site}"
|
||||
], ' '),
|
||||
path => '/bin:/usr/bin',
|
||||
tries => 60,
|
||||
try_sleep => 20,
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
class opendaylight::sfc {
|
||||
include opendaylight
|
||||
|
||||
$management_vip = hiera('management_vip')
|
||||
$odl = hiera('opendaylight')
|
||||
$rest_port = $odl['rest_api_port']
|
||||
$odl = $opendaylight::odl_settings
|
||||
$rest_port = $opendaylight::rest_api_port
|
||||
$user = $odl['metadata']['default_credentials']['user']
|
||||
$password = $odl['metadata']['default_credentials']['password']
|
||||
|
||||
|
|
Loading…
Reference in New Issue