Saltstack Official Nginx Formula
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

156 lines
4.3KB

  1. # nginx.ng.pkg
  2. #
  3. # Manages installation of nginx from pkg.
  4. {% from 'nginx/ng/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. nginx_ppa_repo:
  51. pkgrepo:
  52. {%- if from_ppa %}
  53. - managed
  54. {%- else %}
  55. - absent
  56. {%- endif %}
  57. {% if salt['grains.get']('os') == 'Ubuntu' %}
  58. - ppa: nginx/{{ nginx.ppa_version }}
  59. {% else %}
  60. - name: deb http://ppa.launchpad.net/nginx/{{ nginx.ppa_version }}/ubuntu {{ grains['oscodename'] }} main
  61. - keyid: C300EE8C
  62. - keyserver: keyserver.ubuntu.com
  63. {% endif %}
  64. - require_in:
  65. - pkg: nginx_install
  66. - watch_in:
  67. - pkg: nginx_install
  68. nginx_phusionpassenger_repo:
  69. pkgrepo:
  70. {%- if from_phusionpassenger %}
  71. - managed
  72. {%- else %}
  73. - absent
  74. {%- endif %}
  75. - humanname: nginx phusionpassenger repo
  76. - name: deb https://oss-binaries.phusionpassenger.com/apt/passenger {{ grains['oscodename'] }} main
  77. - file: /etc/apt/sources.list.d/nginx-phusionpassenger-{{ grains['oscodename'] }}.list
  78. - keyid: 561F9B9CAC40B2F7
  79. - keyserver: keyserver.ubuntu.com
  80. - require_in:
  81. - pkg: nginx_install
  82. - watch_in:
  83. - pkg: nginx_install
  84. {% endif %}
  85. {% if salt['grains.get']('os_family') == 'Suse' or salt['grains.get']('os') == 'SUSE' %}
  86. nginx_zypp_repo:
  87. pkgrepo:
  88. {%- if from_official %}
  89. - managed
  90. {%- else %}
  91. - absent
  92. {%- endif %}
  93. - name: server_http
  94. - humanname: server_http
  95. - baseurl: 'http://download.opensuse.org/repositories/server:/http/openSUSE_13.2/'
  96. - enabled: True
  97. - autorefresh: True
  98. - gpgcheck: {{ nginx.lookup.gpg_check }}
  99. - gpgkey: {{ nginx.lookup.gpg_key }}
  100. - require_in:
  101. - pkg: nginx_install
  102. - watch_in:
  103. - pkg: nginx_install
  104. {% endif %}
  105. {% if salt['grains.get']('os_family') == 'RedHat' %}
  106. nginx_yum_repo:
  107. pkgrepo:
  108. {%- if from_official %}
  109. - managed
  110. {%- else %}
  111. - absent
  112. {%- endif %}
  113. - name: nginx
  114. - humanname: nginx repo
  115. {%- if salt['grains.get']('os') == 'CentOS' %}
  116. - baseurl: 'http://nginx.org/packages/centos/$releasever/$basearch/'
  117. {%- else %}
  118. - baseurl: 'http://nginx.org/packages/rhel/{{ nginx.lookup.rh_os_releasever }}/$basearch/'
  119. {%- endif %}
  120. - gpgcheck: {{ nginx.lookup.gpg_check }}
  121. - gpgkey: {{ nginx.lookup.gpg_key }}
  122. - enabled: True
  123. - require_in:
  124. - pkg: nginx_install
  125. - watch_in:
  126. - pkg: nginx_install
  127. nginx_phusionpassenger_yum_repo:
  128. pkgrepo:
  129. {%- if from_phusionpassenger %}
  130. - managed
  131. {%- else %}
  132. - absent
  133. {%- endif %}
  134. - name: passenger
  135. - humanname: nginx phusionpassenger repo
  136. - baseurl: 'https://oss-binaries.phusionpassenger.com/yum/passenger/el/$releasever/$basearch'
  137. - repo_gpgcheck: 1
  138. - gpgcheck: 0
  139. - gpgkey: 'https://packagecloud.io/gpg.key'
  140. - enabled: True
  141. - sslverify: 1
  142. - sslcacert: /etc/pki/tls/certs/ca-bundle.crt
  143. - require_in:
  144. - pkg: nginx_install
  145. - watch_in:
  146. - pkg: nginx_install
  147. {% endif %}