summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Dittberner <jan@dittberner.info>2018-09-04 21:34:22 +0200
committerJan Dittberner <jan@dittberner.info>2018-09-04 21:34:22 +0200
commit8469912b874df9e0a26fea0bf9acf8f383dc03ba (patch)
tree33eae6611ce4a6c6f0e4b279ab4e2d965fb121b8
parentd33edb268cb94a2faec5c92631f5c2c9badfa946 (diff)
downloadcacert-puppet-8469912b874df9e0a26fea0bf9acf8f383dc03ba.tar.gz
cacert-puppet-8469912b874df9e0a26fea0bf9acf8f383dc03ba.tar.xz
cacert-puppet-8469912b874df9e0a26fea0bf9acf8f383dc03ba.zip
Add basic module to manage Pootle
-rw-r--r--.gitignore1
-rw-r--r--Puppetfile1
-rwxr-xr-xsitemodules/profiles/files/pootle/pootle-update18
-rw-r--r--sitemodules/profiles/manifests/pootle.pp61
-rw-r--r--sitemodules/roles/manifests/translations.pp1
5 files changed, 82 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 723d157..f92c1a7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@ modules/
__pycache__
*.pyc
*.pyo
+.*.swp
diff --git a/Puppetfile b/Puppetfile
index 8b954f1..ac02854 100644
--- a/Puppetfile
+++ b/Puppetfile
@@ -1 +1,2 @@
mod 'puppetlabs/stdlib'
+mod 'saz/sudo'
diff --git a/sitemodules/profiles/files/pootle/pootle-update b/sitemodules/profiles/files/pootle/pootle-update
new file mode 100755
index 0000000..4bdc56b
--- /dev/null
+++ b/sitemodules/profiles/files/pootle/pootle-update
@@ -0,0 +1,18 @@
+#! /bin/sh
+# This is a custom script to update a pootle project which can be whitelisted in
+# sudo for use by unprivileged users
+#
+# This file is managed by Puppet. Manual changes are overwritten by the next
+# Puppet run.
+
+if [ $# -ne 1 -o "$1" = "--help" ]; then
+ echo "Updates the Pootle translation files from the template"
+ echo "Usage: $0 PROJECT"
+ exit 1
+fi
+
+cd /var/www/pootle
+. current/bin/activate
+pootle update_stores --project "$1"
+#/usr/local/bin/pootle-exec update_against_templates --project $1
+
diff --git a/sitemodules/profiles/manifests/pootle.pp b/sitemodules/profiles/manifests/pootle.pp
new file mode 100644
index 0000000..9faf477
--- /dev/null
+++ b/sitemodules/profiles/manifests/pootle.pp
@@ -0,0 +1,61 @@
+# Class: profiles::pootle
+# =======================
+#
+# This class defines the pootle setup for translations.cacert.org.
+#
+# Parameters
+# ----------
+#
+# This class has no parameters
+#
+# Examples
+# --------
+#
+# @example
+# class roles::myhost {
+# include profiles::pootle
+# }
+#
+# Authors
+# -------
+#
+# Jan Dittberner <jandd@cacert.org>
+#
+# Copyright
+# ---------
+#
+# Copyright 2018 Jan Dittberner
+#
+class profiles::pootle {
+ group { 'pootle':
+ ensure => present,
+ gid => 106,
+ system => true,
+ }
+ user { 'pootle':
+ ensure => present,
+ comment => 'Pootle daemon',
+ system => true,
+ home => '/var/lib/pootle',
+ shell => '/bin/false',
+ require => Group['pootle'],
+ }
+ group { 'pootle-update':
+ ensure => present,
+ gid => 200,
+ system => true,
+ }
+ class { 'sudo':
+ config_file_replace => false,
+ }
+ file { '/usr/local/bin/pootle-update':
+ ensure => file,
+ source => 'puppet:///profiles/pootle/pootle-update',
+ owner => 'root',
+ group => 'staff',
+ mode => '0755',
+ }
+ sudo::conf { 'pootle-update':
+ content => '%pootle-update ALL = (pootle) NOPASSWD: /usr/local/bin/pootle-update',
+ }
+}
diff --git a/sitemodules/roles/manifests/translations.pp b/sitemodules/roles/manifests/translations.pp
index b716388..593d465 100644
--- a/sitemodules/roles/manifests/translations.pp
+++ b/sitemodules/roles/manifests/translations.pp
@@ -24,4 +24,5 @@ class roles::translations {
include profiles::base
include profiles::rsyslog
include profiles::nrpe_agent
+ include profiles::pootle
}