aboutsummaryrefslogtreecommitdiff
path: root/manifests/init.pp
blob: c4b58d2901fa9be806f73f6d4b5783f5a57bba8f (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
class ikiwiki {
  package { "ikiwiki":
    ensure => installed,
  }

  case $apache_sites_folder {
    '': { fail("you need to define \$apache_sites_folder for drupal module") }
  }

  file { "/usr/local/sbin/ikiwiki-deploy":
    ensure  => present,
    content => template('ikiwiki/deploy.sh.erb'),
    owner   => root,
    group   => root,
    mode    => 755,
  }

  define instance() {
    file { "/etc/ikiwiki/$name.setup":
      ensure  => present,
      content => template('ikiwiki/ikiwiki.setup.erb'),
      owner   => root,
      group   => root,
      mode    => 644,
    }

    exec { "ikiwiki --setup /etc/ikiwiki/$name.setup":
      user        => gitosis,
      refreshonly => true,
    }

    exec { "/usr/local/sbin/ikiwiki-deploy $name":
      unless => "/bin/sh -c [ -f '${apache_sites_folder}/${name}_src/index.mdw' ]",
    }

    file { [ "${apache_sites_folder}/${name}_src", "${apache_sites_folder}/${name}" ]:
      ensure  => directory,
      owner   => gitosis,
      group   => gitosis,
      recurse => true,
      notify  => Exec["ikiwiki --setup /etc/ikiwiki/$name.setup"],
    }
  }
}