瀏覽代碼

Merge e6d73ec512 into 9c69a4e906

pull/214/merge
waynegemmell 7 月之前
父節點
當前提交
9eabf5c546
沒有連結到貢獻者的電子郵件帳戶。
共有 8 個檔案被更改,包括 260 行新增57 行删除
  1. +5
    -0
      php/defaults.yaml
  2. +2
    -0
      php/fpm/config.sls
  3. +2
    -2
      php/fpm/init.sls
  4. +101
    -55
      php/map.jinja
  5. +35
    -0
      php/osarchmap.yaml
  6. +32
    -0
      php/osfamilymap.yaml
  7. +50
    -0
      php/osfingermap.yaml
  8. +33
    -0
      php/osmap.yaml

+ 5
- 0
php/defaults.yaml 查看文件

@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
php:
pillar_php_version: "7.0"

+ 2
- 0
php/fpm/config.sls 查看文件

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

+ 2
- 2
php/fpm/init.sls 查看文件

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


+ 101
- 55
php/map.jinja 查看文件

@@ -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('.', '') %}

@@ -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',
@@ -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',
@@ -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': {
@@ -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': {},
},
},
@@ -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',
@@ -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',
@@ -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': {
@@ -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': {},
},
},
@@ -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',
@@ -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',
@@ -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': {
@@ -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': {},
},
},

+ 35
- 0
php/osarchmap.yaml 查看文件

@@ -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

+ 32
- 0
php/osfamilymap.yaml 查看文件

@@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
#
# Setup variables using grains['os_family'] based logic.
# You just need to add the key:values for an `os_family` that differ
# from `defaults.yaml` + `osarch.yaml`.
# Only add an `os_family` which is/will be supported by the formula.
#
# If you do not need to provide defaults via the `os_family` grain,
# you will need to provide at least an empty dict in this file, e.g.
# osfamilymap: {}
---
Debian: {}

RedHat: {}

Suse: {}

Gentoo: {}

Arch: {}
Alpine: {}

FreeBSD: {}

OpenBSD: {}

Solaris: {}

Windows: {}

MacOS: {}

+ 50
- 0
php/osfingermap.yaml 查看文件

@@ -0,0 +1,50 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
#
# Setup variables using grains['osfinger'] based logic.
# You just need to add the key:values for an `osfinger` that differ
# from `defaults.yaml` + `osarch.yaml` + `os_family.yaml` + `osmap.yaml`.
# Only add an `osfinger` which is/will be supported by the formula.
#
# If you do not need to provide defaults via the `os_finger` grain,
# you will need to provide at least an empty dict in this file, e.g.
# osfingermap: {}
---
# os: Debian
Debian-10: {}
Debian-9: {}
Debian-8: {}

# os: Ubuntu
Ubuntu-22.04:
pillar_php_version: "8.1"
Ubuntu-20.04:
pillar_php_version: "7.4"
Ubuntu-19.10:
pillar_php_version: "7.3"
Ubuntu-18.04:
pillar_php_version: "7.2"

# os: Fedora
Fedora-31: {}
Fedora-30: {}

# os: CentOS
CentOS Linux-8: {}
CentOS Linux-7: {}

# os: Amazon
Amazon Linux-2: {}
Amazon Linux AMI-2018: {}

# os: SUSE
Leap-15: {}

# os: FreeBSD
FreeBSD-12: {}

# os: Windows
Windows-8.1: {}

# os: Gentoo
Gentoo-2: {}

+ 33
- 0
php/osmap.yaml 查看文件

@@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
#
# Setup variables using grains['os'] based logic.
# You just need to add the key:values for an `os` that differ
# from `defaults.yaml` + `osarch.yaml` + `os_family.yaml`.
# Only add an `os` which is/will be supported by the formula.
#
# If you do not need to provide defaults via the `os` grain,
# you will need to provide at least an empty dict in this file, e.g.
# osmap: {}
---
# os_family: Debian
Ubuntu: {}
Raspbian: {}

# os_family: RedHat
Fedora: {}
CentOS: {}
Amazon: {}

# os_family: Suse
SUSE: {}
openSUSE: {}

# os_family: Gentoo
Funtoo: {}

# os_family: Arch
Manjaro: {}

# os_family: Solaris
SmartOS: {}

Loading…
取消
儲存