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
|
# File 'manifests/init.pp', line 1
class btsync( $webui = 'local' ) {
include systemd
Exec {
path => '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin'
}
if $::operatingsystem == 'Archlinux' {
ensure_packages(['btsync'])
} else {
ensure_packages(['curl'])
exec { 'download-btsync':
command => '/usr/bin/curl -o /tmp/btsync.tar.gz https://download-cdn.getsync.com/stable/linux-x64/BitTorrent-Sync_x64.tar.gz',
unless => '/usr/bin/test -f /usr/bin/btsync',
}~>
exec { 'extract-btsync':
command => 'tar xf /tmp/btsync.tar.gz btsync; chmod 755 /usr/bin/btsync',
cwd => '/usr/bin',
refreshonly => true,
}
file { '/etc/systemd/system/btsync.service':
source => 'puppet:///modules/btsync/btsync.service',
notify => Exec['systemd-daemon-reload'],
}
user { 'btsync':
ensure => present,
home => '/var/lib/btsync',
before => File['/var/lib/btsync']
}
}
file {
'/var/lib/btsync':
ensure => directory,
owner => 'btsync',
group => 'btsync';
'/var/lib/btsync/custom':
ensure => directory,
purge => true,
force => true;
'/etc/tmpfiles.d/btsync-etc.conf':
ensure => absent;
'/etc/tmpfiles.d/btsync.conf':
ensure => absent;
}
}
|