I am trying to deploy nginx using Saltstack. I am not using the nginx formula. Here is what I have:
nginx:
pkg.installed
service.running:
- require:
- pkg: nginx
- file: /etc/nginx/sites-enabled/com.example.static
- watch:
- file: /etc/nginx/sites-enabled/com.example.static
- method: reload
I also have an entry defined for /etc/nginx/sites-enabled/com.example.static
. It is working correctly -- the file is getting copied to the right location.
The problem is that nginx isn't getting reloaded when when Saltstack puts the configuration file on the system. I need to run /etc/init.d/nginx reload
before the server will respond to requests for static.example.com
.
You probably need to add a reload
directive to service.running
https://docs.saltstack.com/en/latest/ref/states/all/salt.states.service.html
"By default if a service is triggered to refresh due to a watch statement the service is by default restarted. If the desired behavior is to reload the service, then set the reload value to True."
nginx:
...
service.running:
...
- reload: True
- watch:
- file: /etc/nginx/sites-enabled/com.example.static
Also see github ticket #1122