buluma.dns

Ansible 角色 dns

在你的系统上安装和配置 DNS。

GitHub 版本 问题 拉取请求 下载量
github 版本 问题 拉取请求 Ansible 角色

示例剧本

这个示例来自于 molecule/default/converge.yml,并在每次推送、拉取请求和发布时进行测试。

---
- name: Converge
  hosts: all
  become: true
  gather_facts: true

  roles:
    - role: buluma.dns
      dns_port: 5353

机器需要准备好。在 CI 中,这通过 molecule/default/prepare.yml 来完成:

---
- name: Prepare
  hosts: all
  gather_facts: false
  become: true

  roles:
    - role: buluma.bootstrap
    - role: buluma.core_dependencies

也可以查看 完整的解释和示例 来了解如何使用这些角色。

角色变量

这些变量的默认值在 defaults/main.yml 中设置:

---
# dns 的默认文件

# 监听的端口。
dns_port: 53

# DNS 服务器是否应该是一个缓存 DNS 服务器?
dns_caching_dns: true

# 每个区域的区域和属性的列表。
dns_zones:
  - name: localhost
    soa: localhost
    serial: 1
    refresh: 604800
    retry: 86400
    expire: 2419200
    ttl: 604800
    records:
      - name: "@"
        type: NS
        value: localhost.
      - name: "@"
        value: "127.0.0.1"
      - name: "@"
        type: AAAA
        value: "::1"

  - name: "127.in-addr.arpa"
    ttl: 604800
    records:
      - name: "@"
        type: NS
        value: localhost.
      - name: "1.0.0"
        type: PTR
        value: localhost.

  - name: "0.in-addr.arpa"
    records:
      - name: "@"
        type: NS
        value: localhost.

  - name: "255.in-addr.arpa"
    records:
      - name: "@"
        type: NS
        value: localhost.

  - name: example.com
    ttl: 604800
    ns:
      - name: dns1.example.com.
      - name: dns2.example.com.
    mx:
      - name: mail1.example.com.
        priority: 10
      - name: mail2.example.com.
        priority: 20
    records:
      - name: dns1
        value: "127.0.0.1"
      - name: dns2
        value: "127.0.0.1"
      - name: www
        value: "127.0.0.1"
      - name: dns1
        value: "127.0.0.1"
      - name: dns2
        value: "127.0.0.1"
      - name: mail1
        value: "127.0.0.1"
      - name: mail2
        value: "127.0.0.1"

  - name: forwarded.example.com
    type: forward
    dns_zone_forwarders:
      - "1.1.1.1"
      - "8.8.8.8"

# 允许递归的 ACL 列表(可选)。(“any”和“none”总是可用的。)
dns_allow_recursion:
  - none

# DNS 服务器将监听的 IPv4 列表(可选)。(“any”和“none”总是可用的。)
dns_options_listen_on:
  - any

# DNS 服务器将监听的 IPv6 列表(可选)。(“any”和“none”总是可用的。)
dns_options_listen_on_v6:
  - any

# 允许查询服务器的 IP 列表(可选)。(“any”和“none”总是可用的。)
# 默认: "any"
# dns_options_allow_query:
#  - any
#  - "127.0.0.1"

# 允许使用 AXFR 查询的 IP 列表(可选)。("any" 和 "none" 始终可用。)
# 默认: "none"
# dns_options_allow_transfer:
#   - none
#   - "172.16.0.1"

# 配置 pid 文件创建路径的可选设置。
dns_pid_file: /run/named/named.pid

# 将流量转发到其他 DNS 服务器的可选设置。
# dns_options_forwarders:
#   - "1.1.1.1"
#   - "8.8.8.8"

# 另一个例子来自于 @blaisep。
# dns_zones:
#   - name: lab.controlplane.info
#     ttl: 600
#     ns:
#       - name: ns.lab.controlplane.info.
#     mx:
#       - name: mail1.lab.controlplane.info.
#         priority: 10
#       - name: mail2.lab.controlplane.info.
#         priority: 20
#     records:
#       - name: ns
#         value: "192.168.254.27"
#       - name: git
#         value: "192.168.254.19"
#       - name: dl380
#         value: "192.168.254.27"
#       - name: mail1
#         value: "192.168.123.123"
#       - name: mail2
#         value: "192.168.123.123"
#   - name: forwarded.lab.controlplane.info
#     ns:
#       - name: forwarded.lab.controlplane.info.
#     records:
#       - name: ns
#         value: "192.168.254.27"
#       - name: "@"
#         value: "192.168.123.123"
#     dns_zone_forwarders:
#       - "9.9.9.9"
#       - "8.8.8.8"

要求

使用的角色状态

以下角色用于准备系统。你可以以其他方式准备你的系统。

要求 GitHub 版本
buluma.bootstrap Ansible Molecule 版本
buluma.core_dependencies Ansible Molecule 版本

上下文

这个角色是许多兼容角色的一部分。有关更多信息,请查看 这些角色的文档

以下是相关角色的概述:

依赖关系

兼容性

这个角色已在以下 容器镜像 上进行了测试:

容器 标签
Alpine 所有
Amazon 候选
EL 8
Debian 所有
Fedora 所有
Ubuntu 所有

所需的 Ansible 最低版本为 2.12,测试已完成:

  • 之前的版本。
  • 当前版本。
  • 开发版本。

如果发现问题,请在 GitHub 中注册。

更新日志

角色历史

许可证

Apache-2.0

作者信息

Shadow Walker

关于项目

Install and configure dns on your system.

安装
ansible-galaxy install buluma.dns
许可证
apache-2.0
下载
8.9k
拥有者
DevOps Engineer