summaryrefslogtreecommitdiff
path: root/roles/web/tasks/nginx.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/web/tasks/nginx.yml')
-rw-r--r--roles/web/tasks/nginx.yml34
1 files changed, 34 insertions, 0 deletions
diff --git a/roles/web/tasks/nginx.yml b/roles/web/tasks/nginx.yml
new file mode 100644
index 0000000..6348b24
--- /dev/null
+++ b/roles/web/tasks/nginx.yml
@@ -0,0 +1,34 @@
+- name: Install nginx
+ ansible.builtin.package:
+ name:
+ - nginx
+ state: present
+
+- name: Enable nginx systemd unit
+ ansible.builtin.service:
+ name: nginx
+ enabled: yes
+ state: started
+
+- name: Setup sites directories to serve by nginx
+ ansible.builtin.file:
+ path: '{{ item }}'
+ state: directory
+ owner: root
+ group: root
+ mode: u+rw,g+r,o+r
+ loop:
+ - /etc/nginx/sites-available
+ - /etc/nginx/sites-enabled
+
+- name: Configure nginx
+ ansible.builtin.copy:
+ src: roles/web/files/nginx.conf
+ dest: /etc/nginx/nginx.conf
+ owner: root
+ group: root
+ mode: u+rw,g+,o+r
+ notify:
+ - Reload nginx
+
+# TODO: logrotate