Saltstack Official Nginx Formula
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

149 linhas
4.1KB

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