ansible/roles/nginx_reverseproxy/tasks/main.yml

74 lines
1.6 KiB
YAML
Raw Normal View History

2020-05-09 12:52:17 +02:00
---
- name: Install NGINX
apt:
update_cache: true
name: nginx
register: apt_result
retries: 3
until: apt_result is succeeded
- name: Copy snippets
template:
src: "nginx/snippets/{{ item }}.j2"
dest: "/etc/nginx/snippets/{{ item }}"
2020-11-04 19:31:50 +01:00
mode: 0644
2020-05-09 12:52:17 +02:00
loop:
- options-ssl.conf
- options-proxypass.conf
- name: Copy dhparam
template:
src: letsencrypt/dhparam.j2
dest: /etc/letsencrypt/dhparam
2020-11-04 19:31:50 +01:00
mode: 0644
2020-05-09 12:52:17 +02:00
- name: Copy reverse proxy sites
template:
src: "nginx/sites-available/{{ item }}.j2"
dest: "/etc/nginx/sites-available/{{ item }}"
2020-11-04 19:31:50 +01:00
mode: 0644
2020-05-09 12:52:17 +02:00
loop:
- reverseproxy
- reverseproxy_redirect_dname
- redirect
notify: Reload nginx
- name: Activate sites
file:
src: "/etc/nginx/sites-available/{{ item }}"
dest: "/etc/nginx/sites-enabled/{{ item }}"
state: link
2020-11-04 19:31:50 +01:00
mode: 0644
2020-05-09 12:52:17 +02:00
loop:
- reverseproxy
- reverseproxy_redirect_dname
- redirect
notify: Reload nginx
- name: Copy forward modules
template:
src: "nginx/modules-available/60-forward.conf.j2"
dest: "/etc/nginx/modules-available/60-forward.conf"
mode: 0644
notify: Reload nginx
- name: Activate modules
file:
src: "/etc/nginx/modules-available/60-forward.conf"
dest: "/etc/nginx/modules-enabled/60-forward.conf"
state: link
mode: 0644
notify: Reload nginx
2020-05-09 12:52:17 +02:00
- name: Copy 50x error page
template:
src: www/html/50x.html.j2
dest: /var/www/html/50x.html
2020-11-04 19:31:50 +01:00
mode: 0644
2020-05-09 12:52:17 +02:00
- name: Indicate role in motd
template:
src: update-motd.d/05-service.j2
dest: /etc/update-motd.d/05-nginx
mode: 0755