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.

преди 10 години
преди 10 години
преди 10 години
преди 10 години
преди 10 години
преди 10 години
преди 10 години
преди 10 години
преди 10 години
преди 10 години
преди 10 години
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. # nginx.pkg
  2. #
  3. # Manages installation of nginx from pkg.
  4. {% from 'nginx/map.jinja' import nginx, sls_block with context %}
  5. {%- if nginx.install_from_repo %}
  6. {% set from_official = true %}
  7. {% set from_ppa = false %}
  8. {% set from_phusionpassenger = false %}
  9. {% elif nginx.install_from_ppa %}
  10. {% set from_official = false %}
  11. {% set from_ppa = true %}
  12. {% set from_phusionpassenger = false %}
  13. {% elif nginx.install_from_phusionpassenger %}
  14. {% set from_official = false %}
  15. {% set from_ppa = false %}
  16. {% set from_phusionpassenger = true %}
  17. {% else %}
  18. {% set from_official = false %}
  19. {% set from_ppa = false %}
  20. {% set from_phusionpassenger = false %}
  21. {%- endif %}
  22. nginx_install:
  23. pkg.installed:
  24. {{ sls_block(nginx.package.opts) }}
  25. {% if nginx.lookup.package is iterable and nginx.lookup.package is not string %}
  26. - pkgs:
  27. {% for pkg in nginx.lookup.package %}
  28. - {{ pkg }}
  29. {% endfor %}
  30. {% else %}
  31. - name: {{ nginx.lookup.package }}
  32. {% endif %}
  33. {% if salt['grains.get']('os_family') == 'Debian' %}
  34. nginx_official_repo:
  35. pkgrepo:
  36. {%- if from_official %}
  37. - managed
  38. {%- else %}
  39. - absent
  40. {%- endif %}
  41. - humanname: nginx apt repo
  42. - name: deb http://nginx.org/packages/{{ grains['os'].lower() }}/ {{ grains['oscodename'] }} nginx
  43. - file: /etc/apt/sources.list.d/nginx-official-{{ grains['oscodename'] }}.list
  44. - keyid: ABF5BD827BD9BF62
  45. - keyserver: keyserver.ubuntu.com
  46. - require_in:
  47. - pkg: nginx_install
  48. - watch_in:
  49. - pkg: nginx_install
  50. {%- if grains.os not in ('Debian',) %}
  51. ## applies to Ubuntu and derivatives only #}
  52. nginx_ppa_repo:
  53. pkgrepo:
  54. {%- if from_ppa %}
  55. - managed
  56. {%- else %}
  57. - absent
  58. {%- endif %}
  59. {% if salt['grains.get']('os') == 'Ubuntu' %}
  60. - ppa: nginx/{{ nginx.ppa_version }}
  61. {% else %}
  62. - name: deb http://ppa.launchpad.net/nginx/{{ nginx.ppa_version }}/ubuntu {{ grains['oscodename'] }} main
  63. - keyid: C300EE8C
  64. - keyserver: keyserver.ubuntu.com
  65. {% endif %}
  66. - require_in:
  67. - pkg: nginx_install
  68. - watch_in:
  69. - pkg: nginx_install
  70. {%- endif %}
  71. nginx_phusionpassenger_repo:
  72. pkgrepo:
  73. {%- if from_phusionpassenger %}
  74. - managed
  75. {%- else %}
  76. - absent
  77. {%- endif %}
  78. - humanname: nginx phusionpassenger repo
  79. - name: deb https://oss-binaries.phusionpassenger.com/apt/passenger {{ grains['oscodename'] }} main
  80. - file: /etc/apt/sources.list.d/nginx-phusionpassenger-{{ grains['oscodename'] }}.list
  81. - keyid: 561F9B9CAC40B2F7
  82. - keyserver: keyserver.ubuntu.com
  83. - require_in:
  84. - pkg: nginx_install
  85. - watch_in:
  86. - pkg: nginx_install
  87. {% endif %}
  88. {% if salt['grains.get']('os_family') == 'Suse' or salt['grains.get']('os') == 'SUSE' %}
  89. nginx_zypp_repo:
  90. pkgrepo:
  91. {%- if from_official %}
  92. - managed
  93. {%- else %}
  94. - absent
  95. {%- endif %}
  96. - name: server_http
  97. - humanname: server_http
  98. - baseurl: 'http://download.opensuse.org/repositories/server:/http/openSUSE_13.2/'
  99. - enabled: True
  100. - autorefresh: True
  101. - gpgcheck: {{ nginx.lookup.gpg_check }}
  102. - gpgkey: {{ nginx.lookup.gpg_key }}
  103. - require_in:
  104. - pkg: nginx_install
  105. - watch_in:
  106. - pkg: nginx_install
  107. {% endif %}
  108. {% if salt['grains.get']('os_family') == 'RedHat' %}
  109. nginx_yum_repo:
  110. pkgrepo:
  111. {%- if from_official %}
  112. - managed
  113. {%- else %}
  114. - absent
  115. {%- endif %}
  116. - name: nginx
  117. - humanname: nginx repo
  118. {%- if salt['grains.get']('os') == 'CentOS' %}
  119. - baseurl: 'http://nginx.org/packages/centos/$releasever/$basearch/'
  120. {%- else %}
  121. - baseurl: 'http://nginx.org/packages/rhel/{{ nginx.lookup.rh_os_releasever }}/$basearch/'
  122. {%- endif %}
  123. - gpgcheck: {{ nginx.lookup.gpg_check }}
  124. - gpgkey: {{ nginx.lookup.gpg_key }}
  125. - enabled: True
  126. - require_in:
  127. - pkg: nginx_install
  128. - watch_in:
  129. - pkg: nginx_install
  130. nginx_phusionpassenger_yum_repo:
  131. pkgrepo:
  132. {%- if from_phusionpassenger %}
  133. - managed
  134. {%- else %}
  135. - absent
  136. {%- endif %}
  137. - name: passenger
  138. - humanname: nginx phusionpassenger repo
  139. - baseurl: 'https://oss-binaries.phusionpassenger.com/yum/passenger/el/$releasever/$basearch'
  140. - repo_gpgcheck: 1
  141. - gpgcheck: 0
  142. - gpgkey: 'https://packagecloud.io/gpg.key'
  143. - enabled: True
  144. - sslverify: 1
  145. - sslcacert: /etc/pki/tls/certs/ca-bundle.crt
  146. - require_in:
  147. - pkg: nginx_install
  148. - watch_in:
  149. - pkg: nginx_install
  150. {% endif %}