summaryrefslogtreecommitdiff
path: root/manifests/init.pp
blob: ee1f7192964f4960a7fb603c04b5f0967e71cba9 (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
class bitcoind($daemon_args = '') {
  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',
    require  => User['bitcoin'],
  }

  file { '/etc/init.d/bitcoind':
    ensure  => present,
    owner   => root,
    group   => root,
    mode    => 0755,
    content => template('bitcoind/bitcoind-init.d.sh.erb'),
  }

  service { 'bitcoind':
    enable     => true,
    ensure     => running,
    hasrestart => true,
    hasstatus  => false,
    require    => [ Package['bitcoind'], File['/var/lib/bitcoin', '/etc/init.d/bitcoind'] ],
  }
}