--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roles/nginx/tasks/main.yaml Mon Aug 20 10:22:45 2018 -0500
@@ -0,0 +1,38 @@
+---
+
+- name: set hostname in OS
+ become: yes
+ hostname: name="{{inventory_hostname}}"
+
+- name: change timezone to UTC
+ become: yes
+ timezone: name="UTC"
+
+- name: install nginx packages
+ become: yes
+ apt: name="nginx"
+
+- name: disable default site
+ become: yes
+ file: path="/etc/nginx/sites-enabled/default" state="absent"
+ notify: restart nginx
+
+- name: install site
+ become: yes
+ template: src="{{nginx_conf_src}}" dest="/etc/nginx/sites-available/{{nginx_conf_dst}}"
+ notify: restart nginx
+
+- import_tasks: certbot.yaml
+ when: nginx_enable_ssl
+
+- name: enable site
+ become: yes
+ file:
+ src: "/etc/nginx/sites-available/{{nginx_conf_dst}}"
+ dest: "/etc/nginx/sites-enabled/{{nginx_conf_dst}}"
+ state: "link"
+ notify: restart nginx
+
+- name: enable nginx service
+ become: yes
+ systemd: name="nginx" enabled="yes" state="started"