]> gitweb.fluxo.info Git - puppet-drupal.git/commitdiff
Use drupal user for cronjobs
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 14 Oct 2016 12:29:36 +0000 (09:29 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 14 Oct 2016 12:29:36 +0000 (09:29 -0300)
manifests/init.pp
manifests/maintenance.pp

index 577e6fefa8ffd6c2bf8531581dc8fdfb548e701a..da68b0855b83b504871363989e76a843737243e9 100644 (file)
@@ -4,6 +4,29 @@ class drupal {
   include drupal::makefiles
   include drupal::maintenance
 
+  group { 'drupal':
+    ensure    => present,
+    allowdupe => false,
+  }
+
+  user { 'drupal':
+    ensure    => present,
+    allowdupe => false,
+    shell     => '/bin/bash',
+    gid       => 'drupal',
+    home      => '/var/lib/drupal',
+    require   => Group['drupal'],
+  }
+
+  # This shall hold drush-backups in the future
+  file { '/var/lib/drupal':
+    ensure => directory,
+    owner    => 'drupal',
+    group    => 'drupal',
+    mode     => 0750,
+    require  => User['drupal'],
+  }
+
   # TODO: old location, remove in the future
   file { "/usr/local/sbin/drupal":
     ensure => absent,
index 16f4c6aa78be075420311b4bd966eeb35c063f17..720089ef35e9d21b94e919b73efbfeb847f81f85 100644 (file)
@@ -2,21 +2,22 @@ class drupal::maintenance {
   # Run drupal cron
   cron { "drupal-cron":
     command  => "/usr/local/bin/drupal cron &> /dev/null",
-    user     => root,
+    user     => drupal,
     hour     => "*/1",
     minute   => "15",
     ensure   => present,
-    require  => File['/usr/local/sbin/drupal'],
+    require  => [ File['/usr/local/sbin/drupal'], User['drupal'] ],
   }
 
   # Keep themes and modules up-to-date
   cron { "drupal-update":
     command  => "/usr/local/bin/drupal cron-update",
-    user     => root,
+    user     => drupal,
     # Run once a week after security releases (usually on Wednesdays)
     weekday  => 5,
     hour     => "02",
     minute   => "30",
     ensure   => present,
+    require  => User['drupal'],
   }
 }