Skip to content

Commit

Permalink
Merge pull request #1 from clouddrove/ops
Browse files Browse the repository at this point in the history
Ops
  • Loading branch information
Nikita Dugar committed Aug 30, 2019
2 parents a309021 + 201669b commit 33df45e
Show file tree
Hide file tree
Showing 22 changed files with 514 additions and 48 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ignored files
.idea
*.iml
*.zip
molecule
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v2.2.3
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: mixed-line-ending
- id: check-byte-order-marker
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: debug-statements
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/ansible/ansible-lint.git
rev: v4.1.0
hooks:
- id: ansible-lint
files: \.(yaml|yml)$
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Cloud Drove

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export GENIE_PATH ?= $(shell 'pwd')/../../../genie

include $(GENIE_PATH)/Makefile
133 changes: 132 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,132 @@
# ansible-role-docker-nginx
<!-- This file was automatically generated by the `geine`. Make all changes to `README.yaml` and run `make readme` to rebuild this file. -->


<p align="center"> <img src="https://user-images.githubusercontent.com/50652676/62451340-ba925480-b78b-11e9-99f0-13a8a9cc0afa.png" width="100" height="100"></p>

<h1 align="center">
Ansible Role Docker Nginx
</h1>

<p align="center" style="font-size: 1.2rem;">
This ansible role is used to install Nginx Server with docker on linux.
</p>

<p align="center">

<a href="https://www.ansible.com">
<img src="https://img.shields.io/badge/Ansible-2.8-green?style=flat&logo=ansible" alt="Ansible">
</a>
<a href="LICENSE.md">
<img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="Licence">
</a>
<a href="https://ubuntu.com/">
<img src="https://img.shields.io/badge/ubuntu-16.x-orange?style=flat&logo=ubuntu" alt="Distribution">
</a>
<a href="https://ubuntu.com/">
<img src="https://img.shields.io/badge/ubuntu-18.x-orange?style=flat&logo=ubuntu" alt="Distribution">
</a>
<a href="https://www.centos.org/">
<img src="https://img.shields.io/badge/centos-7.x-orange" alt="Distribution">
</a>


</p>
<p align="center">

<a href='https://facebook.com/sharer/sharer.php?u=https://github.com/clouddrove/ansible-role-docker-nginx'>
<img title="Share on Facebook" src="https://user-images.githubusercontent.com/50652676/62817743-4f64cb80-bb59-11e9-90c7-b057252ded50.png" />
</a>
<a href='https://www.linkedin.com/shareArticle?mini=true&title=Ansible+Role+Docker+Nginx&url=https://github.com/clouddrove/ansible-role-docker-nginx'>
<img title="Share on LinkedIn" src="https://user-images.githubusercontent.com/50652676/62817742-4e339e80-bb59-11e9-87b9-a1f68cae1049.png" />
</a>
<a href='https://twitter.com/intent/tweet/?text=Ansible+Role+Docker+Nginx&url=https://github.com/clouddrove/ansible-role-docker-nginx'>
<img title="Share on Twitter" src="https://user-images.githubusercontent.com/50652676/62817740-4c69db00-bb59-11e9-8a79-3580fbbf6d5c.png" />
</a>

</p>
<hr>



We eat, drink, sleep and most importantly love **DevOps**. DevOps always promotes automation and standardisation. While setting up various environments like local, dev, testing, production, etc. it is critical to maintain the same environment across. This can easily be achieved using automating the environment setup & installation with the help of ansible-playbooks.

Smaller roles are created for each environment elements; which also include tasks & tests. These roles can then be grouped together in [ansible-playbook](https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html) to achieve the desired yet consistent results.



## Prerequisites

This module has a few dependencies:

- [Ansible2.8](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html)
- [Python](https://www.python.org/downloads)
- [Docker](https://docs.docker.com/install/linux/docker-ce/ubuntu)




## What Includes

Followiing things includes in this role:
- nginx







## Example Playbook

**IMPORTANT:** Since the `master` branch used in `source` varies based on new modifications, we suggest that you use the release versions [here](https://github.com/clouddrove/ansible-role-docker-nginx/releases).


```yaml
- hosts: localhost
remote_user: root
roles:
- clouddrove.ansible_role_docker_nginx
```


## Variables

```yaml
nginx_version: "1.15.11"
nginx_user: nginx
nginx_group: nginx
nginx_opt_dir: "/opt/nginx"
nginx_log_dir: "/var/log/nginx"
```


## Installation

```console
$ ansible-galaxy install clouddrove.ansible_role_docker_nginx
```






## Feedback
If you come accross a bug or have any feedback, please log it in our [issue tracker](https://github.com/clouddrove/ansible-role-docker-nginx/issues), or feel free to drop us an email at [hello@clouddrove.com](mailto:hello@clouddrove.com).

If you have found it worth your time, go ahead and give us a ★ on [our GitHub](https://github.com/clouddrove/ansible-role-docker-nginx)!

## About us

At [CloudDrove][website], we offer expert guidance, implementation support and services to help organisations accelerate their journey to the cloud. Our services include docker and container orchestration, cloud migration and adoption, infrastructure automation, application modernisation and remediation, and performance engineering.

<p align="center">We are <b> The Cloud Experts!</b></p>
<hr />
<p align="center">We ❤️ <a href="https://github.com/clouddrove">Open Source</a> and you can check out <a href="https://github.com/clouddrove">our other modules</a> to get help with your new Cloud ideas.</p>

[website]: https://clouddrove.com
[github]: https://github.com/clouddrove
[linkedin]: https://cpco.io/linkedin
[twitter]: https://twitter.com/clouddrove/
[email]: https://clouddrove.com/contact-us.html
[terraform_modules]: https://github.com/clouddrove?utf8=%E2%9C%93&q=terraform-&type=&language=
72 changes: 72 additions & 0 deletions README.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
#
# This is the canonical configuration for the `README.md`
# Run `make readme` to rebuild the `README.md`
#

# Name of this project
name: Ansible Role Docker Nginx

# License of this project
license: "MIT"

# Canonical GitHub repo
github_repo: clouddrove/ansible-role-docker-nginx

# Badges to display
badges:
- name: "Ansible"
image: "https://img.shields.io/badge/Ansible-2.8-green?style=flat&logo=ansible"
url: "https://www.ansible.com"
- name: "Licence"
image: "https://img.shields.io/badge/License-MIT-blue.svg"
url: "LICENSE.md"
- name: "Distribution"
image: "https://img.shields.io/badge/ubuntu-16.x-orange?style=flat&logo=ubuntu"
url: "https://ubuntu.com/"
- name: "Distribution"
image: "https://img.shields.io/badge/ubuntu-18.x-orange?style=flat&logo=ubuntu"
url: "https://ubuntu.com/"
- name: "Distribution"
image: "https://img.shields.io/badge/centos-7.x-orange"
url: "https://www.centos.org/"
# Prerequesties to display
# yamllint disable
prerequesties:
- name: "Ansible2.8"
url: "https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html"
- name: "Python"
url: "https://www.python.org/downloads"
- name: "Docker"
url: "https://docs.docker.com/install/linux/docker-ce/ubuntu"
# yamllint enable
# What Includes to display
what_includes:
- name: "nginx"

# description of this project
description: |-
This ansible role is used to install Nginx Server with docker on linux.
# How to use this project
usage: |-
```yaml
- hosts: localhost
remote_user: root
roles:
- clouddrove.ansible_role_docker_nginx
```
# Variables use in the project
variables: |-
```yaml
nginx_version: "1.15.11"
nginx_user: nginx
nginx_group: nginx
nginx_opt_dir: "/opt/nginx"
nginx_log_dir: "/var/log/nginx"
```
# How to install project
installation: |-
```console
$ ansible-galaxy install clouddrove.ansible_role_docker_nginx
```
2 changes: 1 addition & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---

nginx_version: "1.15.11"

nginx_user: nginx
nginx_group: nginx

nginx_opt_dir: "/opt/nginx"
nginx_log_dir: "/var/log/nginx"

11 changes: 10 additions & 1 deletion handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,14 @@
service:
name: nginx
state: restarted
enabled: yes
enabled: true

- name: reload nginx
systemd:
name: nginx
state: reloaded

- name: start nginx
systemd:
name: nginx
state: started
13 changes: 11 additions & 2 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
dependencies: []

galaxy_info:
author: anmolnagpal
description: Install common packages
author: clouddrove
description: This ansible role is used to install Nginx Server with docker on linux.
company: "CloudDrove, LLC"
license: "license (BSD, MIT)"
min_ansible_version: 2.4
Expand All @@ -17,6 +17,15 @@ galaxy_info:
- trusty
- xenial
- bionic
- name: EL
versions:
- 7
galaxy_tags:
- system
- server
- nginx
- ubuntu
- debian
- centos
- webserver
- docker
34 changes: 29 additions & 5 deletions tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
state: directory
owner: "{{ nginx_user }}"
group: "{{ nginx_group }}"
mode: 0755
recurse: yes
mode: 0755
recurse: true
with_items:
- "{{ nginx_opt_dir }}"
- "{{ nginx_log_dir }}"
Expand All @@ -16,16 +16,40 @@
- "{{ nginx_opt_dir }}/ssl"


- name: transfer site.d configuration
template:
src: "{{ item }}"
dest: "{{ nginx_opt_dir }}/site.d/{{ item | basename }}"
with_fileglob:
- ../templates/config/site.d/*.*

- name: transfer error-page configuration
template:
src: "{{ item }}"
dest: "{{ nginx_opt_dir }}/error-page/{{ item | basename }}"
with_fileglob:
- ../templates/config/error-page/*.*

- name: transfer nginx.conf configuration
template:
src: "{{ item }}"
dest: "{{ nginx_opt_dir }}/nginx.conf"
with_fileglob:
- ../templates/config/nginx.conf

- name: transfer mime.types configuration
- name: transfer sites-enabled configuration
template:
src: "{{ item }}"
dest: "{{ nginx_opt_dir }}/mime.types"
dest: "{{ nginx_opt_dir }}/sites-enabled/{{ item | basename }}"
with_fileglob:
- ../templates/config/mime.types
- ../templates/config/sites-enabled/*.*

- name: create nginx logs files
changed_when: false
file:
path: "{{ item }}"
mode: 0644
state: touch
with_items:
- "{{ nginx_log_dir }}/error.log"
- "{{ nginx_log_dir }}/access.log"
Loading

0 comments on commit 33df45e

Please sign in to comment.