Mirror HanXHX/ansible-nginx dari GitHub.
 
 
Go to file
Emilien Mantel 3fdc16578c Improve file deletions 2015-11-30 14:41:35 +01:00
defaults Many minor changes 2015-11-03 14:45:01 +01:00
files/web Moving files 2015-07-15 15:42:32 +02:00
handlers Only reload nginx 2015-11-03 14:38:47 +01:00
meta Many minor changes 2015-11-03 14:45:01 +01:00
tasks Improve file deletions 2015-11-30 14:41:35 +01:00
templates/etc/nginx Many minor changes 2015-11-03 14:45:01 +01:00
tests Deleted vhost don't need a template 2015-11-30 12:16:17 +01:00
vars Fix jessie and add doc 2015-10-09 17:54:07 +02:00
.gitignore Init repo 2015-07-15 12:14:39 +02:00
.travis.yml Test travis docker 2015-10-07 19:31:12 +02:00
LICENSE Initial commit 2015-07-15 12:12:06 +02:00
README.md Deleted vhost don't need a template 2015-11-30 12:16:17 +01:00
Vagrantfile Init repo 2015-07-15 12:14:39 +02:00

README.md

Nginx for Debian Ansible role

Ansible Galaxy Build Status

Install and configure Nginx on Debian.

SSL management will come later.

Requirements

None.

Role Variables

  • nginx_apt_package: APT nginx package (try: apt-cache search ^nginx)
  • nginx_root: root directory where you want to have your files
  • nginx_log_dir: log directory (if you change it, don't forget to change logrotate config)
  • nginx_ssl_dir: directory where you install your SSL/TLS keys
  • nginx_resolver: list of DNS resolver (default: OpenDNS)
  • nginx_error_log_level: default log level
  • nginx_dh_length: DH key length (default is 2048)

PHP

  • nginx_php: boolean if you need to preconfigure PHP (default: false)
  • nginx_php_sockets: list of //sockets//

You should see Nginx upstream module doc.

Socket:

  • unix_socket
  • host
  • port
  • weight
  • max_fails
  • fail_timeout

Nginx Configuration

  • nginx_user
  • nginx_worker_processes
  • nginx_events: key/value in events block
  • nginx_http: key/value in http block
  • nginx_pid: daemon pid file

Vhost management

You can see many examples in: tests/test.yml.

  • nginx_vhosts: List of dict. A vhost has few keys. See bellow.

Common

  • name: (M) Domain or list of domain used.
  • template: (M) template used to create vhost. Optional if you set delete to true.
  • enable: (O) Enable the vhost (default is true)
  • delete: (O) Delete the vhost (default is false)
  • redirect_from: (O) Domain list to redirect to the first name. You can use this key to redirect non-www to www
  • location: (O) Add new custom locations (it does not overwrite!)
  • more: (O) Add more custom infos.
  • upstream_params: (O) Add upstream params (useful when you want to pass variables to PHP)
  • override_try_files: (O) overrides default try_files defined in template
  • manage_local_content: (O) Boolean. Set to false if you don't want to manage local content (images, css...). This option is useless if you use proxy template

(O) : Optional (M) : Mandatory

Templates

  • base: static template
  • dokuwiki
  • phalcon: Phalcon PHP Framework
  • php: PHP base template. Can work with many frameworks/tools
  • php_index: Same as above. But you can only run index.php
  • proxy
  • wordpress

Templates works as parent-child.

About proxy template

Proxy template allow you to use Nginx as reverse proxy. Usefull when you have application serveur such as Redmine, Jenkins...

You have many key added to vhost key:

  • upstream_name: (O) upstream name used to pass proxy
  • proxy_params: (M) list of raw params passed to the vhost

(O) : Optional (M) : Mandatory

Upstream management

  • nginx_upstreams: List of dict. An upstream has few keys. See bellow.

Note: Few params are unavailable on old Nginx version. But this role don't put it if your version is too old!

Upstream params

  • name: upstream name. Can be use in vhost with proxy_pass http://upstream_name
  • params: list of param (hash, zone...)
  • servers: each upstream MUST have at least 1 server

Server params

You must set a path. For example: 192.168.0.50:8080 or unix:/tmp/my.sock.

All this params are optional. You should see Nginx upstream doc.

  • weight
  • maxfails`
  • failtimeout`
  • backup
  • down
  • route
  • slowstart`

Dependencies

None

Example Playbook

- hosts: servers
  roles:
     - { role: HanXHX.nginx }

License

GPLv2

Author Information