aboutsummaryrefslogtreecommitdiffstats
path: root/roles/nginx/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'roles/nginx/tasks')
-rw-r--r--roles/nginx/tasks/main.yml42
1 files changed, 42 insertions, 0 deletions
diff --git a/roles/nginx/tasks/main.yml b/roles/nginx/tasks/main.yml
new file mode 100644
index 0000000..dda2c98
--- /dev/null
+++ b/roles/nginx/tasks/main.yml
@@ -0,0 +1,42 @@
+
+# nginx ~~ roles/nginx/tasks/main.yml
+# Linux nginx webserver
+
+---
+
+- name: ensure role is run on linux hosts
+ fail:
+ msg: nginx role can only be run on linux host
+ when: ansible_system != "Linux"
+
+- name: ensure nginx is installed
+ package: name=nginx state=present
+
+- name: ensure nginx group exists
+ group: name="{{ nginx_group }}" state=present
+
+- name: ensure nginx user exists
+ user: name="{{ nginx_user }}" group="{{ nginx_group }}" state=present
+
+- name: generate nginx configuration
+ template:
+ src: nginx.conf.j2
+ dest: /etc/nginx/nginx.conf
+ owner: "{{ user_root }}"
+ group: "{{ group_root }}"
+ mode: 0644
+
+- name: ensure nginx sub-configuration directory exists
+ file:
+ path: "{{ nginx_subconf_dir }}"
+ owner: "{{ user_root }}"
+ group: "{{ group_root }}"
+ state: directory
+ mode: 0744
+
+- name: enable and restart nginx
+ service:
+ name: nginx
+ state: restarted
+ enabled: true
+
remember that computers suck.