Nginx doesn't restart on boot with xenial
ctaverne opened this issue · comments
Hi
I don't understand. My ansible script has this issue since 2 days (with ubuntu xenial).
Nothing changed in my playbook.
Now it doesn't enable nginx service on startup.
I get:
$ sudo systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; disabled; vendor preset: enabled)
...
I need to make the following change to make it enabled
- name: Ensure nginx is started and enabled to start at boot.
service:
name: nginx
state: started
enabled: yes
use: service
become: yes
I was inspired by: geerlingguy/ansible-role-varnish#65 and ansible/ansible#22303
I just updated ansible from 2.5.0 to 2.5.1 and role to 2.5.1 too.
Nginx repository updated recently stable version to 1.14 too..
But it remains the same with old versions.. :( I can't come back to a working situation
I haven't had an issue with this on any of my Xenial servers... do you know if you have any other strange configuration in place? E.g. are you overriding/removing systemd on these servers?
Hi,
First, thanks for your answer and for sharing this project.
Me too, I hadn't any issue until now
No, I'm using standard configuration. To be more specific, I'm using official AWS ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-20180126 (ami-1b791862)
Very odd. I am using the same AMI in US-East-1, and have Nginx installed and working (even after reboot) without issue across a number of servers (right now, 8 instances with Ubuntu 16.04 and Nginx managed by the latest version of this role).
I'm inclined to think maybe it's an issue with Ansible itself? But if it were, I would be seeing it too. I'm running 2.5.1 currently and don't see any problem on a fresh test environment (nor in a test Docker container).
The official Xenial PPA for nginx 1.14 no longer auto enables the systemd job, I don't know if this is an issue with nginx itself or the PPA, but it's definitely not Ansible's fault.
@jportoles if nginx is no longer auto enabled in systemd, it doesn't explain why ansible can't manage this service anymore and can't enable it as previously?
Only after I do sudo systemctl enable nginx
on the guest Ubuntu VM can I do vagrant reload
to find nginx running on the rebooted VM.
geerlinggut/nginx
has:
- name: Ensure nginx is started and enabled to start at boot.
service: name=nginx state=started enabled=yes
and this should translate to systemctl enable nginx
shouldn't it? (ansible 2.5.2)
So what do you think is going on?
On Guest :
- Ubuntu latest 16.04 (
geerlingguy/ubuntu1604
) - nginx version: nginx/1.14.0
On host:
- Vagrant 2.1.0
- ansible 2.5.2
I wonder if this is an Ansible 2.5.x bug... ansible/ansible#39116
Hi,
I came back to 2.5.0 and 2.5.1 and got the same result. Maybe I lost something..
Just upgraded Ansible to 2.5.4 and it looks like this is fixed
I have this issue too, though I got it in Ansible 2.5.3 but it still happened after rolling back to 2.4.3.0. I was previously able to run Ansible fine with 2.4.3.0 so I suspect there is something in a recent version of Nginx which has also changed here.
Hmm, I ran this against 2.5.4 and still had the same issues with nginx not being enabled.
I'm on ansible 2.5.10
and the same issue has spread to a few of my other service roles besides nginx
. (I implemented some handler workarounds)
Anyone know if this is still an issue beyond ansible 2.5
?
On a side note, I think the actual problem is some idempotency testing in ansible
returns false positives in both service
and systemd
modules when a package includes both sysv
and systemd
init files on a systemd
enabled system. (Like Ubuntu 16.04)
It sorta looks like this was fixed in ansible 2.6
in this PR, so maybe if people still have this issue, that is the resolution. ansible/ansible#46245
Yeah; and in my quick testing with Drupal VM earlier today, it seemed to be working okay (I was testing a new base box which installed Nginx separately, then I rebooted and it was running correctly).
Closing this issue, feel free to reopen if you can reproduce the issue on newer versions of Ansible.