2019-08-31 06:47:50 +00:00
nginx
2019-08-15 07:27:57 +00:00
=========
2019-08-31 06:47:50 +00:00
A simple role for installing and configuring nginx on a new Ubuntu host using Ansible. Supports templates for index.html and custom nginx.conf
2019-08-15 07:27:57 +00:00
Requirements
------------
2019-08-31 06:47:50 +00:00
Expects that the host is using apt package manager, and running a Debian / Ubuntu system.
2019-08-15 07:27:57 +00:00
Role Variables
--------------
2019-08-31 06:47:50 +00:00
Found in `.../roles/nginx/defaults/main.yml`
```
---
domain_name: "localhost"
nginx_root_dir: "/var/www/html/"
index_files: "index.html index.htm"
```
2019-08-15 07:27:57 +00:00
2019-08-31 06:47:50 +00:00
NGINX Configuration Variables -
domain_name - Domain name to be used in nginx.conf, default value is the same as nginx base package default setting (localhost)
2019-08-15 07:27:57 +00:00
2019-08-31 06:47:50 +00:00
nginx_root_dir - The directory to point the default nginx server to
index_files - The files / types to be checked for content in our root directory
2019-08-15 07:27:57 +00:00
Example Playbook
----------------
2019-08-31 06:47:50 +00:00
After configuring the approprate variables in `.../defaults/main.yml` , create the following play.yml and run `ansible-playbook play.yml` after setting the correct hosts in your `/etc/ansible/hosts` file.
2019-08-15 07:27:57 +00:00
2019-08-31 06:47:50 +00:00
```
---
- hosts: nginx-server
become: yes
roles:
- nginx
```
2019-08-15 07:27:57 +00:00
2019-08-31 06:47:50 +00:00
Feel free to rename play.yml, hosts group name, etc. Just be sure it reflects to your settings in the related files.
2019-08-15 07:27:57 +00:00