Saltstack Official Nginx Formula
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

63 Zeilen
1.6KB

  1. # nginx.ng.src
  2. #
  3. # Manages installation of nginx from source.
  4. {% from 'nginx/ng/map.jinja' import nginx, sls_block with context %}
  5. nginx_build_dep:
  6. {% if salt['grains.get']('os_family') == 'Debian' %}
  7. cmd.run:
  8. - name: apt-get -y build-dep nginx
  9. {% elif salt['grains.get']('os_family') == 'RedHat' %}
  10. cmd.run:
  11. - name: yum-builddep -y nginx
  12. {% else %}
  13. ## install build deps for other distros
  14. {% endif %}
  15. nginx_download:
  16. archive.extracted:
  17. - name: /tmp/
  18. - source: http://nginx.org/download/nginx-{{ nginx.source_version }}.tar.gz
  19. - source_hash: sha256={{ nginx.source_hash }}
  20. - archive_format: tar
  21. - if_missing: /usr/sbin/nginx-{{ nginx.source_version }}
  22. - require:
  23. - cmd: nginx_build_dep
  24. - onchanges:
  25. - cmd: nginx_build_dep
  26. nginx_configure:
  27. cmd.run:
  28. - 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(' ') }}
  29. - cwd: /tmp/nginx-{{ nginx.source_version }}
  30. - require:
  31. - archive: nginx_download
  32. - onchanges:
  33. - archive: nginx_download
  34. nginx_compile:
  35. cmd.run:
  36. - name: make
  37. - cwd: /tmp/nginx-{{ nginx.source_version }}
  38. - require:
  39. - cmd: nginx_configure
  40. nginx_install:
  41. cmd.run:
  42. - name: make install
  43. - cwd: /tmp/nginx-{{ nginx.source_version }}
  44. - require:
  45. - cmd: nginx_compile
  46. - onchanges:
  47. - cmd: nginx_compile
  48. nginx_link:
  49. file.copy:
  50. - name: /usr/sbin/nginx-{{ nginx.source_version }}
  51. - source: /usr/sbin/nginx
  52. - require:
  53. - cmd: nginx_install
  54. - onchanges:
  55. - cmd: nginx_install