roles/nginx/site/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Tue, 01 Jan 2019 21:57:11 -0600
changeset 67 bd34ae082697
permissions -rw-r--r--
Split out nginx sites.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
67
bd34ae082697 Split out nginx sites.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     1
---
bd34ae082697 Split out nginx sites.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     2
bd34ae082697 Split out nginx sites.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     3
- name: install site
bd34ae082697 Split out nginx sites.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     4
  become: yes
bd34ae082697 Split out nginx sites.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     5
  template: src="{{nginx_conf_src}}" dest="/etc/nginx/sites-available/{{nginx_conf_dst}}"
bd34ae082697 Split out nginx sites.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     6
  notify: restart nginx
bd34ae082697 Split out nginx sites.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     7
bd34ae082697 Split out nginx sites.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     8
- name: install certbot in nginx
bd34ae082697 Split out nginx sites.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     9
  become: yes
bd34ae082697 Split out nginx sites.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    10
  command: "certbot certonly --nginx -n --agree-tos -d {{nginx_server_name}} -m {{nginx_admin_email}}"
bd34ae082697 Split out nginx sites.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    11
  notify: restart nginx
bd34ae082697 Split out nginx sites.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    12
  when: nginx_enable_ssl
bd34ae082697 Split out nginx sites.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    13
bd34ae082697 Split out nginx sites.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    14
- name: enable site
bd34ae082697 Split out nginx sites.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    15
  become: yes
bd34ae082697 Split out nginx sites.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    16
  file:
bd34ae082697 Split out nginx sites.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    17
    src:  "/etc/nginx/sites-available/{{nginx_conf_dst}}"
bd34ae082697 Split out nginx sites.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    18
    dest: "/etc/nginx/sites-enabled/{{nginx_conf_dst}}"
bd34ae082697 Split out nginx sites.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    19
    state: "link"
bd34ae082697 Split out nginx sites.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    20
  notify: restart nginx