summaryrefslogtreecommitdiff
path: root/manifests/onionbalance
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/onionbalance')
-rw-r--r--manifests/onionbalance/key.pp25
-rw-r--r--manifests/onionbalance/keys.pp11
2 files changed, 36 insertions, 0 deletions
diff --git a/manifests/onionbalance/key.pp b/manifests/onionbalance/key.pp
new file mode 100644
index 0000000..e0016fc
--- /dev/null
+++ b/manifests/onionbalance/key.pp
@@ -0,0 +1,25 @@
+# manage onionbalance keys
+#
+# key_content will be treated as path
+# to a file containing the key content
+# if the value starts with a /
+#
+define tor::onionbalance::key(
+ $key_content,
+ $group,
+){
+
+ if $key_content =~ /^\// {
+ $content = file($key_content)
+ } else {
+ $content = $key_content
+ }
+ Package<| tag == 'onionbalance' |> -> file{
+ "/etc/onionbalance/${name}.key":
+ content => $content,
+ owner => root,
+ group => $group,
+ mode => '0640',
+ notify => Service['onionbalance'];
+ }
+}
diff --git a/manifests/onionbalance/keys.pp b/manifests/onionbalance/keys.pp
new file mode 100644
index 0000000..e3040f5
--- /dev/null
+++ b/manifests/onionbalance/keys.pp
@@ -0,0 +1,11 @@
+# a wrapper to manage onionbalance keys
+define tor::onionbalance::keys(
+ $values,
+ $group,
+) {
+ tor::onionbalance::key{
+ $name:
+ key_content => $values[$name]['_key_content'],
+ group => $group,
+ }
+}