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.

89 lines
2.3KB

  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. {%- if nginx.install_from_repo %}
  15. nginx-official-repo:
  16. pkgrepo:
  17. - managed
  18. - humanname: nginx apt repo
  19. - name: deb http://nginx.org/packages/{{ grains['os'].lower() }}/ {{ grains['oscodename'] }} nginx
  20. - file: /etc/apt/sources.list.d/nginx-official-{{ grains['oscodename'] }}.list
  21. - keyid: ABF5BD827BD9BF62
  22. - keyserver: keyserver.ubuntu.com
  23. - require_in:
  24. - pkg: nginx
  25. - watch_in:
  26. - pkg: nginx
  27. {%- else %}
  28. nginx_ppa_repo:
  29. pkgrepo:
  30. {%- if nginx.install_from_ppa %}
  31. - managed
  32. {%- else %}
  33. - absent
  34. {%- endif %}
  35. - ppa: nginx/{{ nginx.ppa_version }}
  36. - require_in:
  37. - pkg: nginx_install
  38. - watch_in:
  39. - pkg: nginx_install
  40. {%- endif %}
  41. {% endif %}
  42. {% if salt['grains.get']('os_family') == 'Suse' %}
  43. nginx_zypp_repo:
  44. pkgrepo:
  45. {%- if nginx.install_from_repo %}
  46. - managed
  47. {%- else %}
  48. - absent
  49. {%- endif %}
  50. - name: server_http
  51. - humanname: server_http
  52. - baseurl: 'http://download.opensuse.org/repositories/server:/http/openSUSE_13.2/'
  53. - enabled: True
  54. - autorefresh: True
  55. - gpgcheck: {{ nginx.lookup.gpg_check }}
  56. - gpgkey: {{ nginx.lookup.gpg_key }}
  57. - require_in:
  58. - pkg: nginx_install
  59. - watch_in:
  60. - pkg: nginx_install
  61. {% endif %}
  62. {% if salt['grains.get']('os_family') == 'RedHat' %}
  63. nginx_yum_repo:
  64. {%- if nginx.install_from_repo %}
  65. pkgrepo.managed:
  66. {%- else %}
  67. pkgrepo.absent:
  68. {%- endif %}
  69. - name: nginx
  70. - humanname: nginx repo
  71. {%- if salt['grains.get']('os') == 'CentOS' %}
  72. - baseurl: 'http://nginx.org/packages/centos/$releasever/$basearch/'
  73. {%- else %}
  74. - baseurl: 'http://nginx.org/packages/rhel/{{ nginx.lookup.rh_os_releasever }}/$basearch/'
  75. {%- endif %}
  76. - gpgcheck: {{ nginx.lookup.gpg_check }}
  77. - gpgkey: {{ nginx.lookup.gpg_key }}
  78. - enabled: True
  79. - require_in:
  80. - pkg: nginx_install
  81. - watch_in:
  82. - pkg: nginx_install
  83. {% endif %}