First public version
This commit is contained in:
64
tasks/main.yml
Normal file
64
tasks/main.yml
Normal file
@@ -0,0 +1,64 @@
|
||||
---
|
||||
|
||||
- name: nginx | Install packages
|
||||
pacman:
|
||||
name:
|
||||
- nginx-mainline
|
||||
- mailcap
|
||||
state: present
|
||||
update_cache: yes
|
||||
|
||||
- name: nginx | Remove stupid apache-style dirs
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: absent
|
||||
with_items:
|
||||
- /etc/nginx/sites-available
|
||||
- /etc/nginx/sites-enabled
|
||||
|
||||
- name: nginx | Add vhosts directory
|
||||
file:
|
||||
path: /etc/nginx/vhosts
|
||||
state: directory
|
||||
mode: 0700
|
||||
owner: root
|
||||
group: root
|
||||
|
||||
- name: nginx | Deploy main config
|
||||
template:
|
||||
src: nginx.conf.j2
|
||||
dest: /etc/nginx/nginx.conf
|
||||
mode: 0600
|
||||
owner: root
|
||||
group: root
|
||||
notify: nginx | Config changed
|
||||
|
||||
- name: nginx | Deploy vhosts configs
|
||||
template:
|
||||
src: nginx/vhosts/{{ item }}
|
||||
dest: /etc/nginx/vhosts/{{ item }}
|
||||
mode: 0600
|
||||
owner: root
|
||||
group: root
|
||||
with_items: "{{ nginx_vhosts }}"
|
||||
notify: nginx | Config changed
|
||||
|
||||
- name: nginx | Get file list in config dir
|
||||
find:
|
||||
path: /etc/nginx/vhosts
|
||||
hidden: yes
|
||||
register: nginx_vhosts_find
|
||||
|
||||
- name: nginx | Remove unmanaged shit
|
||||
file:
|
||||
path: "/etc/nginx/vhosts/{{ item.path | basename }}"
|
||||
state: absent
|
||||
with_items:
|
||||
- "{{ nginx_vhosts_find.files }}"
|
||||
when: (item.path | basename) not in nginx_vhosts
|
||||
|
||||
- name: nginx | Enable and start nginx
|
||||
systemd:
|
||||
name: nginx
|
||||
enabled: yes
|
||||
state: started
|
Reference in New Issue
Block a user