Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install latest Nginx version from official repos #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 23 additions & 13 deletions nginx/tasks/setup-nginx.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
---
- name: install nginx
action: apt name=nginx

- name: write nginx.conf
action: template src=templates/nginx.conf.j2 dest=/etc/nginx/nginx.conf
notify:
- restart nginx

- name: delete default vhost
action: file path=/etc/nginx/sites-enabled/default state=absent
only_if: "$delete_default_vhost"
notify:
- restart nginx

- name: Add nginx repo key
apt_key:
url: "http://nginx.org/keys/nginx_signing.key"

- name: Add official APT repository
when: ansible_os_family == 'Debian'
apt_repository:
repo: "deb http://nginx.org/packages/{{ansible_distribution|lower}}/ {{ansible_distribution_release}} nginx"

- name: install latest nginx version
action: apt name=nginx state=latest

- name: write nginx.conf
action: template src=templates/nginx.conf.j2 dest=/etc/nginx/nginx.conf
notify:
- restart nginx

- name: delete default vhost
action: file path=/etc/nginx/sites-enabled/default state=absent
only_if: "$delete_default_vhost"
notify:
- restart nginx