From f0e6aaa32efdb92fb3c4ba2f76b9675de0255832 Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Sun, 18 Nov 2018 19:00:57 +0100 Subject: [PATCH] Correctly rig up the Nginx part of deployment. --- ansible/roles/nginx/tasks/main.yml | 9 ++++++++- ansible/roles/nginx/templates/books.vvvvvvaria.org.j2 | 3 +++ ansible/roles/supervisor/tasks/main.yml | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ansible/roles/nginx/tasks/main.yml b/ansible/roles/nginx/tasks/main.yml index fb9c2fb..6cdb358 100644 --- a/ansible/roles/nginx/tasks/main.yml +++ b/ansible/roles/nginx/tasks/main.yml @@ -4,6 +4,13 @@ become: true template: src: books.vvvvvvaria.org.j2 - dest: /etc/nginx/sites-available/ + dest: /etc/nginx/sites-available/books.vvvvvvaria.conf mode: 0644 notify: Reload Nginx. + +- name: Symlink the configuration into the enabled folder. + become: true + file: + src: /etc/nginx/sites-available/books.vvvvvvaria.conf + path: /etc/nginx/sites-enabled/books.vvvvvvaria.conf + state: link diff --git a/ansible/roles/nginx/templates/books.vvvvvvaria.org.j2 b/ansible/roles/nginx/templates/books.vvvvvvaria.org.j2 index ec1562b..9bdc11a 100644 --- a/ansible/roles/nginx/templates/books.vvvvvvaria.org.j2 +++ b/ansible/roles/nginx/templates/books.vvvvvvaria.org.j2 @@ -18,6 +18,9 @@ server { error_log /var/log/nginx/books.vvvvvvaria.org.log; location / { + auth_basic "Congrats! You've reached a members only portion of the site!"; + auth_basic_user_file /etc/nginx/.htpasswd; + proxy_bind $server_addr; proxy_pass http://127.0.0.1:5000; proxy_set_header Host $http_host; diff --git a/ansible/roles/supervisor/tasks/main.yml b/ansible/roles/supervisor/tasks/main.yml index c0ec6fc..a868ebe 100644 --- a/ansible/roles/supervisor/tasks/main.yml +++ b/ansible/roles/supervisor/tasks/main.yml @@ -26,3 +26,9 @@ name: supervisor state: started enabled: true + +- name: Ensure the XPPL group is running. + become: true + supervisorctl: + name: 'xppl:' + state: started