Saltstack Official PHP 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.

installed.jinja 1.6KB

10 yıl önce
10 yıl önce
10 yıl önce
10 yıl önce
10 yıl önce
10 yıl önce
10 yıl önce
10 yıl önce
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # Template for installing packages.
  2. {% from "php/ng/map.jinja" import php with context %}
  3. {% from "php/ng/macro.jinja" import sls_block %}
  4. {% set pkginfo = php.lookup.pkgs.get(state) %}
  5. {% set pkgs = [] %}
  6. {% set specials = [] %}
  7. {% if pkginfo is iterable and pkginfo is not string %}
  8. {% for pkg in pkginfo %}
  9. {% if pkg is mapping %}
  10. {% do specials.append(pkg) %}
  11. {% else %}
  12. {% do pkgs.append(pkg) %}
  13. {% endif %}
  14. {% endfor %}
  15. {% else %}
  16. {% do pkgs.append(pkginfo) %}
  17. {% endif %}
  18. {% if grains['os_family']=="Debian" and (state == 'cli' or state == 'fpm' or state == 'php') %}
  19. {% set use_ppa = salt['pillar.get']('php:use_ppa', False) %}
  20. {% if use_ppa %}
  21. {% set ppa_name = salt['pillar.get']('php:ppa_name', 'ondrej/php5') %}
  22. php_ppa_env_{{ state }}:
  23. cmd.run:
  24. - name: apt-add-repository -y ppa:{{ ppa_name }}
  25. - env:
  26. - LC_ALL: C.UTF-8
  27. - unless: test -f /etc/apt/sources.list.d/{{ ppa_name|replace('/', '-', 1) }}-trusty.list
  28. php_ppa_{{ state }}:
  29. pkgrepo.managed:
  30. - ppa: {{ ppa_name }}
  31. - require:
  32. - cmd: php_ppa_env_{{ state }}
  33. - require_in:
  34. - pkg: php_install_{{ state }}
  35. pkg.latest:
  36. - name: {{ state }}
  37. - pkgs: {{ pkgs|json() }}
  38. - refresh: True
  39. - onchanges:
  40. - pkgrepo: php_ppa_{{ state }}
  41. {% endif %}
  42. {% endif %}
  43. php_install_{{ state }}:
  44. pkg.installed:
  45. - name: {{ state }}
  46. - pkgs: {{ pkgs|json() }}
  47. {% for pkg in specials %}
  48. php_install_{{ state }}_{{ pkg.get('name') }}:
  49. pkg.installed:
  50. {{ sls_block(pkg) }}
  51. {% endfor %}