Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
reference-repository
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
grid5000
reference-repository
Commits
e74ae8fc
Commit
e74ae8fc
authored
9 years ago
by
Jérémie Gaidamour
Browse files
Options
Downloads
Patches
Plain Diff
[dev] bindg5k: '-manual.db' + headers
parent
095e6cfd
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dev/puppet/bind.rb
+45
-38
45 additions, 38 deletions
dev/puppet/bind.rb
dev/puppet/templates/bind-global-site.conf.erb
+1
-1
1 addition, 1 deletion
dev/puppet/templates/bind-global-site.conf.erb
dev/puppet/templates/bind-header.erb
+3
-1
3 additions, 1 deletion
dev/puppet/templates/bind-header.erb
with
49 additions
and
40 deletions
dev/puppet/bind.rb
+
45
−
38
View file @
e74ae8fc
...
...
@@ -86,48 +86,48 @@ refapi["sites"].each { |site_uid, site|
entries
=
{}
# #
["networks", "laptops", "dom0"].each { |key|
# #
entries[key] ||= []
[
"networks"
,
"laptops"
,
"dom0"
].
each
{
|
key
|
entries
[
key
]
||=
[]
# #
site[key].each { |uid, node|
# #
if node['network_adapters'].nil?
# #
puts "Warning: no network_adapters for #{uid}"
# #
next
# #
end
# #
eth_net_uid = node['network_adapters'].select{ |u, h| h['mounted'] && /^eth[0-9]$/.match(u) } # eth* interfaces
# #
node['network_adapters'].each { |net_uid, net_hash|
# #
hostsuffix = nil
# #
if ! eth_net_uid.include?(net_uid) && node['network_adapters'].size > 1
# #
hostsuffix = "-#{net_uid}"
# #
end
site
[
key
].
each
{
|
uid
,
node
|
if
node
[
'network_adapters'
].
nil?
puts
"Warning: no network_adapters for
#{
uid
}
"
next
end
eth_net_uid
=
node
[
'network_adapters'
].
select
{
|
u
,
h
|
h
[
'mounted'
]
&&
/^eth[0-9]$/
.
match
(
u
)
}
# eth* interfaces
node
[
'network_adapters'
].
each
{
|
net_uid
,
net_hash
|
hostsuffix
=
nil
if
!
eth_net_uid
.
include?
(
net_uid
)
&&
node
[
'network_adapters'
].
size
>
1
hostsuffix
=
"-
#{
net_uid
}
"
end
# #
new_entry = {
# #
:uid => uid,
# #
:hostsuffix => hostsuffix, # cacahuete vs. cacahuete-eth0
# #
:ip => net_hash['ip'],
# #
}
new_entry
=
{
:uid
=>
uid
,
:hostsuffix
=>
hostsuffix
,
# cacahuete vs. cacahuete-eth0
:ip
=>
net_hash
[
'ip'
],
}
# #
entries[key] << new_entry
# #
}
# #
}
# #
}
entries
[
key
]
<<
new_entry
}
}
}
#
# #
PDUs
# #
entries['pdus'] ||= []
# #
site['pdus'].each { |pdu_uid, pdu|
# #
if pdu['ip']
# PDUs
entries
[
'pdus'
]
||=
[]
site
[
'pdus'
].
each
{
|
pdu_uid
,
pdu
|
if
pdu
[
'ip'
]
# #
new_entry = {
# #
:uid => pdu_uid,
# #
:ip => pdu['ip']
# #
}
new_entry
=
{
:uid
=>
pdu_uid
,
:ip
=>
pdu
[
'ip'
]
}
# #
entries['pdus'] << new_entry
entries
[
'pdus'
]
<<
new_entry
# #
end
# #
}
end
}
site
.
fetch
(
"clusters"
).
sort
.
each
{
|
cluster_uid
,
cluster
|
#next if cluster_uid != 'griffon'
...
...
@@ -228,13 +228,20 @@ refapi["sites"].each { |site_uid, site|
zones_dir
=
Pathname
(
"
#{
$output_dir
}
/modules/bindg5k/files/zones/
#{
site_uid
}
"
)
zones_dir
.
mkpath
()
# DNS (/modules/bindg5k/files/zones/nancy
-clusters
.db)
output_file
=
cluster_file
=
site_uid
+
'-
clusters
.db'
File
.
write
(
zones_dir
+
output_file
,
dns
.
join
(
"
\n
"
))
# DNS (/modules/bindg5k/files/zones/nancy.db)
manual
=
site_uid
+
'-
manual
.db'
dns
.
unshift
(
"$INCLUDE
#{
manual
}
"
)
if
File
.
exist?
(
zones_dir
+
manual
)
# add include statement
# Reverse DNS (/modules/bindg5k/files/zones/reverse-*
db
)
output_file
=
site_uid
+
'.
db
'
header
=
ERB
.
new
(
File
.
read
(
'templates/bind-header.erb'
)).
result
(
binding
)
File
.
write
(
zones_dir
+
output_file
,
header
+
dns
.
join
(
"
\n
"
))
# Reverse DNS (/modules/bindg5k/files/zones/reverse-*db)
reverse
.
each
{
|
output_file
,
output
|
header
=
ERB
.
new
(
File
.
read
(
'templates/bind-header.erb'
)).
result
(
binding
)
# do not move outside of the loop (it uses the output_file variable)
manual
=
output_file
.
sub
(
'.db'
,
''
)
+
'-manual.db'
output
.
unshift
(
"$INCLUDE
#{
manual
}
"
)
if
File
.
exist?
(
zones_dir
+
manual
)
# add include statement
File
.
write
(
zones_dir
+
output_file
,
header
+
output
.
join
(
"
\n
"
))
}
...
...
This diff is collapsed.
Click to expand it.
dev/puppet/templates/bind-global-site.conf.erb
+
1
−
1
View file @
e74ae8fc
...
...
@@ -10,7 +10,7 @@
# List file in the directory instead of using the 'reverse' variable as some files might be set manually
Dir
.
entries
(
zones_dir
).
each
{
|
file
|
next
unless
/.*.db$/
.
match
(
file
)
next
if
file
==
"
#{
site_uid
}
-clusters.db"
# Th
is
file
should b
e included in
<site_uid>.db
next
if
/.*-manual\.db/
.
match
(
file
)
# Th
ose
file
s ar
e included in
the generated version of the file
comment
=
''
zone
=
''
...
...
This diff is collapsed.
Click to expand it.
dev/puppet/templates/bind-header.erb
+
3
−
1
View file @
e74ae8fc
...
...
@@ -6,5 +6,7 @@ $TTL 3h
4w ; expire
1h) ; negative caching
@ IN NS dns.grid5000.fr.
@ IN NS dns.grid5000.fr.
<%
if
output_file
==
"
#{
site_uid
}
.db"
%>
@ IN A
<%=
'172.16.79.101'
%><%
end
%>
@ MX 10 mail.nancy.grid5000.fr.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment