publicarray.unbound
Ansible-Role-Unbound
Unbound DNSリゾルバー用の高いカスタマイズ性を持つAnsibleロール
- Ansible 2.2以上
- systemdを使った初期化システムと互換性があります。最新のUbuntu/Debian、RHEL/CentOS 6.x、freeBSD
コンテンツ
インストール
$ ansible-galaxy install publicarray.unbound
例と一般的な使用ケース
詳細はウィキをご覧ください: 例
依存関係
Ansible 2.2以上
要件
特になし
ロール変数
このロールのデフォルト変数のリストです。defaults/main.yml
にもあります。以下の変数をgroup_vars/all/configs
ファイルにコピー&ペーストし、unboundのドキュメントを確認することをお勧めします: https://unbound.net/documentation/unbound.conf.html
---
# unboundをソースからコンパイルするか、パッケージマネージャを使用するか。
unbound_compile: false
# ソースをダウンロードするunboundのバージョン <https://nlnetlabs.nl/projects/unbound/download/>
unbound_compile_version: 1.8.0
# ダウンロードファイルと比較するためのチェックサム <https://nlnetlabs.nl/projects/unbound/download/>
unbound_compile_sha256: 78f79d6d3b643fdcd74a14fc76542250da886c82f82bc55b51e189663d61b83f
# `./configure`コマンドに渡す引数
unbound_compile_config: "--enable-dnscrypt --with-username={{unbound.server.username|default(unbound)}} --with-libevent --with-run-dir={{unbound.server.directory}} --with-conf-file={{unbound.server.directory}}/unbound.conf"
# <http://unbound.nlnetlabs.nl/documentation/howto_optimise.html>の最適化ガイドラインを使用するか
unbound_optimise: false
# unboundに使用する物理メモリの割合。`unbound_optimise`がtrueの場合のみ使用。
unbound_optimise_memory: 100
## DNS-over-TLS設定
# 例は<https://github.com/publicarray/ansible-role-unbound/wiki/Examples#dns-over-tls>を参照
# 証明書署名要求のための共通名
unbound_tls_domain: example.com
# 証明書生成方法。selfsignedまたはacmeのいずれかです。
unbound_tls_cert_provider: selfsigned
# 省略: その他の変数設定...
# メインunbound設定
# その他のオプションや詳細については <https://unbound.net/documentation/unbound.conf.html> を参照
unbound:
server:
verbosity: 1
logfile: unbound.log
auto_trust_anchor_file: root.key
root_hints: root.hints
pidfile: "{{_unbound.pidfile|default('unbound.pid')}}"
username: "{{_unbound.user}}"
directory: "{{_unbound.conf_dir if unbound_compile == false else \"/usr/local/etc/unbound\"}}"
chroot: "{{_unbound.conf_dir if unbound_compile == false else \"/usr/local/etc/unbound\"}}"
依存関係
特になし
例のプレイブック
---
- hosts: all
roles:
- { role: publicarray.unbound }
vars:
- unbound_optimise: true
$ ansible-playbook -i dns.example.com, playbook.yml
テスト
moleculeを使用して
Python 2.7とDockerが必要です。
virtualenv --no-setuptools venv
source venv/bin/activate or source venv/bin/activate.fish
pip install docker-py molecule
molecule test # --debug - 詳細出力
deactivate
geerlingguyのスクリプトを使用して
- Dockerをインストールして起動します。
- テストシムを
tests/test.sh
にダウンロードします: -wget -O tests/test.sh https://gist.githubusercontent.com/geerlingguy/73ef1e5ee45d8694570f334be385e181/raw/
- テストシムを実行可能にします:
chmod +x tests/test.sh
. - (ロールのルートディレクトリから)
distro=[distro] playbook=[playbook] ./tests/test.sh
を実行します。 自動的にコンテナを削除したくない場合は、次の環境変数を追加します:cleanup=false container_id=$(date +%s)
テストスクリプトのクレジットは@geerlingguyにあります。
ディストリビューション:
- centos7
- ubuntu1604
- ubuntu1404
- debian9
- debian8
プレイブック: tests
ディレクトリにあります。
test.yml
デフォルト構成をテストcompile-test.yml
unboundのコンパイルをテストpackage-test.yml
dns-over-dnsおよび最適化構成をテスト
バッシュ/シェルの例:
$ distro=debian9 playbook=package-test.yml cleanup=false container_id=$(date +%s) ./tests/test.sh
$ distro=debian9 playbook=compile-test.yml cleanup=false container_id=$(date +%s) ./tests/test.sh
Fishシェルの例:
$ set -x distro debian9; set -x playbook package-test.yml; set -x cleanup false; set -x container_id (date +%s); ./tests/test.sh
$ set -x distro debian9; set -x playbook compile-test.yml; set -x cleanup false; set -x container_id (date +%s); ./tests/test.sh
ライセンス
著者情報
@publicarray
プロジェクトについて
Unbound - Validating, recursive, and caching DNS resolver
インストール
ansible-galaxy install publicarray.unbound
ライセンス
mit
ダウンロード
82