Browse Source

Added osfamilymap, osmap and other defaults

pull/214/head
Wayne Gemmell 4 years ago
parent
commit
10b7519a39
3 changed files with 68 additions and 22 deletions
  1. +3
    -1
      php/fpm/config.sls
  2. +0
    -2
      php/fpm/init.sls
  3. +65
    -19
      php/map.jinja

+ 3
- 1
php/fpm/config.sls View File

{%- from tplroot ~ "/map.jinja" import php with context %} {%- from tplroot ~ "/map.jinja" import php with context %}
{%- from tplroot ~ "/ini.jinja" import php_ini %} {%- from tplroot ~ "/ini.jinja" import php_ini %}


{%- do salt.log.debug('[php.fpm.config] php var is set as: ' ~ php) %}

{%- set ini_settings = php.ini.defaults %} {%- set ini_settings = php.ini.defaults %}
{%- for key, value in php.fpm.config.ini.settings.items() %} {%- for key, value in php.fpm.config.ini.settings.items() %}
{%- if ini_settings[key] is defined %} {%- if ini_settings[key] is defined %}
{%- endif %} {%- endif %}
{%- endfor %} {%- endfor %}


{%- set pillar_php_version = salt['pillar.get']('php:version', '7.0') %}
{%- set pillar_php_version = php.pillar_php_version %}
{%- if pillar_php_version is iterable and pillar_php_version is not string %} {%- if pillar_php_version is iterable and pillar_php_version is not string %}
{%- for version in pillar_php_version %} {%- for version in pillar_php_version %}
{%- set conf_settings = odict(php.lookup.fpm.defaults) %} {%- set conf_settings = odict(php.lookup.fpm.defaults) %}

+ 0
- 2
php/fpm/init.sls View File

- php.fpm.service - php.fpm.service
- php.fpm.pools - php.fpm.pools


{% set pillar_php_version = salt['pillar.get']('php:version', '7.0') %}

extend: extend:
{% if pillar_php_version is iterable and pillar_php_version is not string %} {% if pillar_php_version is iterable and pillar_php_version is not string %}
{% for version in pillar_php_version %} {% for version in pillar_php_version %}

+ 65
- 19
php/map.jinja View File

# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: ft=jinja # vim: ft=jinja
{%- set tplroot = tpldir.split('/')[0] %}
{#- Start imports as #}
{%- import_yaml tplroot ~ "/defaults.yaml" as default_settings %}
{%- import_yaml tplroot ~ "/osarchmap.yaml" as osarchmap %}
{%- import_yaml tplroot ~ "/osfamilymap.yaml" as osfamilymap %}
{%- import_yaml tplroot ~ "/osmap.yaml" as osmap %}
{%- import_yaml tplroot ~ "/osfingermap.yaml" as osfingermap %}


{% set pillar_php_version = salt['pillar.get']('php:version', '7.0') %}
{%- if pillar_php_version is iterable and pillar_php_version is not string %}
{%- set php_version = pillar_php_version[0]|string %}
{#- Retrieve the config dict only once #}
{%- set _config = salt['config.get'](tplroot, default={}) %}

{%- set defaults = salt['grains.filter_by'](
default_settings,
default=tplroot,
merge=salt['grains.filter_by'](
osarchmap,
grain='osarch',
merge=salt['grains.filter_by'](
osfamilymap,
grain='os_family',
merge=salt['grains.filter_by'](
osmap,
grain='os',
merge=salt['grains.filter_by'](
osfingermap,
grain='osfinger',
merge=salt['grains.filter_by'](
_config,
default='php'
)
)
)
)
)
)
%}

{%- set config = salt['grains.filter_by'](
{'defaults': defaults},
default='defaults',
merge=_config
)
%}

{% set php = config %}

{%- do salt.log.debug('[map.jinja] php var is set as: ' ~ php) %}

{%- if php['pillar_php_version'] is iterable and php['pillar_php_version'] is not string %}
{%- set php_version = php['pillar_php_version'][0]|string %}
{% else %} {% else %}
{%- set php_version = pillar_php_version|string %}
{%- set php_version = php['pillar_php_version']|string %}
{% endif %} {% endif %}
{%- set freebsd_php_version = php_version.replace('.', '') %} {%- set freebsd_php_version = php_version.replace('.', '') %}


{%- endif %} {%- endif %}
{%- else %} {%- else %}
{%- if salt['grains.get']('osrelease')|string >= '18.04' %} {%- if salt['grains.get']('osrelease')|string >= '18.04' %}
{%- set php = salt['pillar.get']('php', {
{%- merge = php, salt['pillar.get']('php', {
'lookup': salt['grains.filter_by']({ 'lookup': salt['grains.filter_by']({
'Ubuntu': { 'Ubuntu': {
'pkgs': { 'pkgs': {
'apache2': 'libapache2-mod-php', 'apache2': 'libapache2-mod-php',
'apc': 'php', 'apc': 'php',
'apcu': 'php-apcu', 'apcu': 'php-apcu',
'bcmath': 'php7.2-bcmath',
'bz2': 'php7.2-bz2',
'bcmath': 'php' + php_version + '-bcmath',
'bz2': 'php' + php_version + '-bz2',
'cache-lite': 'php-cache-lite', 'cache-lite': 'php-cache-lite',
'cgi': 'php-cgi', 'cgi': 'php-cgi',
'cli': 'php-cli', 'cli': 'php-cli',
'console-table': 'php-console-table', 'console-table': 'php-console-table',
'composer_bin': 'composer', 'composer_bin': 'composer',
'curl': 'php-curl', 'curl': 'php-curl',
'dev': 'php7.2-dev',
'dba': 'php7.2-dba',
'dev': 'php' + php_version + '-dev',
'dba': 'php' + php_version + '-dba',
'fpm': 'php-fpm', 'fpm': 'php-fpm',
'gd': 'php-gd', 'gd': 'php-gd',
'geoip': 'php-geoip', 'geoip': 'php-geoip',
'net6': 'php-net-ipv6', 'net6': 'php-net-ipv6',
'oauth': 'php-oauth', 'oauth': 'php-oauth',
'odbc': 'php-odbc', 'odbc': 'php-odbc',
'opcache': 'php7.2-opcache',
'opcache': 'php' + php_version + '-opcache',
'pear': 'php-pear', 'pear': 'php-pear',
'pgsql': 'php-pgsql', 'pgsql': 'php-pgsql',
'php': 'php', 'php': 'php',
'sybase': 'php-sybase', 'sybase': 'php-sybase',
'tcpdf': 'php-tcpdf', 'tcpdf': 'php-tcpdf',
'temp_dir': '/tmp', 'temp_dir': '/tmp',
'tidy': 'php7.2-tidy',
'tidy': 'php' + php_version + '-tidy',
'xcache': 'php', 'xcache': 'php',
'xdebug': 'php-xdebug', 'xdebug': 'php-xdebug',
'xml': ['php-xml', 'php-xmlrpc'], 'xml': ['php-xml', 'php-xmlrpc'],
'xsl': 'php7.2-xsl',
'xsl': 'php' + php_version + '-xsl',
'zip': 'php-zip', 'zip': 'php-zip',
}, },
'fpm': { 'fpm': {
'conf': '/etc/php/7.2/fpm/php-fpm.conf',
'ini': '/etc/php/7.2/fpm/php.ini',
'pools': '/etc/php/7.2/fpm/pool.d',
'service': 'php7.2-fpm',
'conf': '/etc/php/' + php_version + '/fpm/php-fpm.conf',
'ini': '/etc/php/' + php_version + '/fpm/php.ini',
'pools': '/etc/php/' + php_version + '/fpm/pool.d',
'service': 'php' + php_version + '-fpm',
'user': 'root', 'user': 'root',
'group': 'root', 'group': 'root',
'defaults': odict([ 'defaults': odict([
('global', odict([ ('global', odict([
('pid', '/var/run/php7.2-fpm.pid'),
('error_log', '/var/log/php7.2-fpm.log'),
('pid', '/var/run/php' + php_version + '-fpm.pid'),
('error_log', '/var/log/php' + php_version + '-fpm.log'),
])), ])),
('include', '/etc/php/7.2/fpm/pool.d/*.conf'),
('include', '/etc/php/' + php_version + '/fpm/pool.d/*.conf'),
]), ]),
}, },
'hhvm': { 'hhvm': {

Loading…
Cancel
Save