1 class motion::container($container){
2 include container::contained;
3 include container::no_ssh;
5 package{ ['python3', 'python3-pip', 'virtualenv', 'libpq-dev']:
10 home => '/home/motion',
14 ensure => 'directory',
18 file{'/motion-socket':
25 command => '/usr/bin/git clone https://code.wpia.club/motion.git',
26 cwd => '/home/motion',
27 creates => '/home/motion/motion/.git',
30 file{'/home/motion/motion/__pycache__':
35 file{'/home/motion/motion/config.py':
36 content => epp("motion/config.py", {user => $container, password => 'motion'}),
40 exec {'motion-virtualenv':
41 command => '/usr/bin/virtualenv -p python3 motion',
42 cwd => '/home/motion',
43 creates => '/home/motion/motion/bin/activate',
45 require => [Package['virtualenv'], Package['python3-pip'], Exec['clone motion']],
46 before => Service['motion.service'],
48 exec{'pip dependencies':
49 command => '/bin/bash -c "source motion/bin/activate; /home/motion/motion/bin/pip install -r motion/requirements.txt"',
50 require => [Exec['motion-virtualenv'],Package['python3-pip']],
51 cwd => '/home/motion',
54 creates => '/home/motion/motion/bin/flask'
58 command => '/bin/bash -c "source motion/bin/activate; /home/motion/motion/bin/pip install uwsgi"',
59 require => Exec['motion-virtualenv'],
60 cwd => '/home/motion',
63 creates => '/home/motion/motion/bin/uwsgi'
66 file{'/home/motion/motion.ini':
67 source => 'puppet:///modules/motion/motion.ini'
69 systemd::unit_file {'motion.service':
71 source => 'puppet:///modules/motion/motion.service',
72 notify => Service['motion.service'],
73 require => Exec['install uwsgi']
75 service{'motion.service':
77 provider => 'systemd',
79 require => [Exec['pip dependencies'],Exec['systemctl-daemon-reload']],