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'], } $enable = $ensure ? { 'running' => true, default => false, } service { 'bitcoind': enable => $enable, ensure => $ensure, hasrestart => true, hasstatus => false, pattern => '/usr/lib/bitcoin/bitcoind', require => [ Package['bitcoind'], File['/var/lib/bitcoin/.bitcoin/bitcoin.conf', '/etc/init.d/bitcoind'] ], } }