Add basic module to manage Pootle
authorJan Dittberner <jan@dittberner.info>
Tue, 4 Sep 2018 19:34:22 +0000 (21:34 +0200)
committerJan Dittberner <jan@dittberner.info>
Tue, 4 Sep 2018 19:34:22 +0000 (21:34 +0200)
.gitignore
Puppetfile
sitemodules/profiles/files/pootle/pootle-update [new file with mode: 0755]
sitemodules/profiles/manifests/pootle.pp [new file with mode: 0644]
sitemodules/roles/manifests/translations.pp

index 723d157..f92c1a7 100644 (file)
@@ -5,3 +5,4 @@ modules/
 __pycache__
 *.pyc
 *.pyo
+.*.swp
index 8b954f1..ac02854 100644 (file)
@@ -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 (executable)
index 0000000..4bdc56b
--- /dev/null
@@ -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 (file)
index 0000000..9faf477
--- /dev/null
@@ -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',
+  }
+}
index b716388..593d465 100644 (file)
@@ -24,4 +24,5 @@ class roles::translations {
   include profiles::base
   include profiles::rsyslog
   include profiles::nrpe_agent
+  include profiles::pootle
 }