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
|
class bitcoind($daemon_args = '-daemon', $rpcpassword, $ensure = 'running') {
package { 'bitcoind':
ensure => installed,
}
group { "bitcoin":
ensure => present,
allowdupe => false,
}
user { "bitcoin":
ensure => present,
allowdupe => false,
shell => '/bin/bash',
gid => 'bitcoin',
home => '/var/lib/bitcoin',
require => Group['bitcoin'],
}
file { '/var/lib/bitcoin':
ensure => directory,
owner => 'bitcoin',
group => 'bitcoin',
mode => 0750,
require => User['bitcoin'],
}
file { '/var/lib/bitcoin/.bitcoin':
ensure => directory,
owner => 'bitcoin',
group => 'bitcoin',
mode => 0750,
require => File['/var/lib/bitcoin'],
}
file { '/var/lib/bitcoin/.bitcoin/bitcoin.conf':
ensure => present,
owner => 'bitcoin',
group => 'bitcoin',
mode => 0600,
content => template('bitcoind/bitcoin.conf.erb'),
require => File['/var/lib/bitcoin/.bitcoin'],
notify => Service['bitcoind'],
}
file { '/etc/init.d/bitcoind':
ensure => present,
owner => root,
group => root,
mode => 0755,
content => template('bitcoind/bitcoind-init.d.sh.erb'),
notify => Service['bitcoind'],
}
service { 'bitcoind':
enable => true,
ensure => $ensure,
hasrestart => true,
hasstatus => false,
require => [ Package['bitcoind'], File['/var/lib/bitcoin/.bitcoin/bitcoin.conf', '/etc/init.d/bitcoind'] ],
}
}
|