1 define onion::service (
8 if ($ensure == "ifstatic") {
9 $my_ensure = has_static_component($name) ? {
17 if ($my_ensure == "present") {
20 concat::fragment { "onion::torrc_onionservice::${name}":
21 target => "/etc/tor/torrc",
23 content => "HiddenServiceDir /var/lib/tor/onion/${name}\nHiddenServicePort ${port} ${target_address}:${target_port}\n\n",
26 $onion_hn = onion_tor_service_hostname($name)
28 $hostname_without_onion = regsubst($onion_hn, '\.onion$', '')
31 @@concat::fragment { "onion::balance::onionbalance-services.yaml::${name}":
32 target => "/srv/puppet.debian.org/puppet-facts/onionbalance-services.yaml",
33 content => "{\"${name}\": \"${onion_hn}\"}\n",
34 tag => "onionbalance-services.yaml",
37 @@concat::fragment { "onion::balance::instance::dsa-snippet::$name::$fqdn":
38 target => "/etc/onionbalance/config-dsa-snippet.yaml",
39 content => "- service: ${name}\n address: ${hostname_without_onion}\n name: ${hostname}-${name}\n",
40 tag => "onion::balance::dsa-snippet",
44 } elsif ($my_ensure == "absent") {
45 file { "/var/lib/tor/onion/${name}":
50 fail("Invalid ensure value ${my_ensure}")