aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xfiles/drupal18
-rw-r--r--manifests/autoupgrade.pp13
-rw-r--r--manifests/init.pp8
3 files changed, 34 insertions, 5 deletions
diff --git a/files/drupal b/files/drupal
index e43fd49..bc4b12f 100755
--- a/files/drupal
+++ b/files/drupal
@@ -5,7 +5,8 @@
BASE=${BASE:="/var/www/data"}
SITES=${SITES:="$BASE/drupal"}
-SERIES="6 7 8"
+SERIES="6 7 8 9"
+LATEST_SERIES="9"
# Ensure we have a proper path, useful when called through cron
export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
@@ -152,7 +153,7 @@ function drupal_current {
local series="$1"
if [ -z "$series" ]; then
- series="8"
+ series="$LATEST_SERIES"
fi
if [ -e "$BASE/drupal-${series}" ]; then
@@ -169,7 +170,7 @@ function drupal_latest {
local series="$1"
if [ -z "$series" ]; then
- series="8"
+ series="$LATEST_SERIES"
fi
latest="`wget -O- -q https://updates.drupal.org/release-history/drupal/${series}.x | grep -oPm1 "(?<=<download_link>)[^<]+" | grep -v -- '-dev' | grep -v -- '-alpha' | grep -v -- '-beta' | grep -v -- '-rc' | head -1`"
@@ -188,7 +189,10 @@ function drupal_download {
fi
# Check for latest releases if no specific version was given
- if [ "$new" == "8" ]; then
+ if [ "$new" == "9" ]; then
+ drupal_series="9"
+ new="`drupal_latest 9`"
+ elif [ "$new" == "8" ]; then
drupal_series="8"
new="`drupal_latest 8`"
elif [ "$new" == "7" ]; then
@@ -237,7 +241,11 @@ function drupal_upgrade {
new="$2"
# Fix versions if just a series is given
- if [ "$old" == "8" ] && [ -z "$new" ]; then
+ if [ "$old" == "9" ] && [ -z "$new" ]; then
+ old="`drupal_current 9`"
+ new="`drupal_latest 9`"
+ drupal_series="9"
+ elif [ "$old" == "8" ] && [ -z "$new" ]; then
old="`drupal_current 8`"
new="`drupal_latest 8`"
drupal_series="8"
diff --git a/manifests/autoupgrade.pp b/manifests/autoupgrade.pp
index 6aa881b..cd7a6d5 100644
--- a/manifests/autoupgrade.pp
+++ b/manifests/autoupgrade.pp
@@ -1,4 +1,17 @@
class drupal::autoupgrade {
+ # Keep 9.x codebase updated
+ cron { "drupal-autoupgrade-9.x":
+ command => "/usr/local/bin/drupal upgrade 9",
+ user => root,
+ # Run once a week after security releases (usually on Wednesdays)
+ weekday => 5,
+ hour => "01",
+ minute => "30",
+ environment => [ 'SILENT=yes' ],
+ ensure => present,
+ require => [ File['/usr/local/bin/drupal'], User['drupal'] ],
+ }
+
# Keep 8.x codebase updated
cron { "drupal-autoupgrade-8.x":
command => "/usr/local/bin/drupal upgrade 8",
diff --git a/manifests/init.pp b/manifests/init.pp
index b81f231..96fc36d 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -66,6 +66,14 @@ class drupal {
backup => false,
}
+ # Ensure we have an 9.x instance
+ exec { 'drupal-download-9.x':
+ command => '/usr/local/bin/drupal download 9',
+ user => "root",
+ creates => '/var/www/data/drupal-9',
+ require => File['/usr/local/bin/drupal'],
+ }
+
# Ensure we have an 8.x instance
exec { 'drupal-download-8.x':
command => '/usr/local/bin/drupal download 8',