summaryrefslogtreecommitdiff
path: root/roles/nginx/vhost/tasks/main.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/nginx/vhost/tasks/main.yml')
-rw-r--r--roles/nginx/vhost/tasks/main.yml25
1 files changed, 25 insertions, 0 deletions
diff --git a/roles/nginx/vhost/tasks/main.yml b/roles/nginx/vhost/tasks/main.yml
new file mode 100644
index 00000000..4de3393d
--- /dev/null
+++ b/roles/nginx/vhost/tasks/main.yml
@@ -0,0 +1,25 @@
+---
+- name: install nginx configs from template
+ when: "'template' in nginx_vhost"
+ template:
+ src: "{{ nginx_vhost.template }}.conf.j2"
+ dest: "/etc/nginx/sites-available/{{ nginx_vhost.name }}"
+ notify: reload nginx
+
+- name: install nginx configs from config data
+ when: "'content' in nginx_vhost"
+ copy:
+ content: "{{ nginx_vhost.content }}"
+ dest: "/etc/nginx/sites-available/{{ nginx_vhost.name }}"
+ notify: reload nginx
+
+- name: enable vhost config
+ file:
+ src: "../sites-available/{{ nginx_vhost.name }}"
+ dest: "/etc/nginx/sites-enabled/{{ nginx_vhost.name }}"
+ state: link
+ notify: reload nginx
+
+- name: generate acme certificate
+ when: "'acme' in nginx_vhost and nginx_vhost.acme"
+ include_tasks: acme.yml