Add README for ansible/roles/nginx

This commit is contained in:
Shaun Reed 2021-05-21 13:22:01 -04:00
parent 51bf18980b
commit eade1bfd94
2 changed files with 47 additions and 10 deletions

View File

@ -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 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 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 Dependencies
------------ ------------
@ -21,11 +36,31 @@ A list of other roles hosted on Galaxy should go here, plus any details in regar
Example Playbook 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 Create a new ansible play. You can name it whatever you want, but this
roles: example play will simply be named `nginx.yml`.
- { role: username.rolename, x: 42 }
```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 License
------- -------
@ -35,4 +70,6 @@ BSD
Author Information 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

View File

@ -13,7 +13,7 @@
<body> <body>
<h1>Klips!</h1> <h1>Klips!</h1>
<p>If you see this page, the nginx web server is successfully installed and <p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p> working. The ansible role has installed and configured nginx successfully. </p>
<p>For online documentation and support please refer to <p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/> <a href="http://nginx.org/">nginx.org</a>.<br/>