import yaml
j = '/etc/onionbalance/config-dsa-snippet.yaml'
-outfile = '/etc/onionbalance/config.yaml-NEW'
+outfile = '/etc/onionbalance/config.yaml'
relkeydir = 'private_keys'
keydir = os.path.join('/etc/onionbalance', relkeydir)
config = {}
-config['service'] = services
+config['services'] = services
with open(outfile, 'w') as f:
yaml.dump(config, f, indent=4)
content => "ControlPort 9051\n\n",
}
- concat { '/etc/onionbalance/config.yaml':
- notify => Service['onionbalance'],
- require => Package['onionbalance'],
- }
- concat::fragment { 'onion::balance::config_header':
- target => "/etc/onionbalance/config.yaml",
- order => 05,
- content => "services:\n",
- }
-
@@concat::fragment { "onion::balance::onionbalance-services.yaml":
target => "/srv/puppet.debian.org/puppet-facts/onionbalance-services.yaml",
content => "${onion_balance_service_hostname}\n",
tag => "onionbalance-services.yaml",
}
-
concat { '/etc/onionbalance/config-dsa-snippet.yaml':
notify => Exec['create-onionbalance-config'],
require => File['/usr/local/bin/create-onionbalance-config']
exec { "create-onionbalance-config":
command => "/usr/local/bin/create-onionbalance-config",
refreshonly => true,
- require => [ File['/usr/local/bin/create-onionbalance-config'] ],
- #require => Package['onionbalance'],
- #notify => Service['onionbalance'],
+ require => [ File['/usr/local/bin/create-onionbalance-config'], Package['onionbalance'] ],
+ notify => Service['onionbalance'],
}
}
+++ /dev/null
-define onion::balance_service (
-) {
- include onion::balance
-
- $onion_hn = onion_balance_service_hostname($name)
- if ! $onion_hn {
- exec { "create-onionbalance-key-${name}":
- command => "/bin/true && umask 0027 && openssl genrsa -out /etc/onionbalance/private_keys/${name}.key 1024 && chgrp onionbalance /etc/onionbalance/private_keys/${name}.key",
- onlyif => "/bin/true && ! [ -e /etc/onionbalance/private_keys/${name}.key ]",
- require => Package['onionbalance'],
- }
- }
-
- concat::fragment { "onion::balance::service_header::${name}":
- target => "/etc/onionbalance/config.yaml",
- order => "50-${name}-10",
- content => " - # ${name} via ${onion_hn}\n key: private_keys/${name}.key\n instances:\n",
- }
-
- Concat::Fragment <<| tag == "onion::balance::${name}" |>>
-}
$onion_hn = onion_tor_service_hostname($name)
if $onion_hn {
$hostname_without_onion = regsubst($onion_hn, '\.onion$', '')
- @@concat::fragment { "onion::balance::instance::$name::$fqdn":
- target => "/etc/onionbalance/config.yaml",
- content => " - address: ${hostname_without_onion}\n name: ${hostname}-${name}\n",
- order => "50-${name}-20",
- tag => "onion::balance::$name",
- }
if ($direct) {
@@concat::fragment { "onion::balance::onionbalance-services.yaml::${name}":
}
}
if has_role('onionbalance') {
- include roles::onionbalance
+ include onion::balance
}
}
+++ /dev/null
-class roles::onionbalance {
- onion::balance_service { 'ftp.debian.org': }
- onion::balance_service { 'dsa.debian.org': }
- onion::balance_service { 'www.debian.org': }
- onion::balance_service { 'rtc.debian.org': }
- onion::balance_service { 'd-i.debian.org': }
-
- # do
- onion::balance_service { 'appstream.debian.org': }
- onion::balance_service { 'backports.debian.org': }
- onion::balance_service { 'bits.debian.org': }
- onion::balance_service { 'blends.debian.org': }
- onion::balance_service { 'lintian.debian.org': }
- onion::balance_service { 'onion.debian.org': }
- onion::balance_service { 'release.debian.org': }
- onion::balance_service { 'security-team.debian.org': }
- onion::balance_service { 'www.ports.debian.org': }
- # dn
- onion::balance_service { 'news.debian.net': }
- onion::balance_service { 'debaday.debian.net': }
- onion::balance_service { 'micronews.debian.net': }
- onion::balance_service { 'timeline.debian.net': }
- onion::balance_service { 'wnpp-by-tags.debian.net': }
- # dc
- onion::balance_service { 'debconf0.debconf.org': }
- onion::balance_service { 'debconf1.debconf.org': }
- onion::balance_service { 'debconf2.debconf.org': }
- onion::balance_service { 'debconf3.debconf.org': }
- onion::balance_service { 'debconf4.debconf.org': }
- onion::balance_service { 'debconf5.debconf.org': }
- onion::balance_service { 'debconf6.debconf.org': }
- onion::balance_service { 'debconf7.debconf.org': }
- onion::balance_service { '10years.debconf.org': }
- onion::balance_service { 'es.debconf.org': }
- onion::balance_service { 'fr.debconf.org': }
- onion::balance_service { 'miniconf10.debconf.org': }
-
- # non-SSL
- onion::balance_service { 'debdeltas.debian.net': }
- onion::balance_service { 'incoming.debian.org': }
- onion::balance_service { 'incoming.ports.debian.org': }
- onion::balance_service { 'metadata.ftp-master.debian.org': }
- onion::balance_service { 'mozilla.debian.net': }
- onion::balance_service { 'planet.debian.org': }
-
-
- # non-static.d.o
- onion::balance_service { 'security.debian.org': }
- onion::balance_service { 'debug.mirrors.debian.org': }
- onion::balance_service { 'ftp.ports.debian.org': }
-}