Skip to content

A start with splitting map.jinja and php works in focal (Ubuntu 20.04) #214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions php/defaults.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
php:
pillar_php_version: "7.0"
2 changes: 2 additions & 0 deletions php/fpm/config.sls
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
{%- from tplroot ~ "/map.jinja" import php with context %}
{%- 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 %}
{%- for key, value in php.fpm.config.ini.settings.items() %}
{%- if ini_settings[key] is defined %}
Expand Down
4 changes: 2 additions & 2 deletions php/fpm/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ include:
- php.fpm.service
- php.fpm.pools

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

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

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

Expand Down
156 changes: 101 additions & 55 deletions php/map.jinja
Original file line number Diff line number Diff line change
@@ -1,11 +1,57 @@
# -*- coding: utf-8 -*-
# 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 %}
{%- set php_version = pillar_php_version|string %}
{%- set php_version = php['pillar_php_version']|string %}
{% endif %}
{%- set freebsd_php_version = php_version.replace('.', '') %}

Expand Down Expand Up @@ -730,16 +776,16 @@
'apache2': 'libapache2-mod-php',
'apc': 'php',
'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',
'cgi': 'php-cgi',
'cli': 'php-cli',
'console-table': 'php-console-table',
'composer_bin': 'composer',
'curl': 'php-curl',
'dev': 'php7.2-dev',
'dba': 'php7.2-dba',
'dev': 'php' + php_version + '-dev',
'dba': 'php' + php_version + '-dba',
'fpm': 'php-fpm',
'gd': 'php-gd',
'geoip': 'php-geoip',
Expand All @@ -766,7 +812,7 @@
'net6': 'php-net-ipv6',
'oauth': 'php-oauth',
'odbc': 'php-odbc',
'opcache': 'php7.2-opcache',
'opcache': 'php' + php_version + '-opcache',
'pear': 'php-pear',
'pgsql': 'php-pgsql',
'php': 'php',
Expand All @@ -782,26 +828,26 @@
'sybase': 'php-sybase',
'tcpdf': 'php-tcpdf',
'temp_dir': '/tmp',
'tidy': 'php7.2-tidy',
'tidy': 'php' + php_version + '-tidy',
'xcache': 'php',
'xdebug': 'php-xdebug',
'xml': ['php-xml', 'php-xmlrpc'],
'xsl': 'php7.2-xsl',
'xsl': 'php' + php_version + '-xsl',
'zip': 'php-zip',
},
'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',
'group': 'root',
'defaults': 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': {
Expand Down Expand Up @@ -829,13 +875,13 @@
]),
},
'cli': {
'ini': '/etc/php/7.2/cli/php.ini',
'ini': '/etc/php/' + php_version + '/cli/php.ini',
},
'apache2': {
'ini': '/etc/php/7.2/apache2/php.ini',
'ini': '/etc/php/' + php_version + '/apache2/php.ini',
},
'xcache': {
'ini': '/etc/php/7.2/mods-available/xcache.ini',
'ini': '/etc/php/' + php_version + '/mods-available/xcache.ini',
'defaults': {},
},
},
Expand Down Expand Up @@ -1124,16 +1170,16 @@
'apache2': 'libapache2-mod-php',
'apc': 'php',
'apcu': 'php-apcu',
'bcmath': 'php7.1-bcmath',
'bz2': 'php7.1-bz2',
'bcmath': 'php' + php_version + '-bcmath',
'bz2': 'php' + php_version + '-bz2',
'cache-lite': 'php-cache-lite',
'cgi': 'php-cgi',
'cli': 'php-cli',
'console-table': 'php-console-table',
'composer_bin': 'composer',
'curl': 'php-curl',
'dba': 'php7.1-dba',
'dev': 'php7.1-dev',
'dba': 'php' + php_version + '-dba',
'dev': 'php' + php_version + '-dev',
'fpm': 'php-fpm',
'gd': 'php-gd',
'geoip': 'php-geoip',
Expand All @@ -1159,7 +1205,7 @@
'net4': 'php-net-ipv4',
'net6': 'php-net-ipv6',
'oauth': 'php-oauth',
'opcache': 'php7.1-opcache',
'opcache': 'php' + php_version + '-opcache',
'pear': 'php-pear',
'pgsql': 'php-pgsql',
'php': 'php',
Expand All @@ -1175,26 +1221,26 @@
'sybase': 'php-sybase',
'tcpdf': 'php-tcpdf',
'temp_dir': '/tmp',
'tidy': 'php7.1-tidy',
'tidy': 'php' + php_version + '-tidy',
'xcache': 'php',
'xdebug': 'php-xdebug',
'xml': ['php-xml', 'php-xmlrpc'],
'xsl': 'php7.1-xsl',
'xsl': 'php' + php_version + '-xsl',
'zip': 'php-zip',
},
'fpm': {
'conf': '/etc/php/7.1/fpm/php-fpm.conf',
'ini': '/etc/php/7.1/fpm/php.ini',
'pools': '/etc/php/7.1/fpm/pool.d',
'service': 'php7.1-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',
'group': 'root',
'defaults': odict([
('global', odict([
('pid', '/var/run/php7.1-fpm.pid'),
('error_log', '/var/log/php7.1-fpm.log'),
('pid', '/var/run/php' + php_version + '-fpm.pid'),
('error_log', '/var/log/php' + php_version + '-fpm.log'),
])),
('include', '/etc/php/7.1/fpm/pool.d/*.conf'),
('include', '/etc/php/' + php_version + '/fpm/pool.d/*.conf'),
]),
},
'hhvm': {
Expand Down Expand Up @@ -1222,13 +1268,13 @@
]),
},
'cli': {
'ini': '/etc/php/7.1/cli/php.ini',
'ini': '/etc/php/' + php_version + '/cli/php.ini',
},
'apache2': {
'ini': '/etc/php/7.1/apache2/php.ini',
'ini': '/etc/php/' + php_version + '/apache2/php.ini',
},
'xcache': {
'ini': '/etc/php/7.1/mods-available/xcache.ini',
'ini': '/etc/php/' + php_version + '/mods-available/xcache.ini',
'defaults': {},
},
},
Expand Down Expand Up @@ -1517,16 +1563,16 @@
'apache2': 'libapache2-mod-php',
'apc': 'php',
'apcu': 'php-apcu',
'bcmath': 'php7.0-bcmath',
'bz2': 'php7.0-bz2',
'bcmath': 'php' + php_version + '-bcmath',
'bz2': 'php' + php_version + '-bz2',
'cache-lite': 'php-cache-lite',
'cgi': 'php-cgi',
'cli': 'php-cli',
'console-table': 'php-console-table',
'composer_bin': 'composer',
'curl': 'php-curl',
'dba': 'php7.0-dba',
'dev': 'php7.0-dev',
'dba': 'php' + php_version + '-dba',
'dev': 'php' + php_version + '-dev',
'fpm': 'php-fpm',
'gd': 'php-gd',
'geoip': 'php-geoip',
Expand All @@ -1552,7 +1598,7 @@
'net4': 'php-net-ipv4',
'net6': 'php-net-ipv6',
'oauth': 'php-oauth',
'opcache': 'php7.0-opcache',
'opcache': 'php' + php_version + '-opcache',
'pear': 'php-pear',
'pgsql': 'php-pgsql',
'php': 'php',
Expand All @@ -1568,26 +1614,26 @@
'sybase': 'php-sybase',
'tcpdf': 'php-tcpdf',
'temp_dir': '/tmp',
'tidy': 'php7.0-tidy',
'tidy': 'php' + php_version + '-tidy',
'xcache': 'php',
'xdebug': 'php-xdebug',
'xml': ['php-xml', 'php-xmlrpc'],
'xsl': 'php7.0-xsl',
'xsl': 'php' + php_version + '-xsl',
'zip': 'php-zip',
},
'fpm': {
'conf': '/etc/php/7.0/fpm/php-fpm.conf',
'ini': '/etc/php/7.0/fpm/php.ini',
'pools': '/etc/php/7.0/fpm/pool.d',
'service': 'php7.0-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',
'group': 'root',
'defaults': odict([
('global', odict([
('pid', '/var/run/php7.0-fpm.pid'),
('error_log', '/var/log/php7.0-fpm.log'),
('pid', '/var/run/php' + php_version + '-fpm.pid'),
('error_log', '/var/log/php' + php_version + '-fpm.log'),
])),
('include', '/etc/php/7.0/fpm/pool.d/*.conf'),
('include', '/etc/php/' + php_version + '/fpm/pool.d/*.conf'),
]),
},
'hhvm': {
Expand Down Expand Up @@ -1615,13 +1661,13 @@
]),
},
'cli': {
'ini': '/etc/php/7.0/cli/php.ini',
'ini': '/etc/php/' + php_version + '/cli/php.ini',
},
'apache2': {
'ini': '/etc/php/7.0/apache2/php.ini',
'ini': '/etc/php/' + php_version + '/apache2/php.ini',
},
'xcache': {
'ini': '/etc/php/7.0/mods-available/xcache.ini',
'ini': '/etc/php/' + php_version + '/mods-available/xcache.ini',
'defaults': {},
},
},
Expand Down
35 changes: 35 additions & 0 deletions php/osarchmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
#
# Setup variables using grains['osarch'] based logic.
# You just need to add the key:values for an `osarch` that differ
# from `defaults.yaml`.
# Only add an `osarch` which is/will be supported by the formula.
#
# If you do not need to provide defaults via the `osarch` grain,
# you will need to provide at least an empty dict in this file, e.g.
# osarch: {}
---
amd64:
arch: amd64

x86_64:
arch: amd64

386:
arch: 386

arm64:
arch: arm64

armv6l:
arch: armv6l

armv7l:
arch: armv7l

ppc64le:
arch: ppc64le

s390x:
arch: s390x
Loading
Loading