forked from AFPy/infra
Deploying 2012.pycon.fr.
This commit is contained in:
parent
35816beeca
commit
c31ae804ee
|
@ -27,3 +27,11 @@
|
|||
pelican_repo: https://github.com/AFPy/pyconfr_2010
|
||||
pelican_path_in_repo: 2011/
|
||||
pelican_home: "/srv/{{ pelican_user }}/"
|
||||
|
||||
- hosts: pycons
|
||||
roles: [static]
|
||||
vars:
|
||||
static_user: pycon2012
|
||||
static_https: true
|
||||
static_domain: 2012.pycon.fr
|
||||
static_repo: https://github.com/AFPy/pyconfr_2012
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
static_user: pycon2010
|
||||
static_https: false
|
||||
static_domain: some_static_website.pycon.fr
|
||||
static_repo: https://github.com/AFPy/pyconfr_2010
|
||||
static_path_in_repo: 2010/
|
||||
static_home: "/srv/{{ static_user }}/"
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
|
||||
- name: reload nginx
|
||||
service: name=nginx state=reloaded
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
|
||||
dependencies:
|
||||
- { role: letsencrypt, domains: ["{{ static_domain }}"], when: static_https }
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
|
||||
- include: static.yml
|
||||
tags: static
|
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
|
||||
- name: Install nginx and dependencies
|
||||
apt:
|
||||
name: [nginx, git]
|
||||
|
||||
- name: Create user
|
||||
user:
|
||||
name: "{{ static_user }}"
|
||||
shell: /bin/false
|
||||
system: yes
|
||||
home: "{{ static_home }}"
|
||||
|
||||
- name: Clone repo
|
||||
git:
|
||||
repo: "{{ static_repo }}"
|
||||
dest: "{{ static_home }}/www/"
|
||||
register: clone_repo
|
||||
|
||||
- name: Configure nginx
|
||||
template:
|
||||
src: nginx-vhost
|
||||
dest: "/etc/nginx/conf.d/{{ static_domain }}.conf"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify: reload nginx
|
|
@ -0,0 +1,33 @@
|
|||
{% if static_https %}
|
||||
server {
|
||||
listen 80;
|
||||
server_name {{ static_domain }};
|
||||
|
||||
location / {
|
||||
return 301 https://{{ static_domain }}$request_uri;
|
||||
}
|
||||
}
|
||||
|
||||
server
|
||||
{
|
||||
listen 443 ssl;
|
||||
server_name {{ static_domain }};
|
||||
|
||||
include snippets/letsencrypt-{{ static_domain }}.conf;
|
||||
|
||||
location / {
|
||||
root {{ static_home }}/www/;
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
}
|
||||
{% else %}
|
||||
server {
|
||||
listen 80;
|
||||
server_name {{ static_domain }};
|
||||
|
||||
location / {
|
||||
root {{ static_home }}/www/;
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
}
|
||||
{% endif %}
|
Loading…
Reference in New Issue