Saltstack Official Nginx Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 line
1.7KB

  1. # nginx.ng.install
  2. #
  3. # Manages installation of nginx.
  4. {% from 'nginx/ng/map.jinja' import nginx, sls_block with context %}
  5. nginx_install:
  6. {% if nginx.install_from_source %}
  7. ## add source compilation here
  8. {% else %}
  9. pkg.installed:
  10. {{ sls_block(nginx.package.opts) }}
  11. - name: {{ nginx.lookup.package }}
  12. {% endif %}
  13. {% if salt['grains.get']('os_family') == 'Debian' %}
  14. nginx_ppa_repo:
  15. pkgrepo:
  16. {%- if nginx.install_from_ppa %}
  17. - managed
  18. {%- else %}
  19. - absent
  20. {%- endif %}
  21. - ppa: nginx/{{ nginx.ppa_version }}
  22. - require_in:
  23. - pkg: nginx_install
  24. - watch_in:
  25. - pkg: nginx_install
  26. {% endif %}
  27. {% if salt['grains.get']('os_family') == 'Suse' %}
  28. nginx_zypp_repo:
  29. pkgrepo:
  30. {%- if nginx.install_from_repo %}
  31. - managed
  32. {%- else %}
  33. - absent
  34. {%- endif %}
  35. - name: server_http
  36. - humanname: server_http
  37. - baseurl: 'http://download.opensuse.org/repositories/server:/http/openSUSE_13.2/'
  38. - enabled: True
  39. - autorefresh: True
  40. - gpgcheck: True
  41. - gpgkey: 'http://download.opensuse.org/repositories/server:/http/openSUSE_13.2/repodata/repomd.xml.key'
  42. - require_in:
  43. - pkg: nginx_install
  44. - watch_in:
  45. - pkg: nginx_install
  46. {% endif %}
  47. {% if salt['grains.get']('os_family') == 'RedHat' %}
  48. nginx_yum_repo:
  49. pkgrepo.managed:
  50. - name: nginx
  51. - humanname: nginx repo
  52. {%- if salt['grains.get']('os') == 'CentOS' %}
  53. - baseurl: 'http://nginx.org/packages/centos/$releasever/$basearch/'
  54. {%- else %}
  55. - baseurl: 'http://nginx.org/packages/rhel/{{ nginx.lookup.rh_os_releasever }}/$basearch/'
  56. {%- endif %}
  57. - gpgcheck: False
  58. - enabled: True
  59. - require_in:
  60. - pkg: nginx_install
  61. - watch_in:
  62. - pkg: nginx_install
  63. {% endif %}