aboutsummaryrefslogtreecommitdiff
path: root/manifests/init.pp
blob: b81f23180a9f43c25f829df3783705c01aa6a7d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
class drupal {
  include php::composer
  include drupal::drush
  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,
  }

  # Drupal management script
  file { "/usr/local/bin/drupal":
    ensure  => present,
    source  => 'puppet:///modules/drupal/drupal',
    owner   => root,
    group   => root,
    mode    => '755',
  }

  # Drupal shared folder
  file { "/usr/local/share/drupal":
    ensure  => directory,
    owner   => root,
    group   => root,
    mode    => '755',
  }

  # See https://drupal.org/SA-CORE-2013-003
  #file { "/tmp/.htaccess":
  #  ensure  => present,
  #  owner   => root,
  #  group   => root,
  #  mode    => '644',
  #  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,
  }

  # Ensure we have an 8.x instance
  exec { 'drupal-download-8.x':
    command => '/usr/local/bin/drupal download 8',
    user    => "root",
    creates => '/var/www/data/drupal-8',
    require => File['/usr/local/bin/drupal'],
  }

  # Ensure we have an 7.x instance
  exec { 'drupal-download-7.x':
    command => '/usr/local/bin/drupal download 7',
    user    => "root",
    creates => '/var/www/data/drupal-7',
    require => File['/usr/local/bin/drupal'],
  }
}