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.

74 lines
1.8KB

  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: {{ nginx.lookup.gpg_check }}
  41. - gpgkey: {{ nginx.lookup.gpg_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. {%- if nginx.install_from_repo %}
  50. pkgrepo.managed:
  51. {%- else %}
  52. pkgrepo.absent:
  53. {%- endif %}
  54. - name: nginx
  55. - humanname: nginx repo
  56. {%- if salt['grains.get']('os') == 'CentOS' %}
  57. - baseurl: 'http://nginx.org/packages/centos/$releasever/$basearch/'
  58. {%- else %}
  59. - baseurl: 'http://nginx.org/packages/rhel/{{ nginx.lookup.rh_os_releasever }}/$basearch/'
  60. {%- endif %}
  61. - gpgcheck: {{ nginx.lookup.gpg_check }}
  62. - gpgkey: {{ nginx.lookup.gpg_key }}
  63. - enabled: True
  64. - require_in:
  65. - pkg: nginx_install
  66. - watch_in:
  67. - pkg: nginx_install
  68. {% endif %}