Râu Cao 756382ec9f
Move block data files to CIFS share
This is the vast majority of disk space used on the host currently.
2022-10-26 15:49:03 +02:00

47 lines
1.2 KiB
Ruby

#
# Cookbook:: kosmos-bitcoin
# Recipe:: blocksdir-mount
#
include_recipe 'kosmos-bitcoin::user'
bitcoin_user = node['bitcoin']['username']
bitcoin_group = node['bitcoin']['usergroup']
bitcoin_blocksdir = node['bitcoin']['blocksdir']
credentials = Chef::EncryptedDataBagItem.load('credentials', 'bitcoin')
directory bitcoin_blocksdir do
owner bitcoin_user
group bitcoin_group
mode '0750'
recursive true
action :create
end
case node["bitcoin"]["blocksdir_mount_type"]
when "cifs"
apt_package "cifs-utils"
systemd_unit "mnt-data-blocks.mount" do
content({
Unit: {
Description: 'Bitcoin Core blocks directory',
Requires: 'network-online.target',
After: 'network-online.service'
},
Mount: {
What: credentials["blocksdir_cifs_share"],
Where: bitcoin_blocksdir,
Type: 'cifs',
Options: "user=#{credentials["blocksdir_cifs_user"]},password=#{credentials["blocksdir_cifs_password"]},uid=#{bitcoin_user},gid=#{bitcoin_group},rw,vers=1.0"
},
Install: {
WantedBy: 'multi-user.target'
}
})
verify false
triggers_reload true
action [:create, :enable, :start]
end
end