manala.bind

#######################################################################################################

:exclamation: 废弃通知 :exclamation:

本仓库及其相关角色已被废弃,推荐使用 Manala Ansible Collection

您可以在 集合仓库 中找到相关使用信息

#######################################################################################################

Ansible 角色:Bind 构建状态

:exclamation: 请在 主 Ansible 角色仓库报告问题提交拉取请求 :exclamation:

该角色用于配置 Bind

它是 Manala Ansible stack 的一部分,但也可以作为独立组件使用。

要求

无。

依赖

无。

安装

Ansible 2+

使用 ansible galaxy 命令行工具:

ansible-galaxy install manala.bind

使用 ansible galaxy 需求文件:

- src: manala.bind

角色过滤器

名称 描述
manala_bind_zone_file 规范化区域文件名称

角色变量

名称 默认值 类型 描述
manala_bind_install_packages ~ 数组 需要安装的依赖包
manala_bind_install_packages_default ['bind9'] 数组 默认需要安装的依赖包
manala_bind_user 'bind' 字符串 用户
manala_bind_group 'bind' 字符串
manala_bind_options ['-u {{ manala_bind_user }}'] 数组 选项
manala_bind_log_dir '/var/log/bind' 字符串 日志目录
manala_bind_configs [] 数组 配置文件列表
manala_bind_configs_dir '/etc/bind' 字符串 配置文件目录
manala_bind_zones_dir '/var/cache/bind' 字符串 区域文件目录
manala_bind_zones [] 数组 区域文件列表

配置示例

选项

请参见: https://linux.die.net/man/8/named

manala_bind_options:
  - -u {{ manala_bind_user }}
  - -4 # 仅 IPv4

配置

file 路径相对于 manala_bind_configs_dir 参数。

配置内容可以作为 jinja2 模板 或原始 内容 指定。

配置项还支持 state (present|absent) 和 omit (false|true) 参数。

manala_bind_configs:
  - file: named.conf.options
    template: bind/configs/named.conf.options.j2
  - file: named.conf.local
    content: |
      // 如果在您的组织中未使用,请考虑将 1918 区域添加到此处
      include "{{ manala_bind_configs_dir }}/zones.rfc1918";
  - file: named.conf.foo
    state: absent
  - file: named.conf.bar
    omit: true

区域 - 静态

参数 zonefile 至少需要一个。如果不定义,file 参数将根据 zone 计算。

file 路径相对于 manala_bind_zones_dir 参数。

配置内容可以作为 jinja2 模板 或原始 内容 指定。

配置项还支持 state (present|absent) 和 omit (false|true) 参数。

manala_bind_zones:
  - zone: foo.local
    template: bind/zones/db.foo.local.j2
  - zone: bar.local
    content: |
      @  IN SOA ns.bar.local. contact.bar.local. (
                  1       ; 序列号
                  604800  ; 刷新 (1 周)
                  86400   ; 重试 (1 天)
                  2419200 ; 过期 (4 周)
                  86400   ; 最小 (1 天)
                  )
      @  IN NS  ns.bar.local.
      ns IN A   172.16.1.1";
  - zone: baz.local
    state: absent
  - zone: qux.local
    omit: true

区域 - 动态

zone 参数为必填项,dynamic 参数必须设置为 true。

区域配置必须允许从 (至少) localhost 更新。

考虑到区域文件的动态特性,只有在文件尚不存在时,contenttemplate 参数才会被考虑。这可以看作是区的初始化。

manala_bind_configs:
  - file: named.conf.local
    content: |
      zone "foo.local" {
          type master;
          file "{{ 'foo.local'|manala_bind_zone_file }}";
          allow-update { localhost; };
      };

manala_bind_zones:
  - zone: foo.local
    dynamic: true
    content: |
      @  IN SOA ns.foo.local. contact.foo.local. (
                  1       ; 序列号
                  604800  ; 刷新 (1 周)
                  86400   ; 重试 (1 天)
                  2419200 ; 过期 (4 周)
                  86400   ; 最小 (1 天)
                  )
      @  IN NS  ns.foo.local.
      ns IN A   172.16.1.1";
    records:
      - { record: bar, value: 172.16.1.123 }

示例播放册

- hosts: servers
  roles:
    - { role: manala.bind }

许可证

MIT

作者信息

Manala (http://www.manala.io/)

关于项目

Handle bind

安装
ansible-galaxy install manala.bind
许可证
Unknown
下载
47.7k
拥有者
Manala is an open source project supported by the french web agency ELAO providing advanced ansible roles for website's infrastructures and far more.