Merge pull request 'feat: add frontends, backends, listeners' (#153) from neoloc/haproxy_puppetdbmaster into develop
Reviewed-on: unkinben/puppet-prod#153
This commit is contained in:
commit
eaddbe03d1
@ -1,8 +1,24 @@
|
||||
---
|
||||
# mappings
|
||||
profiles::haproxy::mappings::list:
|
||||
- 'puppetboard.main.unkin.net be_puppetboard'
|
||||
- 'puppetdbapi.main.unkin.net be_puppetdbapi'
|
||||
profiles::haproxy::mappings:
|
||||
fe_https:
|
||||
ensure: present
|
||||
mappings:
|
||||
- 'puppetboard.main.unkin.net be_puppetboard'
|
||||
- 'puppetdbapi.main.unkin.net be_puppetdbapi'
|
||||
|
||||
# profiles::haproxy::listeners:
|
||||
# ls_puppetdbapi_direct:
|
||||
# collect_exported: false # handled in custom function
|
||||
# ipaddress: "%{facts.networking.ip}"
|
||||
# ports:
|
||||
# - 8081
|
||||
# mode: tcp
|
||||
# options:
|
||||
# option:
|
||||
# - tcplog
|
||||
# - ssl-hello-chk
|
||||
# balance: roundrobin
|
||||
|
||||
profiles::haproxy::backends:
|
||||
be_puppetboard:
|
||||
|
||||
19
site/profiles/manifests/haproxy/backends.pp
Normal file
19
site/profiles/manifests/haproxy/backends.pp
Normal file
@ -0,0 +1,19 @@
|
||||
# profiles::haproxy::backends
|
||||
class profiles::haproxy::backends {
|
||||
# set location_environment
|
||||
$location_environment = "${facts['country']}-${facts['region']}-${facts['environment']}"
|
||||
|
||||
# for each backend:
|
||||
$backends = lookup('profiles::haproxy::backends', Hash, 'deep', {})
|
||||
$backends.each |$backend, $data| {
|
||||
|
||||
# create backend
|
||||
haproxy::backend { $backend:
|
||||
* => $data,
|
||||
}
|
||||
|
||||
# collect exported resources
|
||||
$tag = "${backend}_${location_environment}"
|
||||
Haproxy::Balancermember <<| tag == $tag |>>
|
||||
}
|
||||
}
|
||||
14
site/profiles/manifests/haproxy/frontends.pp
Normal file
14
site/profiles/manifests/haproxy/frontends.pp
Normal file
@ -0,0 +1,14 @@
|
||||
# profiles::haproxy::frontends
|
||||
class profiles::haproxy::frontends {
|
||||
|
||||
# for each frontend:
|
||||
$frontends = lookup('profiles::haproxy::frontends', Hash, 'deep', {})
|
||||
$frontends.each |$frontend, $data| {
|
||||
|
||||
# create frontends
|
||||
haproxy::frontend { $frontend:
|
||||
* => $data,
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
19
site/profiles/manifests/haproxy/listeners.pp
Normal file
19
site/profiles/manifests/haproxy/listeners.pp
Normal file
@ -0,0 +1,19 @@
|
||||
# profiles::haproxy::listeners
|
||||
class profiles::haproxy::listeners {
|
||||
# set location_environment
|
||||
$location_environment = "${facts['country']}-${facts['region']}-${facts['environment']}"
|
||||
|
||||
# for each listener:
|
||||
$listeners = lookup('profiles::haproxy::listeners', Hash, 'deep', {})
|
||||
$listeners.each |$listen, $data| {
|
||||
|
||||
# create listener
|
||||
haproxy::listen { $listen:
|
||||
* => $data,
|
||||
}
|
||||
|
||||
# collect exported resources
|
||||
$tag = "${listen}_${location_environment}"
|
||||
Haproxy::Balancermember <<| tag == $tag |>>
|
||||
}
|
||||
}
|
||||
@ -1,9 +1,13 @@
|
||||
# profiles::haproxy::mappings
|
||||
class profiles::haproxy::mappings (
|
||||
Array $list = []
|
||||
) {
|
||||
haproxy::mapfile { 'domains-to-backends':
|
||||
ensure => 'present',
|
||||
mappings => $list,
|
||||
class profiles::haproxy::mappings {
|
||||
|
||||
# for each mapping:
|
||||
$mappings = lookup('profiles::haproxy::mappings')
|
||||
$mappings.each |$mapping, $data| {
|
||||
|
||||
# create mapping
|
||||
haproxy::mapfile { $mapping:
|
||||
* => $data,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
class profiles::haproxy::server (
|
||||
Hash $globals = {},
|
||||
Hash $defaults = {},
|
||||
Array $cnames = [],
|
||||
){
|
||||
|
||||
# default global/defaults arrays
|
||||
@ -52,19 +51,8 @@ class profiles::haproxy::server (
|
||||
include profiles::haproxy::fe_http # default http frontend
|
||||
include profiles::haproxy::fe_https # default https frontend
|
||||
include profiles::haproxy::dns # manage dns for haproxy
|
||||
include profiles::haproxy::frontends # create frontends
|
||||
include profiles::haproxy::backends # create backends
|
||||
include profiles::haproxy::listeners # create listeners
|
||||
|
||||
# for each backend:
|
||||
$backends = lookup('profiles::haproxy::backends')
|
||||
$backends.each |$backend, $data| {
|
||||
|
||||
# create backend
|
||||
haproxy::backend { $backend:
|
||||
* => $data,
|
||||
}
|
||||
|
||||
# collect exported resources
|
||||
$location_environment = "${facts['country']}-${facts['region']}-${facts['environment']}"
|
||||
$tag = "${backend}_${location_environment}"
|
||||
Haproxy::Balancermember <<| tag == $tag |>>
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user