ansible/roles/nginx/server/tasks/main.yml

33 lines
622 B
YAML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
- name: install nginx packages
package:
name: nginx
state: installed
- name: create nginx data and config directories
file:
state: directory
path: "{{ item }}"
mode: 0755
owner: root
group: root
with_items:
- /srv/web
- "/srv/web/{{ inventory_hostname }}"
- "/etc/nginx/conf.d/{{ inventory_hostname }}"
- name: create nginx base config
template:
src: nginx.conf.j2
dest: /etc/nginx/nginx.conf
mode: 0644
owner: root
group: root
notify: restart nginx
- name: enable nginx service
service:
name: nginx
state: started
enabled: true