Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CHEF
cookbooks
fai
Commits
d978815f
Commit
d978815f
authored
Oct 13, 2017
by
Christopher Huhn
Browse files
Fix Foodcritic complaints
parent
f32b37b8
Changes
6
Hide whitespace changes
Inline
Side-by-side
attributes/default.rb
View file @
d978815f
# lines that will be added to the fai nfsroot's sources.list
default
[
:
fai
][
:
additional_sources
]
=
[
]
default
[
'
fai
'
][
'
additional_sources
'
]
=
[
]
# clients that can connect: empty allows all clients
default_unless
[
:
fai
][
:
clients
]
=
[
]
default_unless
[
'
fai
'
][
'
clients
'
]
=
[
]
# developer machines are allowed to mount from unprivileged ports (nated VMs)
default_unless
[
:
fai
][
:
insecure_clients
]
=
[
]
default_unless
[
'
fai
'
][
'
insecure_clients
'
]
=
[
]
# packages to install into the nfsroots
default
[
:
fai
][
:
common_extra_pkgs
]
=
[
default
[
'
fai
'
][
'
common_extra_pkgs
'
]
=
[
'cryptsetup'
,
'lsb-release'
,
'moreutils'
]
# dir for FAI config
default
[
:
fai
][
:
configdir
]
=
"/srv/fai/config"
default
[
'
fai
'
][
'
configdir
'
]
=
"/srv/fai/config"
# dir for FAI config
default
[
:
fai
][
'nfsroot-hooks'
]
=
"/etc/fai/nfsroot-hooks"
default
[
'
fai
'
][
'nfsroot-hooks'
]
=
"/etc/fai/nfsroot-hooks"
# alternative location to pull the config
default
[
:
fai
][
:
config_source
]
=
nil
default
[
'
fai
'
][
'
config_source
'
]
=
nil
# Debian repository for nfsroot creation
default
[
:
fai
][
:
debmirror_url
]
=
"ftp://ftp.de.debian.org/debian"
default
[
'
fai
'
][
'
debmirror_url
'
]
=
"ftp://ftp.de.debian.org/debian"
# recommended packages should be installed:
default_unless
[
:
fai
][
:
install_recommends
]
=
true
default_unless
[
'
fai
'
][
'
install_recommends
'
]
=
true
# while suggested packages should not:
default_unless
[
:
fai
][
:
install_suggests
]
=
false
default_unless
[
'
fai
'
][
'
install_suggests
'
]
=
false
# root password
default
[
:
fai
][
:
root_pw_hash
]
=
'$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1'
# "fai"
default
[
'
fai
'
][
'
root_pw_hash
'
]
=
'$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1'
# "fai"
# install the sample config:
default
[
:
fai
][
:
setup_default
]
=
false
default
[
'
fai
'
][
'
setup_default
'
]
=
false
# set this to false to keep the FAI cookbook from
# creating and updating nfsroots:
...
...
@@ -42,4 +42,4 @@ default_unless['fai']['handle_nfsroots'] = true
# this value will be set by the Debian ohai plugin from sys cookbook
# as a default we will define it as empty
default
[
:
debian
][
:
packages
][
'fai-server'
][
:
version
]
=
''
default
[
'
debian
'
][
'
packages
'
][
'fai-server'
][
'
version
'
]
=
''
metadata.rb
View file @
d978815f
...
...
@@ -4,5 +4,8 @@ maintainer_email "hpc@gsi.de"
license
"All rights reserved"
description
"Installs/Configures fai"
long_description
IO
.
read
(
File
.
join
(
File
.
dirname
(
__FILE__
),
'README.md'
))
version
"0.8.
3
"
version
"0.8.
4
"
depends
"nfs"
source_url
'https://git.gsi.de/chef/cookbooks/fai'
issues_url
'https://git.gsi.de/chef/cookbooks/fai/issues'
recipes/default.rb
View file @
d978815f
...
...
@@ -21,10 +21,10 @@ ohai 'Dpkg' do
end
# fallback to admit access to everybody if not specified
node
.
default
[
:
fai
][
:
clients
]
=
[
"*"
]
if
node
[
:
fai
][
:
clients
].
empty?
node
.
default
[
'
fai
'
][
'
clients
'
]
=
[
"*"
]
if
node
[
'
fai
'
][
'
clients
'
].
empty?
if
node
.
fai
.
configdir
directory
node
.
fai
.
configdir
do
if
node
[
'
fai
'
][
'
configdir
'
]
directory
node
[
'
fai
'
][
'
configdir
'
]
do
recursive
true
owner
'root'
group
'root'
...
...
@@ -33,7 +33,7 @@ if node.fai.configdir
# TODO: fill from version control or sample scripts
end
node
[
:
fai
][
:
clients
].
each
do
|
client
|
node
[
'
fai
'
][
'
clients
'
].
each
do
|
client
|
nfs_export
'/srv/fai/config'
do
network
client
writeable
false
...
...
@@ -42,7 +42,7 @@ if node.fai.configdir
end
end
node
[
:
fai
][
:
insecure_clients
].
each
do
|
insecure_client
|
node
[
'
fai
'
][
'
insecure_clients
'
].
each
do
|
insecure_client
|
nfs_export
'/srv/fai/config'
do
network
insecure_client
writeable
false
...
...
@@ -78,12 +78,12 @@ template "/etc/fai/#{nfsroot_config}" do
source
"make-fai-nfsroot.conf.erb"
variables
({
:config_src
=>
fai_config_source
,
:codename
=>
node
.
lsb
.
codename
,
:debmirror_url
=>
node
.
fai
.
debmirror_url
,
:codename
=>
node
[
'
lsb
'
][
'
codename
'
]
,
:debmirror_url
=>
node
[
'
fai
'
][
'
debmirror_url
'
]
,
:nfsdir
=>
"/srv/fai/nfsroot"
,
# install kernel into a flavor specific subdir for distinction:
:tftpdir
=>
"/srv/tftp/
#{
node
[
:
lsb
][
:
codename
]
}
/
#{
node
[
:
debian
][
:
architecture
]
}
"
+
"/fai
#{
node
[
:
debian
][
:
packages
][
'fai-server'
][
:
version
]
}
/"
,
:tftpdir
=>
"/srv/tftp/
#{
node
[
'
lsb
'
][
'
codename
'
]
}
/
#{
node
[
'
debian
'
][
'
architecture
'
]
}
"
+
"/fai
#{
node
[
'
debian
'
][
'
packages
'
][
'fai-server'
][
'
version
'
]
}
/"
,
:arch
=>
""
,
:hookdir
=>
node
[
'fai'
][
'nfsroot-hooks'
]
})
...
...
@@ -93,11 +93,11 @@ end
template
"/etc/fai/apt/sources.list"
do
source
"fai_sources.list.erb"
mode
0644
variables
(
{
:codename
=>
node
.
lsb
.
codename
,
:debmirror_url
=>
node
[
:
fai
][
:
debmirror_url
],
:additional_sources
=>
node
.
fai
.
additional_sources
}
)
variables
(
:codename
=>
node
[
'
lsb
'
][
'
codename
'
]
,
:debmirror_url
=>
node
[
'
fai
'
][
'
debmirror_url
'
],
:additional_sources
=>
node
[
'
fai
'
][
'
additional_sources
'
]
)
end
template
"/etc/fai/apt/apt.conf"
do
...
...
@@ -137,7 +137,7 @@ end
# build nfsroot(s),
# copy demo config from package fai-doc,
# send kernels and initrds to the TFTP server
if
node
.
fai
.
setup_default
if
node
[
'
fai
'
][
'
setup_default
'
]
package
"fai-doc"
...
...
@@ -155,7 +155,7 @@ if node.fai.setup_default
end
end
node
[
:
fai
][
:
clients
].
each
do
|
client
|
node
[
'
fai
'
][
'
clients
'
].
each
do
|
client
|
nfs_export
'/srv/fai/nfsroot'
do
network
client
writeable
false
...
...
@@ -164,7 +164,7 @@ node[:fai][:clients].each do |client|
end
end
node
[
:
fai
][
:
insecure_clients
].
each
do
|
insecure_client
|
node
[
'
fai
'
][
'
insecure_clients
'
].
each
do
|
insecure_client
|
nfs_export
'/srv/fai/nfsroot'
do
network
insecure_client
writeable
false
...
...
recipes/flavors.rb
View file @
d978815f
...
...
@@ -18,13 +18,13 @@ nfsroot_cmd = 'fai-make-nfsroot'
# If fai.config_source is not set, fall back to a default nfs URL
unless
node
[
'fai'
][
'config_source'
]
==
nil
fai_config_source
=
"nfs://
#{
node
.
ipaddress
}
:
#{
node
.
fai
.
configdir
}
"
fai_config_source
=
"nfs://
#{
node
[
'
ipaddress
'
]
}
:
#{
node
[
'
fai
'
][
'
configdir
'
]
}
"
else
fai_config_source
=
node
[
'fai'
][
'config_source'
]
end
node
.
fai
.
flavors
.
each
do
|
f
,
config
|
node
[
'
fai
'
][
'
flavors
'
]
.
each
do
|
f
,
config
|
configdir
=
"/etc/fai/flavors/
#{
f
}
"
...
...
@@ -34,7 +34,7 @@ node.fai.flavors.each do |f, config|
nfs_dir
=
"/srv/fai/nfsroot-
#{
f
}
"
directory
"
#{
configdir
}
"
do
directory
configdir
do
action
:create
end
...
...
@@ -54,7 +54,7 @@ node.fai.flavors.each do |f, config|
tftpdir
=
config
[
'tftpdir'
]
else
tftpdir
=
"/srv/tftp/
#{
codename
}
/
#{
arch
}
"
+
"/fai
#{
node
[
:
debian
][
:
packages
][
'fai-server'
][
:
version
]
}
/"
"/fai
#{
node
[
'
debian
'
][
'
packages
'
][
'fai-server'
][
'
version
'
]
}
/"
end
directory
tftpdir
do
...
...
@@ -66,7 +66,7 @@ node.fai.flavors.each do |f, config|
variables
({
:config_src
=>
fai_config_source
,
:codename
=>
codename
,
:debmirror_url
=>
config
[
'debmirror_url'
]
||
node
[
:
fai
][
:
debmirror_url
],
:debmirror_url
=>
config
[
'debmirror_url'
]
||
node
[
'
fai
'
][
'
debmirror_url
'
],
:nfsdir
=>
nfs_dir
,
# install kernel into a flavor specific subdir for distinction:
:tftpdir
=>
tftpdir
,
...
...
@@ -81,7 +81,7 @@ node.fai.flavors.each do |f, config|
source
"fai_sources.list.erb"
variables
({
:codename
=>
codename
,
:debmirror_url
=>
config
[
'debmirror_url'
]
||
node
[
:
fai
][
:
debmirror_url
],
:debmirror_url
=>
config
[
'debmirror_url'
]
||
node
[
'
fai
'
][
'
debmirror_url
'
],
:additional_sources
=>
config
[
'additional_sources'
]
||
[]
})
mode
0644
...
...
@@ -101,7 +101,7 @@ node.fai.flavors.each do |f, config|
end
pkgs
=
config
[
'pkgs'
]
||
[
]
pkgs
+=
node
.
fai
.
common_extra_pkgs
pkgs
+=
node
[
'
fai
'
][
'
common_extra_pkgs
'
]
template
"
#{
configdir
}
/NFSROOT"
do
source
"NFSROOT.erb"
...
...
@@ -128,7 +128,7 @@ node.fai.flavors.each do |f, config|
only_if
{
node
[
'fai'
][
'handle_nfsroots'
]
}
end
node
[
:
fai
][
:
clients
].
each
do
|
client
|
node
[
'
fai
'
][
'
clients
'
].
each
do
|
client
|
nfs_export
nfs_dir
do
network
client
writeable
false
...
...
recipes/gsi_nfsroots.rb
View file @
d978815f
# coding: iso-8859-15
# support for installing GSI nfsroots
# install davfs package into nfsroot
node
[
:
fai
][
:
common_extra_pkgs
]
<<
"davfs2"
node
.
default
[
'
fai
'
][
'
common_extra_pkgs
'
]
<<
"davfs2"
# now include the default recipe:
...
...
templates/default/make-fai-nfsroot.conf.erb
View file @
d978815f
...
...
@@ -2,7 +2,7 @@
NFSROOT=
<%=
@nfsdir
%>
TFTPROOT=
<%=
@tftpdir
||
'/srv/tftp/fai'
%>
<%=
"FAI_CONFIGDIR=
#{
@config_src
}
"
if
@config_src
%>
NFSROOT_ETC_HOSTS="
<%=
node
[
:
ipaddress
]
%>
<%=
node
[
:
fqdn
]
%>
"
NFSROOT_ETC_HOSTS="
<%=
node
[
'
ipaddress
'
]
%>
<%=
node
[
'
fqdn
'
]
%>
"
FAI_DEBOOTSTRAP="
<%=
"
#{
@codename
}
#{
@debmirror_url
}
"
%>
"
<%
if
node
.
fai
.
root_pw_hash
%>
FAI_ROOTPW='
<%=
node
.
fai
.
root_pw_hash
%>
'
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment