Skip to content

Commit

Permalink
Merge "Use helper functions to compose url strings"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and openstack-gerrit committed Nov 14, 2024
2 parents 5668fad + b31ffa1 commit 91cec3e
Show file tree
Hide file tree
Showing 21 changed files with 212 additions and 155 deletions.
10 changes: 6 additions & 4 deletions packstack/puppet/modules/packstack/manifests/aodh.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
$config_aodh_coordination_backend = lookup('CONFIG_CEILOMETER_COORDINATION_BACKEND')

if $config_aodh_coordination_backend == 'redis' {
$redis_host = lookup('CONFIG_REDIS_HOST_URL')
$redis_port = lookup('CONFIG_REDIS_PORT')
$coordination_url = "redis://${redis_host}:${redis_port}"
$coordination_url = os_url({
'scheme' => 'redis',
'host' => lookup('CONFIG_REDIS_HOST_URL'),
'port' => lookup('CONFIG_REDIS_PORT'),
})
Service<| title == 'redis' |> -> Anchor['aodh::service::begin']
} else {
$coordination_url = ''
$coordination_url = undef
}

class { 'aodh::keystone::authtoken':
Expand Down
25 changes: 14 additions & 11 deletions packstack/puppet/modules/packstack/manifests/aodh/rabbitmq.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@
$kombu_ssl_keyfile = lookup('CONFIG_AODH_SSL_KEY', undef, undef, undef)
$kombu_ssl_certfile = lookup('CONFIG_AODH_SSL_CERT', undef, undef, undef)

$aodh_db_pw = lookup('CONFIG_AODH_DB_PW')
$aodh_mariadb_host = lookup('CONFIG_MARIADB_HOST_URL')

$rabbit_host = lookup('CONFIG_AMQP_HOST_URL')
$rabbit_port = lookup('CONFIG_AMQP_CLIENTS_PORT')
$rabbit_userid = lookup('CONFIG_AMQP_AUTH_USER')
$rabbit_password = lookup('CONFIG_AMQP_AUTH_PASSWORD')


if $kombu_ssl_keyfile {
$files_to_set_owner = [ $kombu_ssl_keyfile, $kombu_ssl_certfile ]
file { $files_to_set_owner:
Expand All @@ -29,12 +20,24 @@
}

class { 'aodh::db':
database_connection => "mysql+pymysql://aodh:${aodh_db_pw}@${aodh_mariadb_host}/aodh",
database_connection => os_database_connection({
'dialect' => 'mysql+pymysql',
'host' => lookup('CONFIG_MARIADB_HOST_URL'),
'username' => 'aodh',
'password' => lookup('CONFIG_AODH_DB_PW'),
'database' => 'aodh',
})
}

class { 'aodh':
rabbit_use_ssl => lookup('CONFIG_AMQP_SSL_ENABLED'),
default_transport_url => "rabbit://${rabbit_userid}:${rabbit_password}@${rabbit_host}:${rabbit_port}/",
default_transport_url => os_transport_url({
'transport' => 'rabbit',
'host' => lookup('CONFIG_AMQP_HOST_URL'),
'port' => lookup('CONFIG_AMQP_CLIENTS_PORT'),
'username' => lookup('CONFIG_AMQP_AUTH_USER'),
'password' => lookup('CONFIG_AMQP_AUTH_PASSWORD')
}),
kombu_ssl_ca_certs => $kombu_ssl_ca_certs,
kombu_ssl_keyfile => $kombu_ssl_keyfile,
kombu_ssl_certfile => $kombu_ssl_certfile,
Expand Down
10 changes: 6 additions & 4 deletions packstack/puppet/modules/packstack/manifests/ceilometer.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
$config_gnocchi_host = lookup('CONFIG_KEYSTONE_HOST_URL')

if $config_ceilometer_coordination_backend == 'redis' {
$redis_host = lookup('CONFIG_REDIS_HOST_URL')
$redis_port = lookup('CONFIG_REDIS_PORT')
$coordination_url = "redis://${redis_host}:${redis_port}"
$coordination_url = os_url({
'scheme' => 'redis',
'host' => lookup('CONFIG_REDIS_HOST_URL'),
'port' => lookup('CONFIG_REDIS_PORT'),
})
Service<| title == 'redis' |> -> Anchor['ceilometer::service::begin']
} else {
$coordination_url = ''
$coordination_url = undef
}

include ceilometer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
$kombu_ssl_keyfile = lookup('CONFIG_CEILOMETER_SSL_KEY', undef, undef, undef)
$kombu_ssl_certfile = lookup('CONFIG_CEILOMETER_SSL_CERT', undef, undef, undef)

$rabbit_host = lookup('CONFIG_AMQP_HOST_URL')
$rabbit_port = lookup('CONFIG_AMQP_CLIENTS_PORT')
$rabbit_userid = lookup('CONFIG_AMQP_AUTH_USER')
$rabbit_password = lookup('CONFIG_AMQP_AUTH_PASSWORD')

if $kombu_ssl_keyfile {
$files_to_set_owner = [ $kombu_ssl_keyfile, $kombu_ssl_certfile ]
file { $files_to_set_owner:
Expand All @@ -27,7 +22,13 @@
class { 'ceilometer':
telemetry_secret => lookup('CONFIG_CEILOMETER_SECRET'),
rabbit_use_ssl => lookup('CONFIG_AMQP_SSL_ENABLED'),
default_transport_url => "rabbit://${rabbit_userid}:${rabbit_password}@${rabbit_host}:${rabbit_port}/",
default_transport_url => os_transport_url({
'transport' => 'rabbit',
'host' => lookup('CONFIG_AMQP_HOST_URL'),
'port' => lookup('CONFIG_AMQP_CLIENTS_PORT'),
'username' => lookup('CONFIG_AMQP_AUTH_USER'),
'password' => lookup('CONFIG_AMQP_AUTH_PASSWORD')
}),
kombu_ssl_ca_certs => $kombu_ssl_ca_certs,
kombu_ssl_keyfile => $kombu_ssl_keyfile,
kombu_ssl_certfile => $kombu_ssl_certfile,
Expand Down
24 changes: 14 additions & 10 deletions packstack/puppet/modules/packstack/manifests/cinder/rabbitmq.pp
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
class packstack::cinder::rabbitmq ()
{
$cinder_rab_cfg_cinder_db_pw = lookup('CONFIG_CINDER_DB_PW')
$cinder_rab_cfg_mariadb_host = lookup('CONFIG_MARIADB_HOST_URL')

$kombu_ssl_ca_certs = lookup('CONFIG_AMQP_SSL_CACERT_FILE', undef, undef, undef)
$kombu_ssl_keyfile = lookup('CONFIG_CINDER_SSL_KEY', undef, undef, undef)
$kombu_ssl_certfile = lookup('CONFIG_CINDER_SSL_CERT', undef, undef, undef)

$rabbit_host = lookup('CONFIG_AMQP_HOST_URL')
$rabbit_port = lookup('CONFIG_AMQP_CLIENTS_PORT')
$rabbit_userid = lookup('CONFIG_AMQP_AUTH_USER')
$rabbit_password = lookup('CONFIG_AMQP_AUTH_PASSWORD')

if $kombu_ssl_keyfile {
$files_to_set_owner = [ $kombu_ssl_keyfile, $kombu_ssl_certfile ]
file { $files_to_set_owner:
Expand All @@ -28,12 +20,24 @@
}

class { 'cinder::db':
database_connection => "mysql+pymysql://cinder:${cinder_rab_cfg_cinder_db_pw}@${cinder_rab_cfg_mariadb_host}/cinder",
database_connection => os_database_connection({
'dialect' => 'mysql+pymysql',
'host' => lookup('CONFIG_MARIADB_HOST_URL'),
'username' => 'cinder',
'password' => lookup('CONFIG_CINDER_DB_PW'),
'database' => 'cinder',
})
}

class { 'cinder':
rabbit_use_ssl => lookup('CONFIG_AMQP_SSL_ENABLED'),
default_transport_url => "rabbit://${rabbit_userid}:${rabbit_password}@${rabbit_host}:${rabbit_port}/",
default_transport_url => os_transport_url({
'transport' => 'rabbit',
'host' => lookup('CONFIG_AMQP_HOST_URL'),
'port' => lookup('CONFIG_AMQP_CLIENTS_PORT'),
'username' => lookup('CONFIG_AMQP_AUTH_USER'),
'password' => lookup('CONFIG_AMQP_AUTH_PASSWORD')
}),
kombu_ssl_ca_certs => $kombu_ssl_ca_certs,
kombu_ssl_keyfile => $kombu_ssl_keyfile,
kombu_ssl_certfile => $kombu_ssl_certfile,
Expand Down
12 changes: 7 additions & 5 deletions packstack/puppet/modules/packstack/manifests/glance.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
{
create_resources(packstack::firewall, lookup('FIREWALL_GLANCE_RULES', undef, undef, {}))

$glance_ks_pw = lookup('CONFIG_GLANCE_DB_PW')
$glance_mariadb_host = lookup('CONFIG_MARIADB_HOST_URL')
$glance_cfg_ctrl_host = lookup('CONFIG_KEYSTONE_HOST_URL')

# glance option bind_host requires address without brackets
$bind_host = lookup('CONFIG_IP_VERSION') ? {
'ipv6' => '::0',
Expand All @@ -29,7 +25,13 @@
}

class { 'glance::api::db':
database_connection => "mysql+pymysql://glance:${glance_ks_pw}@${glance_mariadb_host}/glance",
database_connection => os_database_connection({
'dialect' => 'mysql+pymysql',
'host' => lookup('CONFIG_MARIADB_HOST_URL'),
'username' => 'glance',
'password' => lookup('CONFIG_GLANCE_DB_PW'),
'database' => 'glance',
})
}

class { 'glance::api':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
$kombu_ssl_keyfile = lookup('CONFIG_GLANCE_SSL_KEY', undef, undef, undef)
$kombu_ssl_certfile = lookup('CONFIG_GLANCE_SSL_CERT', undef, undef, undef)

$rabbit_host = lookup('CONFIG_AMQP_HOST_URL')
$rabbit_port = lookup('CONFIG_AMQP_CLIENTS_PORT')
$rabbit_userid = lookup('CONFIG_AMQP_AUTH_USER')
$rabbit_password = lookup('CONFIG_AMQP_AUTH_PASSWORD')

if $kombu_ssl_keyfile {
$files_to_set_owner = [ $kombu_ssl_keyfile, $kombu_ssl_certfile ]
file { $files_to_set_owner:
Expand All @@ -23,7 +18,13 @@
class { 'glance::notify::rabbitmq':
rabbit_notification_topic => 'notifications',
rabbit_use_ssl => lookup('CONFIG_AMQP_SSL_ENABLED'),
default_transport_url => "rabbit://${rabbit_userid}:${rabbit_password}@${rabbit_host}:${rabbit_port}/",
default_transport_url => os_transport_url({
'transport' => 'rabbit',
'host' => lookup('CONFIG_AMQP_HOST_URL'),
'port' => lookup('CONFIG_AMQP_CLIENTS_PORT'),
'username' => lookup('CONFIG_AMQP_AUTH_USER'),
'password' => lookup('CONFIG_AMQP_AUTH_PASSWORD')
}),
kombu_ssl_ca_certs => $kombu_ssl_ca_certs,
kombu_ssl_keyfile => $kombu_ssl_keyfile,
kombu_ssl_certfile => $kombu_ssl_certfile,
Expand Down
22 changes: 14 additions & 8 deletions packstack/puppet/modules/packstack/manifests/gnocchi.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
$config_gnocchi_coordination_backend = lookup('CONFIG_CEILOMETER_COORDINATION_BACKEND')

if $config_gnocchi_coordination_backend == 'redis' {
$redis_host = hiera('CONFIG_REDIS_HOST_URL')
$redis_port = hiera('CONFIG_REDIS_PORT')
$coordination_url = "redis://${redis_host}:${redis_port}"
$coordination_url = os_url({
'scheme' => 'redis',
'host' => lookup('CONFIG_REDIS_HOST_URL'),
'port' => lookup('CONFIG_REDIS_PORT'),
})
Service<| title == 'redis' |> -> Anchor['gnocchi::service::begin']
} else {
$coordination_url = ''
$coordination_url = uhdef
}

$gnocchi_cfg_db_pw = lookup('CONFIG_GNOCCHI_DB_PW')
$gnocchi_cfg_mariadb_host = lookup('CONFIG_MARIADB_HOST_URL')

class { 'gnocchi::wsgi::apache':
workers => lookup('CONFIG_SERVICE_WORKERS'),
ssl => false
Expand All @@ -32,7 +31,14 @@
}

class { 'gnocchi::db':
database_connection => "mysql+pymysql://gnocchi:${gnocchi_cfg_db_pw}@${gnocchi_cfg_mariadb_host}/gnocchi?charset=utf8",
database_connection => os_database_connection({
'dialect' => 'mysql+pymysql',
'host' => lookup('CONFIG_MARIADB_HOST_URL'),
'username' => 'gnocchi',
'password' => lookup('CONFIG_GNOCCHI_DB_PW'),
'database' => 'gnocchi',
'charset' => 'utf8',
})
}

class { 'gnocchi::api':
Expand Down
24 changes: 14 additions & 10 deletions packstack/puppet/modules/packstack/manifests/heat/rabbitmq.pp
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
class packstack::heat::rabbitmq ()
{
$heat_rabbitmq_cfg_heat_db_pw = lookup('CONFIG_HEAT_DB_PW')
$heat_rabbitmq_cfg_mariadb_host = lookup('CONFIG_MARIADB_HOST_URL')

$kombu_ssl_ca_certs = lookup('CONFIG_AMQP_SSL_CACERT_FILE', undef, undef, undef)
$kombu_ssl_keyfile = lookup('CONFIG_HEAT_SSL_KEY', undef, undef, undef)
$kombu_ssl_certfile = lookup('CONFIG_HEAT_SSL_CERT', undef, undef, undef)

$rabbit_host = lookup('CONFIG_AMQP_HOST_URL')
$rabbit_port = lookup('CONFIG_AMQP_CLIENTS_PORT')
$rabbit_userid = lookup('CONFIG_AMQP_AUTH_USER')
$rabbit_password = lookup('CONFIG_AMQP_AUTH_PASSWORD')

if $kombu_ssl_keyfile {
$files_to_set_owner = [ $kombu_ssl_keyfile, $kombu_ssl_certfile ]
file { $files_to_set_owner:
Expand Down Expand Up @@ -44,13 +36,25 @@
}

class { 'heat::db':
database_connection => "mysql+pymysql://heat:${heat_rabbitmq_cfg_heat_db_pw}@${heat_rabbitmq_cfg_mariadb_host}/heat",
database_connection => os_database_connection({
'dialect' => 'mysql+pymysql',
'host' => lookup('CONFIG_MARIADB_HOST_URL'),
'username' => 'heat',
'password' => lookup('CONFIG_HEAT_DB_PW'),
'database' => 'heat',
})
}

class { 'heat':
keystone_ec2_uri => lookup('CONFIG_KEYSTONE_PUBLIC_URL'),
rabbit_use_ssl => lookup('CONFIG_AMQP_SSL_ENABLED'),
default_transport_url => "rabbit://${rabbit_userid}:${rabbit_password}@${rabbit_host}:${rabbit_port}/",
default_transport_url => os_transport_url({
'transport' => 'rabbit',
'host' => lookup('CONFIG_AMQP_HOST_URL'),
'port' => lookup('CONFIG_AMQP_CLIENTS_PORT'),
'username' => lookup('CONFIG_AMQP_AUTH_USER'),
'password' => lookup('CONFIG_AMQP_AUTH_PASSWORD')
}),
kombu_ssl_ca_certs => $kombu_ssl_ca_certs,
kombu_ssl_keyfile => $kombu_ssl_keyfile,
kombu_ssl_certfile => $kombu_ssl_certfile,
Expand Down
24 changes: 14 additions & 10 deletions packstack/puppet/modules/packstack/manifests/ironic/rabbitmq.pp
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
class packstack::ironic::rabbitmq ()
{
$ironic_rabbitmq_cfg_ironic_db_pw = lookup('CONFIG_IRONIC_DB_PW')
$ironic_rabbitmq_cfg_mariadb_host = lookup('CONFIG_MARIADB_HOST_URL')

$kombu_ssl_ca_certs = lookup('CONFIG_AMQP_SSL_CACERT_FILE', undef, undef, undef)
$kombu_ssl_keyfile = lookup('CONFIG_IRONIC_SSL_KEY', undef, undef, undef)
$kombu_ssl_certfile = lookup('CONFIG_IRONIC_SSL_CERT', undef, undef, undef)

$rabbit_host = lookup('CONFIG_AMQP_HOST_URL')
$rabbit_port = lookup('CONFIG_AMQP_CLIENTS_PORT')
$rabbit_userid = lookup('CONFIG_AMQP_AUTH_USER')
$rabbit_password = lookup('CONFIG_AMQP_AUTH_PASSWORD')

if $kombu_ssl_keyfile {
$files_to_set_owner = [ $kombu_ssl_keyfile, $kombu_ssl_certfile ]
file { $files_to_set_owner:
Expand All @@ -28,12 +20,24 @@
}

class { 'ironic::db':
database_connection => "mysql+pymysql://ironic:${ironic_rabbitmq_cfg_ironic_db_pw}@${ironic_rabbitmq_cfg_mariadb_host}/ironic",
database_connection => os_database_connection({
'dialect' => 'mysql+pymysql',
'host' => lookup('CONFIG_MARIADB_HOST_URL'),
'username' => 'ironic',
'password' => lookup('CONFIG_IRONIC_DB_PW'),
'database' => 'ironic',
})
}

class { 'ironic':
rabbit_use_ssl => lookup('CONFIG_AMQP_SSL_ENABLED'),
default_transport_url => "rabbit://${rabbit_userid}:${rabbit_password}@${rabbit_host}:${rabbit_port}/",
default_transport_url => os_transport_url({
'transport' => 'rabbit',
'host' => lookup('CONFIG_AMQP_HOST_URL'),
'port' => lookup('CONFIG_AMQP_CLIENTS_PORT'),
'username' => lookup('CONFIG_AMQP_AUTH_USER'),
'password' => lookup('CONFIG_AMQP_AUTH_PASSWORD')
}),
kombu_ssl_ca_certs => $kombu_ssl_ca_certs,
kombu_ssl_keyfile => $kombu_ssl_keyfile,
kombu_ssl_certfile => $kombu_ssl_certfile,
Expand Down
12 changes: 7 additions & 5 deletions packstack/puppet/modules/packstack/manifests/keystone.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
{
create_resources(packstack::firewall, lookup('FIREWALL_KEYSTONE_RULES', undef, undef, {}))

$keystone_use_ssl = false
$keystone_cfg_ks_db_pw = lookup('CONFIG_KEYSTONE_DB_PW')
$keystone_cfg_mariadb_host = lookup('CONFIG_MARIADB_HOST_URL')
$keystone_token_provider_str = downcase(lookup('CONFIG_KEYSTONE_TOKEN_FORMAT'))
$keystone_url = regsubst(regsubst(lookup('CONFIG_KEYSTONE_PUBLIC_URL'),'/v2.0',''),'/v3','')
$keystone_admin_url = lookup('CONFIG_KEYSTONE_ADMIN_URL')
Expand All @@ -31,7 +28,13 @@
}

class { 'keystone::db':
database_connection => "mysql+pymysql://keystone_admin:${keystone_cfg_ks_db_pw}@${keystone_cfg_mariadb_host}/keystone",
database_connection => os_database_connection({
'dialect' => 'mysql+pymysql',
'host' => lookup('CONFIG_MARIADB_HOST_URL'),
'username' => 'keystone_admin',
'password' => lookup('CONFIG_KEYSTONE_DB_PW'),
'database' => 'keystone',
})
}

class { 'keystone':
Expand All @@ -43,7 +46,6 @@

class { 'keystone::wsgi::apache':
workers => lookup('CONFIG_SERVICE_WORKERS'),
ssl => $keystone_use_ssl
}

class { 'keystone::bootstrap':
Expand Down
10 changes: 7 additions & 3 deletions packstack/puppet/modules/packstack/manifests/magnum.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
{
create_resources(packstack::firewall, lookup('FIREWALL_MAGNUM_API_RULES', undef, undef, {}))

$magnum_cfg_magnum_db_pw = lookup('CONFIG_MAGNUM_DB_PW')
$magnum_cfg_magnum_mariadb_host = lookup('CONFIG_MARIADB_HOST_URL')
class { 'magnum::db':
database_connection => "mysql+pymysql://magnum:${magnum_cfg_magnum_db_pw}@${magnum_cfg_magnum_mariadb_host}/magnum",
database_connection => os_database_connection({
'dialect' => 'mysql+pymysql',
'host' => lookup('CONFIG_MARIADB_HOST_URL'),
'username' => 'magnum',
'password' => lookup('CONFIG_MAGNUM_DB_PW'),
'database' => 'magnum',
})
}

$magnum_host = lookup('CONFIG_KEYSTONE_HOST_URL')
Expand Down
Loading

0 comments on commit 91cec3e

Please sign in to comment.