blob: dda2c98da53b7ec790a7172350ed0cecb3ac5a4c (
plain) (
tree)
|
|
# 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
|