|
1 | 1 | # -*- coding: utf-8 -*-
|
2 | 2 | # vim: ft=jinja
|
| 3 | +{%- set tplroot = tpldir.split('/')[0] %} |
| 4 | +{#- Start imports as #} |
| 5 | +{%- import_yaml tplroot ~ "/defaults.yaml" as default_settings %} |
| 6 | +{%- import_yaml tplroot ~ "/osarchmap.yaml" as osarchmap %} |
| 7 | +{%- import_yaml tplroot ~ "/osfamilymap.yaml" as osfamilymap %} |
| 8 | +{%- import_yaml tplroot ~ "/osmap.yaml" as osmap %} |
| 9 | +{%- import_yaml tplroot ~ "/osfingermap.yaml" as osfingermap %} |
3 | 10 |
|
4 |
| -{% set pillar_php_version = salt['pillar.get']('php:version', '7.0') %} |
5 |
| -{%- if pillar_php_version is iterable and pillar_php_version is not string %} |
6 |
| - {%- set php_version = pillar_php_version[0]|string %} |
| 11 | +{#- Retrieve the config dict only once #} |
| 12 | +{%- set _config = salt['config.get'](tplroot, default={}) %} |
| 13 | + |
| 14 | +{%- set defaults = salt['grains.filter_by']( |
| 15 | + default_settings, |
| 16 | + default=tplroot, |
| 17 | + merge=salt['grains.filter_by']( |
| 18 | + osarchmap, |
| 19 | + grain='osarch', |
| 20 | + merge=salt['grains.filter_by']( |
| 21 | + osfamilymap, |
| 22 | + grain='os_family', |
| 23 | + merge=salt['grains.filter_by']( |
| 24 | + osmap, |
| 25 | + grain='os', |
| 26 | + merge=salt['grains.filter_by']( |
| 27 | + osfingermap, |
| 28 | + grain='osfinger', |
| 29 | + merge=salt['grains.filter_by']( |
| 30 | + _config, |
| 31 | + default='php' |
| 32 | + ) |
| 33 | + ) |
| 34 | + ) |
| 35 | + ) |
| 36 | + ) |
| 37 | + ) |
| 38 | +%} |
| 39 | + |
| 40 | +{%- set config = salt['grains.filter_by']( |
| 41 | + {'defaults': defaults}, |
| 42 | + default='defaults', |
| 43 | + merge=_config |
| 44 | + ) |
| 45 | +%} |
| 46 | + |
| 47 | +{% set php = config %} |
| 48 | + |
| 49 | +{%- do salt.log.debug('[map.jinja] php var is set as: ' ~ php) %} |
| 50 | + |
| 51 | +{%- if php['pillar_php_version'] is iterable and php['pillar_php_version'] is not string %} |
| 52 | + {%- set php_version = php['pillar_php_version'][0]|string %} |
7 | 53 | {% else %}
|
8 |
| - {%- set php_version = pillar_php_version|string %} |
| 54 | + {%- set php_version = php['pillar_php_version']|string %} |
9 | 55 | {% endif %}
|
10 | 56 | {%- set freebsd_php_version = php_version.replace('.', '') %}
|
11 | 57 |
|
|
722 | 768 | {%- endif %}
|
723 | 769 | {%- else %}
|
724 | 770 | {%- if salt['grains.get']('osrelease')|string >= '18.04' %}
|
725 |
| - {%- set php = salt['pillar.get']('php', { |
| 771 | + {%- merge = php, salt['pillar.get']('php', { |
726 | 772 | 'lookup': salt['grains.filter_by']({
|
727 | 773 | 'Ubuntu': {
|
728 | 774 | 'pkgs': {
|
729 | 775 | 'adodb': 'libphp-adodb',
|
730 | 776 | 'apache2': 'libapache2-mod-php',
|
731 | 777 | 'apc': 'php',
|
732 | 778 | 'apcu': 'php-apcu',
|
733 |
| - 'bcmath': 'php7.2-bcmath', |
734 |
| - 'bz2': 'php7.2-bz2', |
| 779 | + 'bcmath': 'php' + php_version + '-bcmath', |
| 780 | + 'bz2': 'php' + php_version + '-bz2', |
735 | 781 | 'cache-lite': 'php-cache-lite',
|
736 | 782 | 'cgi': 'php-cgi',
|
737 | 783 | 'cli': 'php-cli',
|
738 | 784 | 'console-table': 'php-console-table',
|
739 | 785 | 'composer_bin': 'composer',
|
740 | 786 | 'curl': 'php-curl',
|
741 |
| - 'dev': 'php7.2-dev', |
742 |
| - 'dba': 'php7.2-dba', |
| 787 | + 'dev': 'php' + php_version + '-dev', |
| 788 | + 'dba': 'php' + php_version + '-dba', |
743 | 789 | 'fpm': 'php-fpm',
|
744 | 790 | 'gd': 'php-gd',
|
745 | 791 | 'geoip': 'php-geoip',
|
|
766 | 812 | 'net6': 'php-net-ipv6',
|
767 | 813 | 'oauth': 'php-oauth',
|
768 | 814 | 'odbc': 'php-odbc',
|
769 |
| - 'opcache': 'php7.2-opcache', |
| 815 | + 'opcache': 'php' + php_version + '-opcache', |
770 | 816 | 'pear': 'php-pear',
|
771 | 817 | 'pgsql': 'php-pgsql',
|
772 | 818 | 'php': 'php',
|
|
782 | 828 | 'sybase': 'php-sybase',
|
783 | 829 | 'tcpdf': 'php-tcpdf',
|
784 | 830 | 'temp_dir': '/tmp',
|
785 |
| - 'tidy': 'php7.2-tidy', |
| 831 | + 'tidy': 'php' + php_version + '-tidy', |
786 | 832 | 'xcache': 'php',
|
787 | 833 | 'xdebug': 'php-xdebug',
|
788 | 834 | 'xml': ['php-xml', 'php-xmlrpc'],
|
789 |
| - 'xsl': 'php7.2-xsl', |
| 835 | + 'xsl': 'php' + php_version + '-xsl', |
790 | 836 | 'zip': 'php-zip',
|
791 | 837 | },
|
792 | 838 | 'fpm': {
|
793 |
| - 'conf': '/etc/php/7.2/fpm/php-fpm.conf', |
794 |
| - 'ini': '/etc/php/7.2/fpm/php.ini', |
795 |
| - 'pools': '/etc/php/7.2/fpm/pool.d', |
796 |
| - 'service': 'php7.2-fpm', |
| 839 | + 'conf': '/etc/php/' + php_version + '/fpm/php-fpm.conf', |
| 840 | + 'ini': '/etc/php/' + php_version + '/fpm/php.ini', |
| 841 | + 'pools': '/etc/php/' + php_version + '/fpm/pool.d', |
| 842 | + 'service': 'php' + php_version + '-fpm', |
797 | 843 | 'user': 'root',
|
798 | 844 | 'group': 'root',
|
799 | 845 | 'defaults': odict([
|
800 | 846 | ('global', odict([
|
801 |
| - ('pid', '/var/run/php7.2-fpm.pid'), |
802 |
| - ('error_log', '/var/log/php7.2-fpm.log'), |
| 847 | + ('pid', '/var/run/php' + php_version + '-fpm.pid'), |
| 848 | + ('error_log', '/var/log/php' + php_version + '-fpm.log'), |
803 | 849 | ])),
|
804 |
| - ('include', '/etc/php/7.2/fpm/pool.d/*.conf'), |
| 850 | + ('include', '/etc/php/' + php_version + '/fpm/pool.d/*.conf'), |
805 | 851 | ]),
|
806 | 852 | },
|
807 | 853 | 'hhvm': {
|
|
0 commit comments