dns-ops/global/overlay/etc/puppet/modules/dns/manifests/knotdns.pp

35 lines
1.1 KiB
Puppet

class dns::knotdns(
$knotdnsrepo = "ppa:cz.nic-labs/knot-dns-latest"
$knotrestrepo = "ppa:pettai/knot-rest"
$knotrestversion = "0.0.2-1"
){
# This is a control file used to skip these semi-heavy installation steps
$control_file="/var/cache/cosmos/knotdns_install_complete.txt"
exec {"Add KnotDNS repo":
command => "add-apt-repository $knotdnsrepo && apt-get update",
unless => "test -f $control_file",
} ->
exec {"Add KnotREST repository":
command => "add-apt-repository $knotrestrepo && apt-get update",
unless => "test -f $control_file",
}
# Install the package stuff
exec {"Install KnotDNS + KnotREST":
command => "apt-get install -fy knot python3-knot-rest=$knotrestversion && touch $control_file",
}
# Install KnotDNS configuration
file { "/etc/knot/knot.conf":
ensure => "file",
content => template("dns/knot/knot.conf.erb")
}
# Install KnotREST configuration
file { "/etc/knot_rest/knot_rest.yaml":
ensure => "file",
content => template("dns/knot/knot_rest.yaml.erb")
}
}