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.

91 line
2.4KB

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