Auto-restart NGINX and use pillars to set conf path when building from sourcesusefix
PIDFile=/run/nginx.pid | PIDFile=/run/nginx.pid | ||||
ExecStartPre=/usr/sbin/nginx -t | ExecStartPre=/usr/sbin/nginx -t | ||||
ExecStart=/usr/sbin/nginx | ExecStart=/usr/sbin/nginx | ||||
ExecReload=/bin/kill -s HUP $MAINPID | |||||
ExecReload=/usr/sbin/nginx -s reload | |||||
ExecStop=/bin/kill -s QUIT $MAINPID | ExecStop=/bin/kill -s QUIT $MAINPID | ||||
Restart=on-failure | |||||
RestartSec=10s | |||||
PrivateTmp=true | PrivateTmp=true | ||||
[Install] | [Install] | ||||
WantedBy=multi-user.target | |||||
WantedBy=multi-user.target |
'source_hash': '8ed647c3dd65bc4ced03b0e0f6bf9e633eff6b01bac772bcf97077d58bc2be4d', | 'source_hash': '8ed647c3dd65bc4ced03b0e0f6bf9e633eff6b01bac772bcf97077d58bc2be4d', | ||||
'source': { | 'source': { | ||||
'opts': {}, | 'opts': {}, | ||||
'modules': {} | |||||
}, | }, | ||||
'package': { | 'package': { | ||||
'opts': {}, | 'opts': {}, |
nginx_configure: | nginx_configure: | ||||
cmd.run: | cmd.run: | ||||
- name: ./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf {{ nginx.source.opts | join(' ') }} | |||||
- name: ./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path={{ nginx.lookup.conf_file or '/etc/nginx/nginx.conf' }} {{ nginx.source.opts | join(' ') }} | |||||
- cwd: /tmp/nginx-{{ nginx.source_version }} | - cwd: /tmp/nginx-{{ nginx.source_version }} | ||||
- require: | - require: | ||||
- archive: nginx_download | - archive: nginx_download | ||||
- require: | - require: | ||||
- cmd: nginx_install | - cmd: nginx_install | ||||
- onchanges: | - onchanges: | ||||
- cmd: nginx_install | |||||
- cmd: nginx_install |
- template: jinja | - template: jinja | ||||
- context: | - context: | ||||
config: {{ settings.config|json() }} | config: {{ settings.config|json() }} | ||||
{% if 'overwrite' in vhost and vhost.overwrite == False %} | |||||
- unless: | |||||
- test -e {{ vhost_curpath(vhost) }} | |||||
{% endif %} | |||||
{% do vhost_states.append(conf_state_id) %} | {% do vhost_states.append(conf_state_id) %} | ||||
{% endif %} | {% endif %} | ||||
enabled_dir: /tmp/sites-enabled # an alternate directory (not sites-enabled) where this vhost may be found | enabled_dir: /tmp/sites-enabled # an alternate directory (not sites-enabled) where this vhost may be found | ||||
disabled_name: mysite.aint_on # an alternative disabled name to be use when not symlinking | disabled_name: mysite.aint_on # an alternative disabled name to be use when not symlinking | ||||
enabled: True | enabled: True | ||||
overwrite: True # overwrite an existing vhost file or not | |||||
# May be a list of config options or None, if None, no vhost file will be managed/templated | # May be a list of config options or None, if None, no vhost file will be managed/templated | ||||
# Take server directives as lists of dictionaries. If the dictionary value is another list of | # Take server directives as lists of dictionaries. If the dictionary value is another list of |