aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifests/console.pp10
-rw-r--r--manifests/drush.pp58
-rw-r--r--manifests/init.pp172
-rw-r--r--manifests/maintenance.pp22
-rw-r--r--manifests/makefiles.pp67
5 files changed, 163 insertions, 166 deletions
diff --git a/manifests/console.pp b/manifests/console.pp
new file mode 100644
index 0000000..d70fe5c
--- /dev/null
+++ b/manifests/console.pp
@@ -0,0 +1,10 @@
+class drupal::console {
+ # TODO: we should expect at least https download protocol.
+ # Drupal Console
+ #exec { 'getdrupalconsole':
+ # command => '/usr/bin/curl -LSs http://drupalconsole.com/installer | php && /bin/mv console.phar /usr/local/bin/drupal-console',
+ # user => 'root',
+ # cwd => '/tmp',
+ # creates => '/usr/local/bin/drupal-console',
+ #}
+}
diff --git a/manifests/drush.pp b/manifests/drush.pp
new file mode 100644
index 0000000..4a9b27f
--- /dev/null
+++ b/manifests/drush.pp
@@ -0,0 +1,58 @@
+class drupal::drush(
+ $version = hiera('drupal::drush::version', '8.0.1')
+) {
+ # Drush config folder
+ file { '/etc/drush':
+ ensure => directory,
+ owner => root,
+ group => root,
+ mode => 0644,
+ }
+
+ # Drush default configuration
+ file { '/etc/drush/drushrc.php':
+ ensure => present,
+ owner => root,
+ group => root,
+ mode => 0644,
+ source => 'puppet:///modules/drupal/drushrc.php',
+ require => File['/etc/drush'],
+ }
+
+ # TODO: future
+ package { 'drush':
+ ensure => absent,
+ }
+
+ #vcsrepo { "/usr/local/share/drush":
+ # ensure => present,
+ # provider => git,
+ # source => 'https://github.com/drush-ops/drush',
+ # revision => '401f034c59b031221d900bec7c2ba81d1331c284',
+ # owner => 'root',
+ # group => 'root',
+ #}
+
+ #file { "/usr/local/bin/drush":
+ # ensure => '/usr/local/share/drush/drush',
+ # owner => root,
+ # group => root,
+ # require => [ Vcsrepo['/usr/local/share/drush'], Exec['getcomposer'] ],
+ #}
+
+ #exec { 'composer-drush':
+ # command => '/usr/local/bin/composer global require drush/drush:dev-master',
+ # user => 'vagrant',
+ # creates => '/home/vagrant/composer/vendor/bin/drush',
+ # environment => [ 'COMPOSER_HOME="/vagrant"' ],
+ # require => Exec['getcomposer'],
+ #}
+
+ exec { 'getdrush':
+ command => "/usr/bin/wget https://github.com/drush-ops/drush/releases/download/${version}/drush.phar -O /usr/local/bin/drush && chmod +x /usr/local/bin/drush",
+ user => 'root',
+ cwd => '/tmp',
+ timeout => 0,
+ creates => '/usr/local/bin/drush',
+ }
+}
diff --git a/manifests/init.pp b/manifests/init.pp
index 34a4fb1..7183ae3 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -1,28 +1,8 @@
-class drupal(
- $drush_version = hiera('drupal::drush::version', '8.0.1')
-) {
- # Needed packages
- package { [ "php5-gd", "php5-imagick" ]:
- ensure => installed,
- }
-
- # Drush config folder
- file { '/etc/drush':
- ensure => directory,
- owner => root,
- group => root,
- mode => 0644,
- }
-
- # Drush default configuration
- file { '/etc/drush/drushrc.php':
- ensure => present,
- owner => root,
- group => root,
- mode => 0644,
- source => 'puppet:///modules/drupal/drushrc.php',
- require => File['/etc/drush'],
- }
+class drupal {
+ include php::composer
+ include drupal::drush
+ include drupal::makefiles
+ include drupal::maintenance
# Drupal management script
file { "/usr/local/sbin/drupal":
@@ -33,53 +13,6 @@ class drupal(
mode => 755,
}
- # Run drupal cron
- cron { "drupal-cron":
- command => "/usr/local/sbin/drupal cron &> /dev/null",
- user => root,
- hour => "*/1",
- minute => "15",
- ensure => present,
- require => File['/usr/local/sbin/drupal'],
- }
-
- # Keep themes and modules up-to-date
- cron { "drupal-update":
- command => "/usr/local/sbin/drupal cron-update",
- user => root,
- # Run once a week after security releases (usually on Wednesdays)
- weekday => 5,
- hour => "02",
- minute => "30",
- ensure => present,
- }
-
- cron { "drupal-make-6":
- command => "/usr/local/sbin/drupal make 6",
- user => root,
- # Run once a week to ensure the server has all dependencies
- weekday => 4,
- hour => "02",
- minute => "30",
- ensure => present,
- require => File['/usr/local/sbin/drupal',
- '/usr/local/share/drupal/drupal6.make',
- '/usr/local/share/drupal/themes6.make'],
- }
-
- cron { "drupal-make-7":
- command => "/usr/local/sbin/drupal make 7",
- user => root,
- # Run once a week to ensure the server has all dependencies
- weekday => 4,
- hour => "02",
- minute => "30",
- ensure => present,
- require => File['/usr/local/sbin/drupal',
- '/usr/local/share/drupal/drupal7.make',
- '/usr/local/share/drupal/themes7.make'],
- }
-
# Drupal shared folder
file { "/usr/local/share/drupal":
ensure => directory,
@@ -88,46 +21,6 @@ class drupal(
mode => 755,
}
- # Drupal 6 makefile
- file { "/usr/local/share/drupal/drupal6.make":
- ensure => present,
- owner => root,
- group => root,
- mode => 644,
- source => "puppet:///modules/drupal/drupal6.make",
- require => File['/usr/local/share/drupal'],
- }
-
- # Drupal 7 makefile
- file { "/usr/local/share/drupal/drupal7.make":
- ensure => present,
- owner => root,
- group => root,
- mode => 644,
- source => "puppet:///modules/drupal/drupal7.make",
- require => File['/usr/local/share/drupal'],
- }
-
- # Drupal 6 theme makefile
- file { "/usr/local/share/drupal/themes6.make":
- ensure => present,
- owner => root,
- group => root,
- mode => 644,
- source => "puppet:///modules/drupal/themes6.make",
- require => File['/usr/local/share/drupal'],
- }
-
- # Drupal 7 theme makefile
- file { "/usr/local/share/drupal/themes7.make":
- ensure => present,
- owner => root,
- group => root,
- mode => 644,
- source => "puppet:///modules/drupal/themes7.make",
- require => File['/usr/local/share/drupal'],
- }
-
# See https://drupal.org/SA-CORE-2013-003
file { "/tmp/.htaccess":
ensure => present,
@@ -137,64 +30,11 @@ class drupal(
source => "puppet:///modules/drupal/htaccess",
}
+ # Ensure there's no old, buggy code in drupal farms
file { [ '/var/www/data/drupal-6/backup', '/var/www/data/drupal-7/backup' ]:
ensure => absent,
recurse => true,
force => true,
backup => false,
}
-
- # Composer
- exec { 'getcomposer':
- command => '/usr/bin/wget -O - https://getcomposer.org/installer | /usr/bin/php && /bin/mv composer.phar /usr/local/bin/composer',
- user => 'root',
- cwd => '/tmp',
- creates => '/usr/local/bin/composer',
- }
-
- # TODO: future
- package { [ 'composer', 'drush' ]:
- ensure => absent,
- }
-
- #vcsrepo { "/usr/local/share/drush":
- # ensure => present,
- # provider => git,
- # source => 'https://github.com/drush-ops/drush',
- # revision => '401f034c59b031221d900bec7c2ba81d1331c284',
- # owner => 'root',
- # group => 'root',
- #}
-
- #file { "/usr/local/bin/drush":
- # ensure => '/usr/local/share/drush/drush',
- # owner => root,
- # group => root,
- # require => [ Vcsrepo['/usr/local/share/drush'], Exec['getcomposer'] ],
- #}
-
- #exec { 'composer-drush':
- # command => '/usr/local/bin/composer global require drush/drush:dev-master',
- # user => 'vagrant',
- # creates => '/home/vagrant/composer/vendor/bin/drush',
- # environment => [ 'COMPOSER_HOME="/vagrant"' ],
- # require => Exec['getcomposer'],
- #}
-
- exec { 'getdrush':
- command => "/usr/bin/wget https://github.com/drush-ops/drush/releases/download/${drush_version}/drush.phar -O /usr/local/bin/drush && chmod +x /usr/local/bin/drush",
- user => 'root',
- cwd => '/tmp',
- timeout => 0,
- creates => '/usr/local/bin/drush',
- }
-
- # Drupal Console
- # TODO: we should expect at least https download protocol.
- #exec { 'getdrupalconsole':
- # command => '/usr/bin/curl -LSs http://drupalconsole.com/installer | php && /bin/mv console.phar /usr/local/bin/drupal-console',
- # user => 'root',
- # cwd => '/tmp',
- # creates => '/usr/local/bin/drupal-console',
- #}
}
diff --git a/manifests/maintenance.pp b/manifests/maintenance.pp
new file mode 100644
index 0000000..097ebcc
--- /dev/null
+++ b/manifests/maintenance.pp
@@ -0,0 +1,22 @@
+class drupal::maintenance {
+ # Run drupal cron
+ cron { "drupal-cron":
+ command => "/usr/local/sbin/drupal cron &> /dev/null",
+ user => root,
+ hour => "*/1",
+ minute => "15",
+ ensure => present,
+ require => File['/usr/local/sbin/drupal'],
+ }
+
+ # Keep themes and modules up-to-date
+ cron { "drupal-update":
+ command => "/usr/local/sbin/drupal cron-update",
+ user => root,
+ # Run once a week after security releases (usually on Wednesdays)
+ weekday => 5,
+ hour => "02",
+ minute => "30",
+ ensure => present,
+ }
+}
diff --git a/manifests/makefiles.pp b/manifests/makefiles.pp
new file mode 100644
index 0000000..4f643fc
--- /dev/null
+++ b/manifests/makefiles.pp
@@ -0,0 +1,67 @@
+class drupal::makefiles {
+ # Drupal 6 makefile
+ file { "/usr/local/share/drupal/drupal6.make":
+ ensure => present,
+ owner => root,
+ group => root,
+ mode => 644,
+ source => "puppet:///modules/drupal/drupal6.make",
+ require => File['/usr/local/share/drupal'],
+ }
+
+ # Drupal 7 makefile
+ file { "/usr/local/share/drupal/drupal7.make":
+ ensure => present,
+ owner => root,
+ group => root,
+ mode => 644,
+ source => "puppet:///modules/drupal/drupal7.make",
+ require => File['/usr/local/share/drupal'],
+ }
+
+ # Drupal 6 theme makefile
+ file { "/usr/local/share/drupal/themes6.make":
+ ensure => present,
+ owner => root,
+ group => root,
+ mode => 644,
+ source => "puppet:///modules/drupal/themes6.make",
+ require => File['/usr/local/share/drupal'],
+ }
+
+ # Drupal 7 theme makefile
+ file { "/usr/local/share/drupal/themes7.make":
+ ensure => present,
+ owner => root,
+ group => root,
+ mode => 644,
+ source => "puppet:///modules/drupal/themes7.make",
+ require => File['/usr/local/share/drupal'],
+ }
+
+ cron { "drupal-make-6":
+ command => "/usr/local/sbin/drupal make 6",
+ user => root,
+ # Run once a week to ensure the server has all dependencies
+ weekday => 4,
+ hour => "02",
+ minute => "30",
+ ensure => present,
+ require => File['/usr/local/sbin/drupal',
+ '/usr/local/share/drupal/drupal6.make',
+ '/usr/local/share/drupal/themes6.make'],
+ }
+
+ cron { "drupal-make-7":
+ command => "/usr/local/sbin/drupal make 7",
+ user => root,
+ # Run once a week to ensure the server has all dependencies
+ weekday => 4,
+ hour => "02",
+ minute => "30",
+ ensure => present,
+ require => File['/usr/local/sbin/drupal',
+ '/usr/local/share/drupal/drupal7.make',
+ '/usr/local/share/drupal/themes7.make'],
+ }
+}