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.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', none) %}
  20. {% if use_ppa is not none %}
  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 %}