Saltstack Official PHP Formula
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

51 Zeilen
1.2KB

  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 %}