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",
24 HiddenServiceDir /var/lib/tor/onion/${name}
25 HiddenServiceVersion 2
26 HiddenServicePort ${port} ${target_address}:${target_port}
31 $onion_hn = onion_tor_service_hostname($name)
33 $hostname_without_onion = regsubst($onion_hn, '\.onion$', '')
36 @@concat::fragment { "onion::balance::onionbalance-services.yaml::${name}":
37 target => "/srv/puppet.debian.org/puppet-facts/onionbalance-services.yaml",
38 content => "{\"${name}\": \"${onion_hn}\"}\n",
39 tag => "onionbalance-services.yaml",
42 @@concat::fragment { "onion::balance::instance::dsa-snippet::$name::$fqdn":
43 target => "/etc/onionbalance/config-dsa-snippet.yaml",
44 content => "- service: ${name}\n address: ${hostname_without_onion}\n name: ${hostname}-${name}\n",
45 tag => "onion::balance::dsa-snippet",
49 } elsif ($my_ensure == "absent") {
50 file { "/var/lib/tor/onion/${name}":
55 fail("Invalid ensure value ${my_ensure}")