Skip to content

bpetit/Stouts.nginx

 
 

Repository files navigation

Stouts.nginx

Build Status

Ansible role which simple manage nginx

  • Install and upgrade;
  • Provide hanlers for restart and reload;
  • Support simple site configurations.

Variables

nginx_enabled: yes                  # The role in enabled
nginx_dir: /etc/nginx               # Nginx config directory
nginx_sites_dir: "{{nginx_dir}}/sites-enabled" # Nginx include directory
nginx_default_site: "{{nginx_sites_dir}}/default"
nginx_delete_default_site: no
nginx_user: www-data                # -------------------
nginx_worker_processes: 4           #   See nginx docs
nginx_worker_connections: 1024      # -------------------
nginx_sendfile: yes
nginx_keepalive_timeout: 65
nginx_gzip: yes
nginx_server_names_hash_bucket_size: 128
nginx_access_log: /var/log/nginx/access.log
nginx_error_log: /var/log/nginx/error.log
nginx_http_options:                 # Additional http options (each line will be added as is)
                                    # Ex: nginx_http_options:
                                    #       - auth_basic "You shall not pass!";
                                    #       - auth_basic_user_file {{nginx_auth_file}};

nginx_servers:                      # Setup servers (simplest interface, use cfg files for large configurations)
                                    # Ex: nginx_servers:
                                    #     - |
                                    #       listen 80;
                                    #       server_name localhost;
                                    #       location / { root html; index index.html; }
                                    #     - |
                                    #       listen 80;
                                    #       server_name test.com;
                                    #       location / { root /test; index index.html; }
nginx_templatized_vhosts:           # Setup vhosts files (one domain name per configuration file)
                                    # by specifying source template path
                                    # Ex: nginx_templatized_vhosts:
                                    #       - { "name": "example.com", "template": "templates/my_vhost.j2" }

nginx_auth_file: "{{nginx_dir}}/.htpasswd" # Where stored passwords
nginx_auth_users: []                # Setup users for http authentication
                                    # nginx_auth_users:
                                    #   - { name: team, password: secret }

nginx_status: 127.0.0.1             # Report about nginx state by IP. Set empty for disable.
nginx_apt_use_ppa_repo: yes         # Use of nginx PPA repo

Usage

Add Stouts.nginx to your roles and set vars in your playbook file.

Example:

- hosts: all

  roles:
    - Stouts.nginx

  vars:
    nginx_servers:
    - |
      listen 80;
      server_name google.com;
      location / { root /var/www/google; index index.html; }

License

Licensed under the MIT License. See the LICENSE file for details.

Feedback, bug-reports, requests, ...

Are welcome!

If you wish to express your appreciation for the role, you are welcome to send a postcard to the original author:

Kirill Klenov
pos. Severny 8-3
MO, Istra, 143500
Russia

Or, if it is about this fork:

Benoit Petit <[email protected]>

About

Ansible role which simple manage nginx

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 76.7%
  • Makefile 23.3%