|
|
|
|
|
|
|
|
{% set without_items = nginx.get('without', []) -%} |
|
|
{% set without_items = nginx.get('without', []) -%} |
|
|
{% set make_flags = nginx.get('make_flags', nginx_map['make_flags']) -%} |
|
|
{% set make_flags = nginx.get('make_flags', nginx_map['make_flags']) -%} |
|
|
|
|
|
|
|
|
|
|
|
{% set service_name = nginx.get('service_name', 'nginx') %} |
|
|
|
|
|
{% set service_enable = nginx.get('service_enable', True) %} |
|
|
|
|
|
|
|
|
{% set nginx_package = source + '/nginx-' + version + '.tar.gz' -%} |
|
|
{% set nginx_package = source + '/nginx-' + version + '.tar.gz' -%} |
|
|
{% set nginx_source = source + "/nginx-" + version -%} |
|
|
{% set nginx_source = source + "/nginx-" + version -%} |
|
|
{% set nginx_modules_dir = source + "/nginx-modules" -%} |
|
|
{% set nginx_modules_dir = source + "/nginx-modules" -%} |
|
|
|
|
|
|
|
|
- file: {{ nginx_modules_dir }} |
|
|
- file: {{ nginx_modules_dir }} |
|
|
cmd.wait: |
|
|
cmd.wait: |
|
|
- cwd: {{ source }} |
|
|
- cwd: {{ source }} |
|
|
- name: tar -zxf {{ nginx_package }} |
|
|
|
|
|
|
|
|
- name: tar --transform "s,^$(tar --list -zf nginx-{{ version }}.tar.gz | head -n 1),nginx-{{ version }}/," -zxf {{ nginx_package }} |
|
|
- require: |
|
|
- require: |
|
|
- pkg: get-nginx |
|
|
- pkg: get-nginx |
|
|
- file: get-nginx |
|
|
- file: get-nginx |
|
|
|
|
|
|
|
|
- file: get-ngx_devel_kit |
|
|
- file: get-ngx_devel_kit |
|
|
{% endif %} |
|
|
{% endif %} |
|
|
|
|
|
|
|
|
nginx-source-modified: |
|
|
|
|
|
|
|
|
is-nginx-source-modified: |
|
|
cmd.run: |
|
|
cmd.run: |
|
|
- cwd: {{ nginx_source }} |
|
|
|
|
|
|
|
|
- cwd: {{ source }} |
|
|
- stateful: True |
|
|
- stateful: True |
|
|
- names: |
|
|
- names: |
|
|
- m=$(find . \! -name "build.*" -newer {{ sbin_dir }}/nginx -print -quit); |
|
|
|
|
|
|
|
|
- if [ ! -d "nginx-{{ version }}" ]; then |
|
|
|
|
|
echo "changed=yes comment='Tarball has not yet been extracted'"; |
|
|
|
|
|
exit 0; |
|
|
|
|
|
fi; |
|
|
|
|
|
cd "nginx-{{ version }}"; |
|
|
|
|
|
m=$(find . \! -name "build.*" -newer {{ sbin_dir }}/nginx -print -quit); |
|
|
r=$?; |
|
|
r=$?; |
|
|
if [ x$r != x0 ]; then |
|
|
if [ x$r != x0 ]; then |
|
|
echo "changed=yes comment='binary file does not exist or other find error'"; |
|
|
echo "changed=yes comment='binary file does not exist or other find error'"; |
|
|
|
|
|
|
|
|
echo "changed=no comment='source files are older than binary'" |
|
|
echo "changed=no comment='source files are older than binary'" |
|
|
|
|
|
|
|
|
{% for name, module in nginx.get('modules', {}).items() -%} |
|
|
{% for name, module in nginx.get('modules', {}).items() -%} |
|
|
nginx-module-modified-{{name}}: |
|
|
|
|
|
|
|
|
is-nginx-module-modified-{{name}}: |
|
|
cmd.run: |
|
|
cmd.run: |
|
|
- cwd: {{ nginx_modules_dir }}/{{name}} |
|
|
- cwd: {{ nginx_modules_dir }}/{{name}} |
|
|
- stateful: True |
|
|
- stateful: True |
|
|
|
|
|
|
|
|
{% endif %} |
|
|
{% endif %} |
|
|
- watch: |
|
|
- watch: |
|
|
- cmd: get-nginx |
|
|
- cmd: get-nginx |
|
|
- cmd: nginx-source-modified |
|
|
|
|
|
|
|
|
- cmd: is-nginx-source-modified |
|
|
{% for name, module in nginx.get('modules', {}).items() -%} |
|
|
{% for name, module in nginx.get('modules', {}).items() -%} |
|
|
- cmd: nginx-module-modified-{{name}} |
|
|
|
|
|
|
|
|
- cmd: is-nginx-module-modified-{{name}} |
|
|
- file: get-nginx-{{name}} |
|
|
- file: get-nginx-{{name}} |
|
|
{% endfor %} |
|
|
{% endfor %} |
|
|
{% if use_sysvinit %} |
|
|
{% if use_sysvinit %} |
|
|
|
|
|
|
|
|
{% for name, module in nginx.get('modules', {}).items() -%} |
|
|
{% for name, module in nginx.get('modules', {}).items() -%} |
|
|
- file: get-nginx-{{name}} |
|
|
- file: get-nginx-{{name}} |
|
|
{% endfor %} |
|
|
{% endfor %} |
|
|
- require_in: |
|
|
|
|
|
- service: nginx |
|
|
|
|
|
file: |
|
|
file: |
|
|
- managed |
|
|
- managed |
|
|
- template: jinja |
|
|
- template: jinja |
|
|
- name: /etc/init.d/nginx |
|
|
|
|
|
|
|
|
- name: /etc/init.d/{{ service_name }} |
|
|
- source: salt://nginx/templates/nginx.init.jinja |
|
|
- source: salt://nginx/templates/nginx.init.jinja |
|
|
- user: root |
|
|
- user: root |
|
|
- group: root |
|
|
- group: root |
|
|
- mode: 0755 |
|
|
- mode: 0755 |
|
|
- context: |
|
|
- context: |
|
|
|
|
|
service_name: {{ service_name }} |
|
|
sbin_dir: {{ sbin_dir }} |
|
|
sbin_dir: {{ sbin_dir }} |
|
|
pid_path: {{ pid_path }} |
|
|
pid_path: {{ pid_path }} |
|
|
service: |
|
|
service: |
|
|
|
|
|
{% if service_enable %} |
|
|
- running |
|
|
- running |
|
|
- enable: True |
|
|
- enable: True |
|
|
- restart: True |
|
|
- restart: True |
|
|
|
|
|
{% else %} |
|
|
|
|
|
- dead |
|
|
|
|
|
- enable: False |
|
|
|
|
|
{% endif %} |
|
|
|
|
|
- name: {{ service_name }} |
|
|
- watch: |
|
|
- watch: |
|
|
- cmd: nginx |
|
|
- cmd: nginx |
|
|
- file: {{ conf_dir }}/nginx.conf |
|
|
- file: {{ conf_dir }}/nginx.conf |
|
|
|
|
|
|
|
|
{{ conf_dir }}/{{ file }}: |
|
|
{{ conf_dir }}/{{ file }}: |
|
|
file: |
|
|
file: |
|
|
- absent |
|
|
- absent |
|
|
watch: |
|
|
|
|
|
- cmd: nginx |
|
|
|
|
|
{{ conf_dir }}/{{ file }}.default: |
|
|
|
|
|
file: |
|
|
|
|
|
- absent |
|
|
|
|
|
watch: |
|
|
|
|
|
- cmd: nginx |
|
|
|
|
|
|
|
|
- require_in: |
|
|
|
|
|
- service: nginx |
|
|
{% endfor %} |
|
|
{% endfor %} |
|
|
|
|
|
|
|
|
{% for file in nginx.get('delete_htdocs', []) %} |
|
|
{% for file in nginx.get('delete_htdocs', []) %} |
|
|
{{ install_prefix }}/html/{{ file }}: |
|
|
{{ install_prefix }}/html/{{ file }}: |
|
|
file: |
|
|
file: |
|
|
- absent |
|
|
- absent |
|
|
watch: |
|
|
|
|
|
- cmd: nginx |
|
|
|
|
|
|
|
|
- require_in: |
|
|
|
|
|
- service: nginx |
|
|
{% endfor %} |
|
|
{% endfor %} |