linux - 使用 puppet 模块 Camptocamp Bind 创建主 DNS 和从 DNS

标签 linux dns puppet

尝试使用 puppet 模块 Camptocamp Bind 创建主从(冗余)DNS。在从配置文件中,我将 transfer_source => '192.168.1.20' 设置为主 IP:192.168.1.20。然后它应该同步 DNS 记录并将其从主服务器复制到从服务器。

但我收到提示说它只能设置为从属区域。我遵循了 puppet forge 的自述文件来获取该模块:https://forge.puppet.com/camptocamp/bind/readme

dnsmaster.pp

class profile::dnsbind::server {

include 'bind'

bind::zone {'example.com':
  ensure       => 'present',
  zone_contact => 'contact.example.com',
  zone_ns      => ['ns0.example.com'],
  zone_serial  => '2012112901',
  zone_ttl     => '604800',
  zone_origin  => 'example.com',
}

bind::a { 'example.com':
  ensure    => 'present',
  zone      => 'example.com',
  ptr       => false,
  hash_data => {
    'host1' => { owner => '192.168.0.1', },
    'host2' => { owner => '192.168.0.2', },
  },
}
}

dnsslave.pp

class profile::dnsbind::server_slave {

include 'bind'

bind::zone {'example.com':
  ensure       => 'present',
  zone_contact => 'contact.example.com',
  zone_ns      => ['ns0.example.com'],
  zone_serial  => '2012112901',
  zone_ttl     => '604800',
  zone_origin  => 'example.com',
  transfer_source => '192.168.1.20', 
}
}

错误消息:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, Zone 'example.com': transfer_source can be set only for slave zones! at /etc/puppetlabs/code/environments/production/modules/bind/manifests/zone.pp:80:5 at /etc/puppetlabs/code/environments/production/manifests/profile_dns2.pp:5 on node centos7-3
    Warning: Not using cache on failed catalog
    Error: Could not retrieve catalog; skipping run

最佳答案

It should then synchronize and copy dns records from master to the slave.

But I got complaints about that it could only be set to slave zones.

显然,该模块无法识别您正在尝试配置从属区域。你认为它怎么知道?嗯,显然不是因为 transfer_source 属性的存在。

I've followed the README from puppet forge for the module: https://forge.puppet.com/camptocamp/bind/readme

我相信您是从自述文件中提取示例区域定义(用于主区域)开始的,并且我承认该模块的文档有点粗制滥造。但无论如何,请考虑真正彻底阅读文档,而不仅仅是浏览它们。如果您这样做了,您将在 transfer_source 参数的文档之后找到 zone_type 参数的文档:

$zone_type = master

Specify if the zone is master/slave/forward.

使用它来指定您正在配置从属区域。

关于linux - 使用 puppet 模块 Camptocamp Bind 创建主 DNS 和从 DNS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51775201/

相关文章:

linux - 如何重命名文件夹中的所有文件并创建重命名映射

linux - 如何模拟管道故障?

url - 从 www 转发到顶级域

windows - Windows 主机文件中的通配符

configuration - 如何使用 Puppet 在 php.ini 中设置 config=value?

mysql - Puppet 无法在 chroot 环境中运行服务

linux - 不使用用户名和密码访问 firebird

java - Java使用的内存多于堆大小(或正确大小的Docker内存限制)

amazon-s3 - 将多个子域映射到同一个 S3 存储桶

ssl - puppet + Apache + SSL