mirror of
https://github.com/koodiklinikka/playbooks.git
synced 2026-01-26 03:03:59 +00:00
39 lines
1.0 KiB
YAML
39 lines
1.0 KiB
YAML
---
|
|
|
|
- name: Add nginx repository
|
|
apt_repository: repo='deb http://nginx.org/packages/ubuntu/ precise nginx' state=present update_cache=yes
|
|
tags: [nginx, repo]
|
|
|
|
- name: Add nginx repository signing key
|
|
apt_key: url=http://nginx.org/keys/nginx_signing.key id=7BD9BF62 state=present
|
|
tags: [nginx, repo]
|
|
|
|
- name: Install nginx
|
|
apt: pkg=nginx state=latest
|
|
tags: [nginx, install]
|
|
|
|
- name: Ensure nginx config directories exist
|
|
file: path={{ item }} state=directory
|
|
with_items:
|
|
- /etc/nginx
|
|
- /etc/nginx/sites-available
|
|
- /etc/nginx/sites-enabled
|
|
tags: [nginx]
|
|
|
|
- name: Remove default nginx configs
|
|
file: path=/etc/nginx/sites-available/default state=absent
|
|
with_items:
|
|
- /etc/nginx/sites-available/default
|
|
- /etc/nginx/sites-enabled/default
|
|
- /etc/nginx/conf.d
|
|
notify: restart nginx
|
|
tags: [nginx, config]
|
|
|
|
- name: Allow tcp/80 and tcp/443 for HTTP
|
|
ufw: rule=allow insert={{ item.num }} proto=tcp port={{ item.port }}
|
|
with_items:
|
|
- { num: 1, port: 80 }
|
|
- { num: 2, port: 443 }
|
|
sudo: true
|
|
tags: [nginx, ufw]
|