my module bind :
- init.pp :
class bind {
include bind::install
include bind::service
}
-install.pp :
class bind::install (
$packages = $bind::params::server_packages
) inherits bind::params {
package { $packages :
ensure => present,
}
file { "/etc/bind/zones":
ensure => "directory",
owner => "root",
group => "root",
mode => 0755,
}
file { "/etc/bind/named.conf.local":
owner => "root",
group => "root",
mode => 0644,
source => "puppet:///modules/bind/named.conf.local",
}
}
service.pp :
class bind::service (
$service = $bind::params::server_services
) inherits bind::params {
service { $service :
enable => true,
ensure => running,
hasrestart => true,
hasstatus => true,
}
}
params.pp :
class bind::params {
$server_packages = ["bind9"]
$server_services = "bind9"
}
config.pp (the one i use to configure each domain) :
define bind::config ($dns_server = $fqdn,
$domain,
$type_ip = "A",
$ip_serv = '',
$type_ip2 = $type_ip,
$ip_serv2 = $ip_serv,
$sub_domain='',
$mx="false",
$ip_mx1 = "xxx.xxx.xxx.xxx",
$domain_mx1 = $domain,
$type_mx1 = "A",
$ip_mx2 = "xxx.xxx.xxx.xxx",
$domain_mx2 = $domain_mx1,
$type_mx2 = "A",
$ip_ns1 = "xxx.xxx.xxx.xxx",
$type_ns1 = "A",
$ip_ns2 = "xxx.xxx.xxx.xxx",
$type_ns2 = "A",
$ip_ns3 = "xxx.xxx.xxx.xxx",
$type_ns3 = "A",
$www = "true"
){
include bind
file { "/etc/bind/zones/${domain}.db":
content => template("bind/zone.db.erb"),
owner => "root",
group => "root",
mode => 0644,
}
}
And for each domainX_conf.pp :
class conf_bind::bind_domain_fr {
bind::config { "domain.fr":
domain => "domain.fr",
ip_serv => "xxx.xxx.xxx.xxx",
sub_domain => ["domain.fr. IN MX 20 mx2.ovh.net.",
"domain.fr. IN MX 10 mx1.ovh.net.",
"domain.fr. IN MX 100 mxb.ovh.net.",
"domain.fr. IN TXT \"v=spf1
ip4:xxx.xxx.xxx.xxx ip4:xxx.xxx.xxx.xxx -all\"",
"subdomain1 IN A xxx.xxx.xxx.xxx",
"subdomain2 IN A xxx.xxx.xxx.xxx",
"pop3 IN CNAME ns0.ovh.net.",
],
}
}
At the beginning, all the configuration was in the node.pp, but i had too
much ligns so i split all the configuration like that...
"Then in the module's init.pp you would have:
class conf_bind {
include 'conf_bind::bind::domain1_conf'
include 'conf_bind::bind::domain2_conf'
# ...
include 'conf_bind::bind::domain200_conf'
}" ==> it's what i want to avoid :s
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/puppet-users/-/kOvfDx8vZBYJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.