Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
base
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lonlone Lee
base
Commits
019d49f4
Commit
019d49f4
authored
Oct 09, 2015
by
Adam Lewenberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
templatize dnsmasq conf file and remove need for cache_packages.pp
parent
99ebef5f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
11 deletions
+69
-11
manifests/dns.pp
manifests/dns.pp
+1
-1
manifests/dns/cache.pp
manifests/dns/cache.pp
+53
-4
manifests/dns/cache_packages.pp
manifests/dns/cache_packages.pp
+13
-4
templates/dns/etc/dnsmasq.d/stanford-dnscache.conf.erb
templates/dns/etc/dnsmasq.d/stanford-dnscache.conf.erb
+2
-2
No files found.
manifests/dns.pp
View file @
019d49f4
...
...
@@ -25,7 +25,7 @@ class base::dns(
$livermore
=
false
}
if
!
$no_resolv_conf
{
if
(
!
$no_resolv_conf
)
{
base::dns::resolv_conf
{
$::fqdn_lc
:
ensure
=>
present
,
dns_cache
=>
$dns_cache
,
...
...
manifests/dns/cache.pp
View file @
019d49f4
# This class adds a reference to a local DNS caching server.
class
base::dns::cache
inherits
base::dns
{
include
base::dns::cache_packages
#
# NOTE: This class only works with Debian.
#
# $cache_size_entries: the number of entries to cache.
# Default: 10000
# We need daemontools for wheezy servers.
class
base::dns::cache
(
$cache_size_entries
=
10000
)
inherits
base::dns
{
if
(
$::osfamily
!=
'Debian'
)
{
fail
'base::dns::cache_packages only works with Debian'
}
Base
::
Dns
::
Resolv_conf
[
$::fqdn_lc
]
{
dns_cache
=>
true
}
# We use stanford-dnscache for wheezy and dnsmasq for jessie and later.
if
(
$::lsbdistcodename
==
'wheezy'
)
{
# WHEEZY
include
base::daemontools
# Stanford package for DNS caching.
package
{
'stanford-dnscache'
:
ensure
=>
present
,
notify
=>
Exec
[
'chown dnslog:dnslog /var/log/dnscache'
],
}
# This is required because ownership is wrong on reinstall of packages
# but not on initial install.
exec
{
'chown dnslog:dnslog /var/log/dnscache'
:
command
=>
'chown -R dnslog:dnslog /var/log/dnscache'
,
refreshonly
=>
true
,
}
}
else
{
# JESSIE and beyond
package
{
'dnsmasq'
:
ensure
=>
present
,
}
# Call the template for /etc/dnsmasq.d/stanford-dnscache.conf. This
# template uses the $cache_size_entries class parameter.
file
{
'/etc/dnsmasq.d/stanford-dnscache.conf'
:
content
=>
template
(
'base/dns/etc/dnsmasq.d/stanford-dnscache.conf.erb'
),
require
=>
Package
[
'dnsmasq'
],
notify
=>
Service
[
'dnsmasq'
],
}
# Define the service and make sure it runs. Restart the service if
# /etc/resolv.conf changes.
service
{
'dnsmasq'
:
ensure
=>
'running'
,
require
=>
Package
[
'dnsmasq'
],
subscribe
=>
File
[
'/etc/resolv.conf'
],
}
}
Base
::
Dns
::
Resolv_conf
[
$::fqdn_lc
]
{
dns_cache
=>
true
}
}
manifests/dns/cache_packages.pp
View file @
019d49f4
#
This class only works with Debian.
#
REMOVE THIS FILE
class
base::dns::cache_packages
{
# NOTE: This class only works with Debian.
# $cache_size_entries: the number of entries to cache.
# Default: 10000
class
base::dns::cache_packages
(
$cache_size_entries
=
10000
){
if
(
$::osfamily
!=
'Debian'
)
{
fail
'base::dns::cache_packages only works with Debian'
...
...
@@ -27,8 +34,10 @@ class base::dns::cache_packages {
ensure
=>
present
,
}
# Call the template for /etc/dnsmasq.d/stanford-dnscache.conf. This
# template uses the $cache_size_entries class parameter.
file
{
'/etc/dnsmasq.d/stanford-dnscache.conf'
:
source
=>
'puppet:///modules/base/dns/etc/dnsmasq.d/stanford-dnscache.conf'
,
content
=>
template
(
'base/dns/etc/dnsmasq.d/stanford-dnscache.conf'
)
require
=>
Package
[
'dnsmasq'
],
notify
=>
Service
[
'dnsmasq'
],
}
...
...
@@ -41,4 +50,4 @@ class base::dns::cache_packages {
subscribe
=>
File
[
'/etc/resolv.conf'
],
}
}
}
}
files/dns/etc/dnsmasq.d/stanford-dnscache.conf
→
templates/dns/etc/dnsmasq.d/stanford-dnscache.conf.erb
View file @
019d49f4
...
...
@@ -4,5 +4,5 @@ listen-address=127.0.0.1
# really bind only the interfaces it is listening on
bind-interfaces
# Cache up to
10000
addresses
cache
-
size
=
10000
# Cache up to
<%=
@cache_size_entries
%>
addresses
cache-size=
<%=
@cache_size_entries
%>
Write
Preview
Markdown
is supported
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