]> WPIA git - infra.git/blob - modules/motion/manifests/virtual.pp
add: motion system from source
[infra.git] / modules / motion / manifests / virtual.pp
1 define motion::virtual ($domain = "motion.${systemDomain}", $container = $name) {
2   @file{"/run/${container}-socket":
3     ensure => 'directory',
4     tag => [root]
5   } ->
6   @lxc::container { $container:
7     contname => $container,
8     ip => $ips[$container],
9     dir => ['/motion-socket'],
10     bind => {
11       "/run/${container}-socket" => { 'target' => "motion-socket"},
12     },
13     tag => [root]
14   }
15   @lxc::container_bind{ "/run/${container}-socket":
16     container => 'front-nginx',
17     target => "${container}-socket",
18     tag => [root]
19   }
20
21   @file{"/etc/ssl/${container}-roots.pem":
22     ensure => 'file',
23     source => ['puppet:///modules/motion/motion-roots.pem', 'puppet:///modules/nre/config/ca/root.crt'],
24     tag => [nginx]
25   }
26   @front_vhost{$container:
27     source => 'motion/nginx.epp',
28     args => {container => $container, cert_stem => "/etc/ssl/private/${container}", domain => $domain, socket => "unix:/${container}-socket/motion.fcgi"},
29     crt => "motion/${container}",
30     tag => [nginx]
31   }
32
33
34   @postgresql::server::db { $container:
35     user     => $container,
36     password => postgresql_password($container, 'motion'),
37     tag => [primary]
38   }
39   @postgresql::server::pg_hba_rule { "allow ${container} to access its database":
40     description => "Open up PostgreSQL for access from motion-user to its database",
41     type        => 'host',
42     database    => $container,
43     user        => $container,
44     address     => "${ips[$container]}/32",
45     auth_method => 'md5',
46     tag => [primary]
47   }
48 }