Bitcoin (Core) cookbook #121
@@ -3,7 +3,8 @@ node.default['bitcoin']['checksum'] = '4bbd62fd6acfa5e9864ebf37a24a04bc2dcfe3e3
|
|||||||
node.default['bitcoin']['username'] = 'satoshi'
|
node.default['bitcoin']['username'] = 'satoshi'
|
||||||
node.default['bitcoin']['usergroup'] = 'bitcoin'
|
node.default['bitcoin']['usergroup'] = 'bitcoin'
|
||||||
node.default['bitcoin']['network'] = 'mainnet'
|
node.default['bitcoin']['network'] = 'mainnet'
|
||||||
node.default['bitcoin']['datadir'] = '/mnt/data/bitcoin'
|
node.default['bitcoin']['datadir'] = '/home/satoshi/.bitcoin'
|
||||||
|
node.default['bitcoin']['walletdir'] = '/mnt/data/bitcoin'
|
||||||
|
|
||||||
node.default['bitcoin']['conf'] = {
|
node.default['bitcoin']['conf'] = {
|
||||||
irc: 1,
|
irc: 1,
|
||||||
|
|||||||
@@ -69,10 +69,11 @@ link "/usr/local/bin/bitcoin-cli" do
|
|||||||
to "/usr/local/bitcoind/src/bitcoin-cli"
|
to "/usr/local/bitcoind/src/bitcoin-cli"
|
||||||
end
|
end
|
||||||
|
|
||||||
bitcoin_user = node['bitcoin']['username']
|
bitcoin_user = node['bitcoin']['username']
|
||||||
bitcoin_group = node['bitcoin']['usergroup']
|
bitcoin_group = node['bitcoin']['usergroup']
|
||||||
bitcoin_datadir = node['bitcoin']['datadir']
|
bitcoin_datadir = node['bitcoin']['datadir']
|
||||||
credentials = Chef::EncryptedDataBagItem.load('credentials', 'bitcoin')
|
bitcoin_walletdir = node['bitcoin']['walletdir']
|
||||||
|
credentials = Chef::EncryptedDataBagItem.load('credentials', 'bitcoin')
|
||||||
|
|
||||||
group bitcoin_group
|
group bitcoin_group
|
||||||
|
|
||||||
@@ -82,20 +83,25 @@ user bitcoin_user do
|
|||||||
shell "/bin/bash"
|
shell "/bin/bash"
|
||||||
end
|
end
|
||||||
|
|
||||||
directory bitcoin_datadir do
|
[bitcoin_datadir, bitcoin_walletdir].each do |path|
|
||||||
owner bitcoin_user
|
directory path do
|
||||||
group bitcoin_group
|
owner bitcoin_user
|
||||||
mode '0750'
|
group bitcoin_group
|
||||||
recursive true
|
mode '0750'
|
||||||
action :create
|
recursive true
|
||||||
|
action :create
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
config = node['bitcoin']['conf'].merge({
|
||||||
|
rpcpassword: credentials["rpcpassword"]
|
||||||
|
})
|
||||||
|
|
||||||
template "#{bitcoin_datadir}/bitcoin.conf" do
|
template "#{bitcoin_datadir}/bitcoin.conf" do
|
||||||
owner bitcoin_user
|
owner bitcoin_user
|
||||||
group bitcoin_group
|
group bitcoin_group
|
||||||
mode '0640'
|
mode '0640'
|
||||||
# TODO Create new in data bag and use here
|
variables conf: config,
|
||||||
variables conf: node['bitcoin']['conf'].merge({rpcpassword: credentials["rpcpassword"]}),
|
|
||||||
mainnet_conf: node['bitcoin']['mainnet_conf'],
|
mainnet_conf: node['bitcoin']['mainnet_conf'],
|
||||||
testnet_conf: node['bitcoin']['testnet_conf'],
|
testnet_conf: node['bitcoin']['testnet_conf'],
|
||||||
regtest_conf: node['bitcoin']['regtest_conf']
|
regtest_conf: node['bitcoin']['regtest_conf']
|
||||||
|
|||||||
Reference in New Issue
Block a user