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'], } # Drupal management script file { "/usr/local/sbin/drupal": ensure => present, source => 'puppet:///modules/drupal/drupal', owner => root, group => root, mode => 755, } # Run drupal cron cron { "drupal-cron": command => "/usr/local/sbin/drupal cron &> /dev/null", user => root, hour => "*/1", minute => "15", path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 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", path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 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", path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 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", path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 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, owner => root, group => root, 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, owner => root, group => root, mode => 644, source => "puppet:///modules/drupal/htaccess", } 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', #} }