This repository has been archived by the owner on Jan 18, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b2de7a6
Showing
11 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Ansible Role: Nginx | ||
|
||
Installs Nginx | ||
|
||
## Supported platforms | ||
|
||
``` | ||
CentOS 6 & 7 | ||
Ubuntu 14.04 | ||
``` | ||
|
||
## Requirements | ||
|
||
None | ||
|
||
## Role Variables | ||
|
||
Nginx version: | ||
|
||
``` | ||
nginx_mainline: true | ||
``` | ||
|
||
## Dependencies | ||
|
||
None | ||
|
||
## Example Playbook | ||
|
||
``` | ||
- hosts: servers | ||
roles: | ||
- { role: pcextreme.nginx } | ||
``` | ||
|
||
## License | ||
|
||
MIT / BSD | ||
|
||
## Author Information | ||
|
||
Created by [Attila van der Velde](https://github.com/vdvm) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
nginx_mainline: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
- name: reload nginx | ||
service: name=nginx state=reloaded | ||
|
||
- name: restart nginx | ||
service: name=nginx state=restarted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
galaxy_info: | ||
author: "Attila van der Velde" | ||
description: "Installs Nginx" | ||
company: "PCextreme B.V." | ||
license: "license (MIT, BSD)" | ||
min_ansible_version: 1.8 | ||
platforms: | ||
- name: EL | ||
versions: | ||
- 6 | ||
- 7 | ||
- name: Ubuntu | ||
versions: | ||
- trusty | ||
categories: | ||
- system | ||
- web | ||
|
||
dependencies: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
- name: Add repo file | ||
template: src=nginx_centos.repo.j2 dest=/etc/yum.repos.d/nginx.repo owner=root group=root mode=0644 | ||
|
||
- name: Add repo key | ||
get_url: url=http://nginx.org/keys/nginx_signing.key dest=/etc/pki/rpm-gpg/RPM-GPG-KEY-nginx sha256sum=dcc2ed613d67b277a7e7c87b12907485652286e199c1061fb4b3af91f201be39 force=yes | ||
|
||
- name: Add repo key | ||
file: path=/etc/pki/rpm-gpg/RPM-GPG-KEY-nginx owner=root group=root mode=0644 | ||
|
||
- name: Add repo key | ||
rpm_key: state=present key=/etc/pki/rpm-gpg/RPM-GPG-KEY-nginx | ||
|
||
- name: Install Nginx | ||
yum: name=nginx enablerepo=nginx state=present |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
- include: centos.yml | ||
when: ansible_distribution == 'CentOS' and ansible_distribution_major_version|int >= 6 | ||
|
||
- include: ubuntu.yml | ||
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '14.04' | ||
|
||
- name: Start and enable service | ||
service: name=nginx state=started enabled=yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
- name: Add repo file | ||
template: src=nginx_ubuntu.list.j2 dest=/etc/apt/sources.list.d/nginx.list owner=root group=root mode=0644 | ||
register: nginx_list | ||
|
||
- name: Add repo key | ||
get_url: url=http://nginx.org/keys/nginx_signing.key dest=/etc/apt/nginx.key sha256sum=dcc2ed613d67b277a7e7c87b12907485652286e199c1061fb4b3af91f201be39 force=yes | ||
|
||
- name: Add repo key | ||
file: path=/etc/apt/nginx.key owner=root group=root mode=0644 | ||
|
||
- name: Add repo key | ||
apt_key: id=7BD9BF62 file=/etc/apt/nginx.key state=present | ||
register: nginx_key | ||
|
||
- name: Update apt cache | ||
apt: update_cache=yes | ||
when: nginx_list.changed == True or nginx_key.changed == True | ||
|
||
- name: Install Nginx | ||
apt: pkg=nginx state=present |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[nginx] | ||
name=nginx | ||
baseurl=http://nginx.org/packages/{% if nginx_mainline %}mainline/{% endif %}centos/{{ ansible_distribution_major_version }}/x86_64/ | ||
gpgcheck=1 | ||
enabled=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
deb http://nginx.org/packages/{% if nginx_mainline %}mainline/{% endif %}ubuntu/ {{ ansible_distribution_release | lower }} nginx | ||
deb-src http://nginx.org/packages/{% if nginx_mainline %}mainline/{% endif %}ubuntu/ {{ ansible_distribution_release | lower }} nginx |