Browse Source

ansible: fix nginx in Docker

* rm /etc/init.d/nginx
* ensure nginx user
* disable default example site
merge-requests/157/head
Andrew Shu 6 months ago
parent
commit
eb06e41425
  1. 31
      ansible/roles/nginx/tasks/main.yml

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

@ -3,11 +3,21 @@
apt:
name: nginx
- name: Start and enable nginx service
service:
- 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
state: started
enabled: true
create_home: false
- name: Create nginx.conf file
template:
@ -35,6 +45,19 @@
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

Loading…
Cancel
Save