client.rb 2.73 KB
Newer Older
Christopher Huhn's avatar
Christopher Huhn committed
1
#
Victor Penso's avatar
Victor Penso committed
2
# Cookbook Name:: cernvm-fs
3
# Recipe:: client
Christopher Huhn's avatar
Christopher Huhn committed
4
#
5
# Copyright 2013-2020 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
Christopher Huhn's avatar
Christopher Huhn committed
6
7
8
9
10
11
12
13
#
# Authors:
#  Matteo Dessalvi <m.dessalvi@gsi.de>
#  Christopher Huhn <C.Huhn@gsi.de>
#  Walter Karig <w.karig@gsi.de>
#  Bastian Neuburger <b.neuburger@gsi.de>
#  Matthias Pausch <m.pausch@gsi.de>
#  Victor Penso <v.penso@gsi.de>
14
15
16
17
18
19
20
21
22
23
24
25
26
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

Victor Penso's avatar
Victor Penso committed
27

m.pausch's avatar
m.pausch committed
28
case node['platform_version']
Victor Penso's avatar
Victor Penso committed
29
when /^7.*/
30
  node.default['sys']['autofs']['maps']['cvmfs'] = {}
Victor Penso's avatar
Victor Penso committed
31
  include_recipe 'sys::autofs'
32
when /^9.*/
Christopher Huhn's avatar
Christopher Huhn committed
33
34
35
  node.default_unless['sys']['autofs']['maps']['cvmfs'] = {
    mapname: '/usr/lib/cvmfs/auto.cvmfs'
  }
36
  include_recipe 'sys::autofs'
Victor Penso's avatar
Victor Penso committed
37
end
38
39
40

# Make sure the CMVFS user can use FUSE 
# to mount a repositories 
41
42
node.default['sys']['fuse']['config']['mount_max'] = 1000
node.default['sys']['fuse']['config']['user_allow_other'] = ''
43
44
45
46
47
48
49
50
include_recipe 'sys::fuse'

user 'cvmfs' do
  shell '/bin/bash'
  system true
end

group 'fuse' do
51
52
  # this should be a system group (ie. gid < 1000)
  system  true
53
  members 'cvmfs'
54
  append  true
55
56
end

57
58
59
execute 'modprobe fuse' do
  not_if 'grep -q "^fuse\>" /proc/modules'
end
b.neuburger's avatar
b.neuburger committed
60

m.pausch's avatar
m.pausch committed
61
directory node['cvmfs']['client']['default_local']['cache_base'] do
62
63
64
65
66
67
68
69
70
  owner 'cvmfs'
  group 'cvmfs'
  mode '0755'
  recursive true
end

template '/etc/cvmfs/default.local' do
  source 'etc_cvmfs_default.local.erb'
  mode "0644"
m.pausch's avatar
m.pausch committed
71
72
73
  variables(
    :repos => node['cvmfs']['client']['config_d'].keys,
    :config => node['cvmfs']['client']['default_local']
74
75
76
77
  )
end


78
79
80
81
82
#
# Domain configs:
#
directory '/etc/cvmfs/domain.d'

83
node['cvmfs']['client']['domain_d'].each do |repo, attrs|
84

85
86
  # node attributes are strings
  config = { 'http_proxy' => 'DIRECT' }
87
  config.merge!(attrs)
88
89
90
91
92
93

  template "/etc/cvmfs/domain.d/#{repo}.conf" do
    source 'etc_cvmfs_config.d_generic.conf.erb'
    mode "0644"
    variables(config: config)
  end
94

95
96
97
98
99
100
101
end


#
# Repository configs
#
directory '/etc/cvmfs/config.d'
102

103
# Each repository needs its configuration file
104
node['cvmfs']['client']['config_d'].each do |repo, attrs|
105

106
107
  # node attributes are strings
  config = { 'http_proxy' => 'DIRECT' }
108
  config.merge!(attrs)
109

110
111
112
113
  template "/etc/cvmfs/config.d/#{repo}.conf" do
    source 'etc_cvmfs_config.d_generic.conf.erb'
    mode "0644"
    variables(config: config)
114
  end
115

116
end