Server Fault Asked by Boaz on August 6, 2020
I’m trying to restart nginx
in my ansible
playbook if I changed the configuration. The configuration copy is done via template.
- name: update nginx.conf
template: src=../templates/nginx_global_conf.conf.j2 dest=/etc/nginx/nginx.conf
sudo: yes
register: nginx_conf
- name: restart nginx if needed
shell: service nginx restart
when: nginx_conf.changed
Even if I’m getting:
TASK: [webapp | update nginx.conf] ********************************************
changed: [IPADDRESS]
I ALWAYS get:
TASK: [webapp | restart nginx if needed] **************************************
skipping: [IPADDRESS]
Tried also instead of shell:
action: service name=nginx state=restarted enabled=yes
It is not the problem. The register that isn’t signalling is…
OK. Apparently I had the same nginx_conf
in a different yml I included.
Keeping the question here because there are quite some good tips.
Thanks to all the helpers
Answered by Boaz on August 6, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP