summaryrefslogtreecommitdiff
path: root/manifests/init.pp
blob: ec53e8604b1791cb590d10f2ffe619915e9ccf94 (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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
class reprepro(
  $origin    = $::domain,
  $uploaders = '',
  $basedir   = '/srv/reprepro'
) {

  case $uploaders {
    '': { fail("You need the repository uploaders! Please pass \$uploaders parameter") }
  }

  case $::lsbdistcodename {
    etch: { 
      package {
        "reprepro": ensure => '3.9.2-1~bpo40+1';
      }
    }
    default: {
      package {
        "reprepro": ensure => 'installed';
      }
    }
  }

  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 => reprepro, 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 => 1777, 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,
    content => template("reprepro/distributions.erb");

    "${basedir}/conf/uploaders":
    mode => 0660, owner => root, group => reprepro,
    content => template("reprepro/uploaders.erb");

    "${basedir}/conf/incoming":
    mode => 0664, owner => root, group => reprepro,
    source => "puppet://$server/modules/reprepro/incoming";

    "${basedir}/index.html":
    mode => 0664, owner => root, group => reprepro,
    content => template("reprepro/index.html.erb");

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

    "${basedir}/.gnupg/secring.gpg":
    mode => 600, owner => reprepro, group => reprepro,
    ensure => present;

    "/usr/local/bin/reprepro-export-key":
    ensure  => present,
    content => template('reprepro/reprepro-export-key.sh.erb'),
    owner   => root,
    group   => root,
    mode    => 755,
  }

  exec {
    "reprepro -b ${basedir} createsymlinks":
      command     => "/usr/bin/reprepro -b ${basedir} --delete createsymlinks",
      refreshonly => true,
      subscribe   => File["${basedir}/conf/distributions"],
      user        => reprepro,
      path        => "/usr/bin:/bin";
    "reprepro -b ${basedir} export":
      command     => "/usbr/bin/reprepro -b ${basedir} export",
      refreshonly => true,
      user        => reprepro,
      subscribe   => File["${basedir}/conf/distributions"],
      path        => "/usr/bin:/bin";
    "/usr/local/bin/reprepro-export-key":
      creates     => "${basedir}/key.asc",
      user        => reprepro,
      require     => File["/usr/local/bin/reprepro-export-key"];
    "/usr/local/bin/reprepro-export-key-update":
      command     => "/usr/local/bin/reprepro-export-key",
      user        => reprepro,
      subscribe   => File["${basedir}/.gnupg/secring.gpg"],
      require     => File["/usr/local/bin/reprepro-export-key"],
      refreshonly => true,
  }

# TODO: setup needeed lines in apache site config file

}