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 }}"