darexsu.nginx

AnsibleロールNginx

CI MoleculeAnsible Role

プラットフォーム

テスト リポジトリ: ディストリビューション リポジトリ: nginx
Debian 11 Nginx 1.18 nginx.org
Debian 10 Nginx 1.14 nginx.org
Ubuntu 20.04 Nginx 1.18-1.20 nginx.org
Ubuntu 18.04 Nginx 1.18-1.20 nginx.org
Oracle Linux 8 Nginx 1.14-1.20 nginx.org
Rocky Linux 8 Nginx 1.14-1.20 nginx.org

インストール

ansible-galaxy install darexsu.nginx --force

マージの動作

辞書を置き換えるかマージします(ansible.cfg の "hash_behaviour=replace" 使用):

# 置き換え            # マージ
---                   ---
  vars:                 vars:
    dict:                 merge:
      a: "value"            dict: 
      b: "value"              a: "value" 
                              b: "value"

# マージはどのように機能するか?
あなたの変数 [host_vars]  -->  デフォルトの変数 [現在のロール] --> デフォルトの変数 [ロールを含む]
  
  dict:          dict:              dict:
    a: "1" -->     a: "1"    -->      a: "1"
                   b: "2"    -->      b: "2"
                                      c: "3"
    
インストールと構成: Nginx(マージバージョン)
---
- hosts: all
  become: true

  vars:
    merge:
      # Nginx
      nginx:
        enabled: true
        repo: "nginx"
      # Nginx -> インストール
      nginx_install:
        enabled: true
      # Nginx -> 設定 -> nginx.conf
      nginx_conf:
        enabled: true
        data:
          user: "www-data"
          worker_processes: "auto"
          error_log: "/var/log/nginx/error.log notice"
          pidfile: "/var/run/nginx.pid"
          worker_connections: "1024"
      #   ...
      # Nginx -> 設定 -> {virtualhost}.conf
      nginx_virtualhost:
        default_conf:
          enabled: true
          file: "default.conf"
          state: "present"
          src: "nginx_virtualhost.j2"
          backup: false
          data:
            listen_port: "80"
            listen_ipv6: false
            server_name: "localhost"
            root: "/usr/share/nginx/html"
            index: "index.html index.htm index.php"
            error_page: ""
            access_log: false
            error_log: false
            tcp_ip_socket:
              enabled: false
              listen: "127.0.0.1:9000"
            unix_socket:
              enabled: true
              file: "php-fpm.sock"
 
  tasks:
    - name: ロール darexsu.nginx を含める
      include_role:
        name: darexsu.nginx

(以下に続く翻訳は、省略しますが、必要であればお知らせください。)

プロジェクトについて

install and configure nginx from distro/third-party

インストール
ansible-galaxy install darexsu.nginx
ライセンス
mit
ダウンロード
2.4k
所有者