Nginx on Arch
peterbabic opened this issue · comments
Hello.
It looks like there is a problem with this role, when managing Arch.
The role does run sometimes (I was not able to isolate 100%, usually after completely removing nginx package), but then won't run again.
TASK [geerlingguy.nginx : Ensure nginx service is running as configured.] ***************
fatal: [5.189.129.182]: FAILED! => {"changed": false, "msg": "Unable to start service nginx: Job for nginx.service failed because the control process exited with error code.\nSee \"systemctl status nginx.service\" and \"journalctl -xeu nginx.service\" for details.\n"}
The reason is that nginx won't restart with a provided nginx.conf
template.
sudo systemctl restart nginx # fail
sudo journalctl -xeu nginx
The journal contains:
[emerg] 870#870: "pid" directive is duplicate in /etc/nginx/nginx.conf:4
When commenting the line 4 nginx restarts flawlessly.
The reason for this is that PID is also referenced in /usr/lib/systemd/system/nginx.service
as a line:
ExecStart=/usr/bin/nginx -g 'pid /run/nginx.pid; error_log stderr;'
If I understand it correctly, there is no need for L4 in nginx.conf
when managing Arch. More relevant information at https://bugs.archlinux.org/task/46500
ansible-role-nginx/tasks/main.yml
Lines 27 to 37 in 1820e90
The setup-Archlinux.yml
is run before nginx.conf
template is copied over. Should there be another Arch related task below the after "Copy" but before "Ensure running", or perhaps should there be an Arch specific template for nginx.conf
file?
UPDATE:
ansible-role-nginx/templates/nginx.conf.j2
Lines 1 to 6 in 1820e90
Templating is impractical here, as L3-L4 lines are the only lines that are not inside a block, so I propose to put them in a in a jinja2 block as well as a path of least resistance. Not sure about the L1 (not in a block but no issue reported).
This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!
Please read this blog post to see the reasons why I mark issues as stale.
This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.