---
- name: Test nginx
  hosts: vm-akazantsev
  roles:
    - nginx
  vars:
    nginx_selinux: false
    pki_dir: /etc/nginx/certs
    nginx_webroot: /var/www
    local_http_port: 8080
    nginx_letsencrypt_managed: true
    letsencrypt_acme_install: true
    letsencrypt_acme_certs_dir: /etc/letsencrypt/live
    nginx_conf_snippets:
      - nginx-compression.conf
      - nginx-proxy-params.conf
      - nginx-server-ssl.conf
    #     - nginx-websockets.conf
    #     - nginx-browser-cache.conf
    #     - letsencrypt-proxy.conf
    #     - nginx-cors.conf

    nginx_streams:
      - stream: mysql_proxy
        listen_port: 3306
        protocol: tcp
        backends:
          - 10.0.0.10:3306
          - 10.0.0.11:3306
      - stream: dns_proxy
        listen_port: 53
        protocol: udp
        timeout: 1s
        connect_timeout: 1s
        backends:
          - 8.8.8.8:53

    nginx_virthosts:
      - virthost_name: gigacoms.ru
        listen: "80"
        server_name: gigacoms.ru
        server_aliases: "www.gigacoms.ru"
        index: index.html
        # error_page: /path_to_error_page.html
        ssl_enabled: true
        ssl_only: true
        ssl_letsencrypt_certs: "{{ nginx_letsencrypt_managed }}"
        root: "{{ nginx_webroot }}"
        server_tokens: "off"
        proxy_standard_setup: true
        proxy_additional_options:
          - proxy_cache_path /tmp/nginx_cache levels=1:2 keys_zone=cache:30m max_size=250m;
        locations:
          - location: /
            target: http://localhost:{{ local_http_port }}
