Saltstack Official PHP Formula
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

installed.jinja 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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_{{ state }}:
  23. pkgrepo.managed:
  24. - ppa: {{ ppa_name }}
  25. pkg.latest:
  26. - name: {{ state }}
  27. - pkgs: {{ pkgs|json() }}
  28. - refresh: True
  29. {% endif %}
  30. {% endif %}
  31. php_install_{{ state }}:
  32. pkg.installed:
  33. - name: {{ state }}
  34. - pkgs: {{ pkgs|json() }}
  35. {% for pkg in specials %}
  36. php_install_{{ state }}_{{ pkg.get('name') }}:
  37. pkg.installed:
  38. {{ sls_block(pkg) }}
  39. {% endfor %}