summaryrefslogtreecommitdiff
path: root/manifests/init.pp
blob: bf507705eff077707261cfe668f617a255fce1c8 (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
85
86
87
88
89
90
91
92
93
94
95
96
97
class reprepro {

  $basedir = '/srv/reprepro'

  package {
    "reprepro":
      ensure => '3.9.2-1~bpo40+1';

    "inoticoming":
      ensure => '0.2.0-1~bpo40+1';
  }

  user { "reprepro":
    ensure => "present",
    home => "$basedir",
    gid => "reprepro",
    password => "*",
    comment => "reprepro sandbox",
    require => Group["reprepro"],
  }

  group { "reprepro":
    ensure => "present",
  }


  file {
    "$basedir":
    ensure => directory,
    mode => 0771, owner => root, group => reprepro;

    "$basedir/conf":
    ensure => directory,
    mode => 0770, owner => root, group => reprepro;

    "$basedir/db":
    ensure => directory,
    mode => 0770, owner => reprepro, group => reprepro;

    "$basedir/dists":
    ensure => directory,
    mode => 0775, owner => reprepro, group => reprepro;

    "$basedir/pool":
    ensure => directory,
    mode => 0775, owner => reprepro, group => reprepro;

    "$basedir/incoming":
    ensure => directory,
    mode => 0775, owner => reprepro, group => reprepro;

    "$basedir/logs":
    ensure => directory,
    mode => 0775, owner => reprepro, group => reprepro;

    "$basedir/tmp":
    ensure => directory,
    mode => 0775, owner => reprepro, group => reprepro;

    "$basedir/conf/distributions":
    mode => 0664, owner => root, group => reprepro,
    source => "puppet://$servername/reprepro/distributions";

    "$basedir/conf/uploaders":
    mode => 0660, owner => root, group => reprepro,
    source => "puppet://$servername/reprepro/uploaders";

    "$basedir/conf/incoming":
    mode => 0664, owner => root, group => reprepro,
    source => "puppet://$servername/reprepro/incoming";

    "$basedir/README.txt":
    mode => 0664, owner => root, group => reprepro,
    source => "puppet://$servername/reprepro/README.txt";

    "$basedir/.gnupg":
    mode => 750, owner => reprepro, group => root,
    ensure => directory;
  }

  exec { "reprepro -b $basedir createsymlinks":
    refreshonly => true,
    subscribe => File["$basedir/conf/distributions"],
    path => "/usr/bin:/bin",
  }

  exec { "gpg --export -a `gpg --with-colon --list-secret-keys | awk -F ':' '{ print $5 }' | head -1` > $basedir/key.asc":
    creates => "$basedir/key.asc",
    subscribe => File["$basedir/.gnupg"],
  }

# TODO: additional things this class could do
# setup inotincoming cronjob
# ensure it stays running
# setup needeed lines in apache site config file

}