Add nginx role
This commit is contained in:
parent
761a515e0f
commit
7e6e1e157c
7
roles/nginx/defaults/main.yaml
Normal file
7
roles/nginx/defaults/main.yaml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
nginx_package_name: nginx
|
||||||
|
nginx_package_state: present
|
||||||
|
|
||||||
|
nginx_service_name: nginx
|
||||||
|
nginx_service_state: started
|
||||||
|
nginx_service_enabled: yes
|
14
roles/nginx/handlers/main.yaml
Normal file
14
roles/nginx/handlers/main.yaml
Normal file
@ -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:
|
19
roles/nginx/tasks/main.yml
Normal file
19
roles/nginx/tasks/main.yml
Normal file
@ -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 }}"
|
Loading…
Reference in New Issue
Block a user