artem_shestakov.nginx
Ansible Nginxロール
=========
Debian/Red Hat OSファミリーにNginxをインストールするためのAnsibleロールです。
要件
特になし
変数
このロールでは、3種類の変数を使用します。最初の2つはインストールの種類に依存し、3つ目はインストールの種類に関係なく一般的な変数です。
一般的な変数
- install_from - Nginxのインストールタイプ。[source | repo]。デフォルト:
repo
- nginx_http_add - Nginxの設定ファイルのhttpセクションに追加される追加パラメータのリスト。デフォルト: []
- nginx_stream_add - Nginxの設定ファイルのstreamセクションに追加される追加パラメータのリスト。デフォルト: []
- ssl_cert_path - Nginxで使用されるSSL証明書のディレクトリ。デフォルト:
\etc\nginx\ssl
ウェブサーバー
- nginx_virtual_servers - 仮想サーバーのリスト。デフォルト: []
- listen - サーバーがリクエストを受け取るIPアドレスとポート(またはUnixドメインソケットとパス)を指定します。
- server_name - 仮想サーバーの名前のリスト
- locations - locationのリスト
- location - リクエストURIに依存する設定
- params - locationのパラメータを設定します。例えば
proxy_pass
、return
、rewrite
など。
TCPおよびUDPロードバランシング
- tcp_udp_nlb - TCPおよびUDPのロードバランシング用のバックエンドサーバーの辞書のリスト
- name - アップストリームの名前
- listen - nginxプロキシでの受信トラフィック用のポート
- servers - バックエンドサーバーのリスト
- stub_status - trueの場合、ngx_http_stub_status_moduleを使用してNginxの監視ツールを設定します。デフォルト:
false
- stub_status_settings - stub_statusの設定を持つ辞書
- listen - サーバーがリクエストを受け取るためのIPアドレスやポート、またはUNIXドメインソケットのパスを設定します。デフォルト:
127.0.0.1:80
- server_name - 仮想サーバーの名前を設定します。デフォルト:
127.0.0.1
- location - リクエストURIに依存する設定を設定します。デフォルト:
/nginx_status
- listen - サーバーがリクエストを受け取るためのIPアドレスやポート、またはUNIXドメインソケットのパスを設定します。デフォルト:
SSL
- proxy_ssl - プロキシサーバーへの接続でSSL/TLSプロトコルを有効にします。
- proxy_ssl_certificate - プロキシHTTPSサーバーへの認証に使用するPEM形式の証明書が含まれるファイルを指定します。
- proxy_ssl_certificate_key - プロキシHTTPSサーバーへの認証に使用するPEM形式の秘密鍵が含まれるファイルを指定します。
- proxy_ssl_ciphers - プロキシサーバーへの接続で有効な暗号スイートを指定します。暗号スイートはOpenSSLライブラリが理解できる形式で指定します。
- ssl_certificate - 指定した仮想サーバー用のPEM形式の秘密鍵が含まれるファイルを指定します。
- ssl_certificate_key - プロキシサーバーへの認証に使用するPEM形式の秘密鍵が含まれるファイルを指定します。
リポジトリからのインストール変数
ソースからのインストール変数
- nginx_with_modules - デフォルト以外のNginxモジュールのリスト。モジュールのリストはこちらにあります。デフォルト: []
例のプレイブック
---
- name: Nginxアプリをインストール
hosts: all
remote_user: vagrant
become: true
roles:
- artem_shestakov.nginx
vars:
- install_from: source
- nginx_with_modules:
- --with-file-aio
- --with-ipv6
- --with-http_ssl_module
- --with-http_v2_module
- --with-http_realip_module
- --with-http_addition_module
- --with-http_xslt_module=dynamic
- --with-http_image_filter_module=dynamic
- --with-http_sub_module
- --with-http_dav_module
- --with-http_flv_module
- --with-http_mp4_module
- --with-http_gunzip_module
- --with-http_gzip_static_module
- --with-http_random_index_module
- --with-http_secure_link_module
- --with-http_degradation_module
- --with-http_slice_module
- --with-http_stub_status_module
- --with-http_perl_module=dynamic
- --with-http_auth_request_module
- --with-mail=dynamic
- --with-mail_ssl_module
- --with-stream=dynamic
- --with-stream_ssl_module
- --with-debug
- tcp_udp_nlb:
- name: example
listen:
- 192.168.1.1:443
- 192.168.1.2:443
servers:
- 10.79.1.196:443
- name: example2
listen:
- 10002
servers:
- 10.79.1.203:5601
Nginxサーバーに証明書をコピーする
- 証明書をディレクトリに置きます。
- 変数を設定します。
- copy_ssl_certs - 証明書をローカルマシンからリモートNginxサーバーにコピーする必要がある場合はtrue。
- user_certs_path - Nginxにコピーする必要があるSSL証明書のディレクトリリスト。デフォルト: ['./files/ssl/*']
ライセンス
BSD, MIT
著者情報
Artem Shestakov (artem.s.shestakov@gmail.com)