From 7e6e1e157c2b5e300ce0fe542a97324b9f019dd4 Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Sun, 27 Oct 2019 18:32:25 -0500 Subject: [PATCH] Add nginx role --- roles/nginx/defaults/main.yaml | 7 +++++++ roles/nginx/handlers/main.yaml | 14 ++++++++++++++ roles/nginx/tasks/main.yml | 19 +++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 roles/nginx/defaults/main.yaml create mode 100644 roles/nginx/handlers/main.yaml create mode 100644 roles/nginx/tasks/main.yml diff --git a/roles/nginx/defaults/main.yaml b/roles/nginx/defaults/main.yaml new file mode 100644 index 0000000..919fccb --- /dev/null +++ b/roles/nginx/defaults/main.yaml @@ -0,0 +1,7 @@ +--- +nginx_package_name: nginx +nginx_package_state: present + +nginx_service_name: nginx +nginx_service_state: started +nginx_service_enabled: yes diff --git a/roles/nginx/handlers/main.yaml b/roles/nginx/handlers/main.yaml new file mode 100644 index 0000000..214899f --- /dev/null +++ b/roles/nginx/handlers/main.yaml @@ -0,0 +1,14 @@ +--- +- name: reload nginx + service: + name: "{{ nginx_service_name }}" + state: reloaded + when: nginx_service_enabled + +- name: restart nginx + service: + name: "{{ nginx_service_name }}" + state: restarted + when: nginx_service_enabled + +# vim:ft=yaml.ansible: diff --git a/roles/nginx/tasks/main.yml b/roles/nginx/tasks/main.yml new file mode 100644 index 0000000..2116ccb --- /dev/null +++ b/roles/nginx/tasks/main.yml @@ -0,0 +1,19 @@ +--- +- name: install passlib + package: + name: "{{ item }}" + state: present + loop: + - python-passlib + - python3-passlib + +- name: install package + package: + name: "{{ nginx_package_name }}" + state: "{{ nginx_package_state }}" + +- name: manage service + service: + name: "{{ nginx_service_name }}" + state: "{{ nginx_service_state }}" + enabled: "{{ nginx_service_enabled }}"