mirror of https://gitlab.com/tildes/tildes.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.2 KiB
67 lines
1.2 KiB
---
|
|
- name: Install nginx
|
|
apt:
|
|
name: nginx
|
|
|
|
- name: Remove nginx from init.d (may conflict with systemd service)
|
|
file:
|
|
path: /etc/init.d/nginx
|
|
state: absent
|
|
when: is_docker
|
|
|
|
- name: Update rc.d to reflect init.d removal
|
|
command:
|
|
cmd: update-rc.d nginx remove
|
|
when: is_docker
|
|
|
|
- name: Create nginx user
|
|
user:
|
|
name: nginx
|
|
create_home: false
|
|
|
|
- name: Create nginx.conf file
|
|
template:
|
|
src: nginx.conf.jinja2
|
|
dest: /etc/nginx/nginx.conf
|
|
owner: root
|
|
group: root
|
|
mode: 0644
|
|
notify:
|
|
- Reload nginx
|
|
|
|
- name: Create sites-available directory
|
|
file:
|
|
path: /etc/nginx/sites-available
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
mode: 0755
|
|
|
|
- name: Create sites-enabled directory
|
|
file:
|
|
path: /etc/nginx/sites-enabled
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
mode: 0744
|
|
|
|
- name: Disable nginx default site
|
|
file:
|
|
path: /etc/nginx/sites-enabled/default
|
|
state: absent
|
|
notify:
|
|
- Reload nginx
|
|
|
|
- name: Start and enable nginx service
|
|
systemd_service:
|
|
name: nginx
|
|
state: started
|
|
enabled: true
|
|
|
|
- name: Add logrotate config
|
|
copy:
|
|
src: logrotate
|
|
dest: /etc/logrotate.d/nginx
|
|
owner: root
|
|
group: root
|
|
mode: 0644
|