From eade1bfd940eb8a46ee37b856f27463541e4af01 Mon Sep 17 00:00:00 2001
From: Shaun Reed
Date: Fri, 21 May 2021 13:22:01 -0400
Subject: [PATCH] Add README for ansible/roles/nginx
---
ansible/roles/nginx/README.md | 55 ++++++++++++++++++----
ansible/roles/nginx/files/nginx/index.html | 2 +-
2 files changed, 47 insertions(+), 10 deletions(-)
diff --git a/ansible/roles/nginx/README.md b/ansible/roles/nginx/README.md
index 225dd44..7457586 100644
--- a/ansible/roles/nginx/README.md
+++ b/ansible/roles/nginx/README.md
@@ -1,17 +1,32 @@
-Role Name
+NGINX
=========
-A brief description of the role goes here.
+A role to install nginx and start a default webserver on a remote host.
Requirements
------------
-Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
+None
Role Variables
--------------
-A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
+`packages: [nginx]`
+ * A list of packages to install. Feel free to add more here if needed,
+ separated by commas - `package: [nginx, apache2]`
+
+
+`domain_name: "localhost"`
+ * The domain name to use within `nginx.conf` configurations.
+ If you do not own a domain name, use localhost or your public IP here.
+
+
+`nginx_root_dir: "/var/www/html/"`
+ * Used in `nginx.conf to define the root directory of content
+ to be served on the nginx webserver.
+
+`index_files: "index.html index.htm"`
+ * Used in `nginx.conf` to define index files
Dependencies
------------
@@ -21,11 +36,31 @@ A list of other roles hosted on Galaxy should go here, plus any details in regar
Example Playbook
----------------
-Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
+First, make sure all settings within `defaults/main.yml` are correct for your
+server. All settings and their purposes are outline in the section above.
- - hosts: servers
- roles:
- - { role: username.rolename, x: 42 }
+Create a new ansible play. You can name it whatever you want, but this
+example play will simply be named `nginx.yml`.
+
+```yml
+---
+- hosts: testserver
+ become: yes
+ roles:
+ - nginx
+```
+
+Make sure the IP for `testserver` is correct in the `/etc/ansible/hosts` file -
+```
+[testserver]
+123.123.123.123:22
+```
+
+Run the play!
+
+```bash
+ansible-playbook nginx.yml
+```
License
-------
@@ -35,4 +70,6 @@ BSD
Author Information
------------------
-An optional section for the role authors to include contact information, or a website (HTML is not allowed).
+Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0
+
+TODO: Add optional task for configuring SSL
diff --git a/ansible/roles/nginx/files/nginx/index.html b/ansible/roles/nginx/files/nginx/index.html
index b0d878e..bc8964e 100644
--- a/ansible/roles/nginx/files/nginx/index.html
+++ b/ansible/roles/nginx/files/nginx/index.html
@@ -13,7 +13,7 @@
Klips!
If you see this page, the nginx web server is successfully installed and
-working. Further configuration is required.
+working. The ansible role has installed and configured nginx successfully.
For online documentation and support please refer to
nginx.org.