From d26c4f80570361e41bc94c2d30216564293f137d Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Wed, 4 Sep 2019 00:35:10 +0200 Subject: [PATCH 01/12] refactor(macro): extract file_requisites macro --- php/fpm/pools.sls | 7 +------ php/macro.jinja | 6 ++++++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/php/fpm/pools.sls b/php/fpm/pools.sls index bd5cc28..ff03e88 100644 --- a/php/fpm/pools.sls +++ b/php/fpm/pools.sls @@ -1,14 +1,9 @@ # Manages the php-fpm pools config files {% from "php/map.jinja" import php with context %} {% from "php/macro.jinja" import sls_block %} +{% from "php/macro.jinja" import file_requisites %} {% from "php/fpm/pools_config.sls" import pool_states with context %} -{% macro file_requisites(states) %} - {%- for state in states %} - - file: {{ state }} - {%- endfor -%} -{% endmacro %} - include: - php.fpm.service - php.fpm.pools_config diff --git a/php/macro.jinja b/php/macro.jinja index 5790820..b5c76c3 100644 --- a/php/macro.jinja +++ b/php/macro.jinja @@ -27,3 +27,9 @@ {{ ret|json() }} {%- endmacro -%} + +{% macro file_requisites(states) %} + {%- for state in states %} + - file: {{ state }} + {%- endfor -%} +{% endmacro %} From 3c9efc713d8cddf2fe9609594b0ac0b17a8a6ea9 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Wed, 4 Sep 2019 01:04:43 +0200 Subject: [PATCH 02/12] feat(repo): add repo pattern so we can set distro repo during tests --- php/macro.jinja | 8 ++++++++ php/repo/init.sls | 5 +++++ php/repo/install.sls | 11 +++++++++++ 3 files changed, 24 insertions(+) create mode 100644 php/repo/init.sls create mode 100644 php/repo/install.sls diff --git a/php/macro.jinja b/php/macro.jinja index b5c76c3..f5e2269 100644 --- a/php/macro.jinja +++ b/php/macro.jinja @@ -33,3 +33,11 @@ - file: {{ state }} {%- endfor -%} {% endmacro %} + +{%- macro format_kwargs(kwarg) -%} + {%- filter indent(4) %} + {%- for k, v in kwarg|dictsort() %} +- {{ k }}: {{ v }} + {%- endfor %} + {%- endfilter %} +{%- endmacro %} diff --git a/php/repo/init.sls b/php/repo/init.sls new file mode 100644 index 0000000..d3e5518 --- /dev/null +++ b/php/repo/init.sls @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +include: + - .install diff --git a/php/repo/install.sls b/php/repo/install.sls new file mode 100644 index 0000000..41ee3a3 --- /dev/null +++ b/php/repo/install.sls @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +{#- Get the `tplroot` from `tpldir` #} +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import php with context %} +{%- from tplroot ~ "/macro.jinja" import format_kwargs with context %} + +php/repo/install: + pkgrepo.managed: + {{- format_kwargs(php.repo) }} From d4fc842a6246bd5c6a81bddc5a63fa4fc0c59d91 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Wed, 4 Sep 2019 01:06:31 +0200 Subject: [PATCH 03/12] ci(kitchen): add test pillars for Debian and call some states --- kitchen.yml | 7 ++- test/salt/pillar/debian.sls | 86 ++++++++++++++++++++++++++++++++++++- 2 files changed, 91 insertions(+), 2 deletions(-) diff --git a/kitchen.yml b/kitchen.yml index 3d492de..ad77345 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -148,7 +148,12 @@ suites: state_top: base: '*': - - php + - php.repo + - php.fpm.install + - php.fpm.config + - php.fpm.pools + - php.modules + - php.fpm.service pillars: top.sls: base: diff --git a/test/salt/pillar/debian.sls b/test/salt/pillar/debian.sls index b6880f2..87b53e9 100644 --- a/test/salt/pillar/debian.sls +++ b/test/salt/pillar/debian.sls @@ -1,4 +1,88 @@ # -*- coding: utf-8 -*- # vim: ft=yaml --- -php: {} +php: + repo: + humanname: php-sury repo + name: "deb https://packages.sury.org/php/ {{ salt['grains.get']('oscodename') }} main" + file: /etc/apt/sources.list.d/php-sury.list + key_url: https://packages.sury.org/php/apt.gpg + + version: + - '5.6' + - '7.3' + + fpm: + config: + ini: + settings: + Assertion: + zend.assertions: -1 + PHP: + expose_php: 'Off' + default_charset: UTF-8 + cgi.fix_pathinfo: 0 + Date: + date.timezone: Europe/Paris + + pools: + 'radius-admin.conf': + enabled: true + phpversion: '5.6' + settings: + radius-admin: + user: www-data + group: www-data + listen: /tmp/php-fpm-radius-admin.sock + listen.mode: '0666' + pm: static + pm.max_children: 3 + pm.max_requests: 500 + pm.status_path: /php-status + ping.path: /php-ping + catch_workers_output: 'yes' + security.limit_extensions: .php + 'php_admin_value[date.timezone]': Europe/Paris + + 'ldap-admin.conf': + enabled: true + phpversion: '7.3' + settings: + ldap-admin: + user: www-data + group: www-data + listen: /tmp/php-fpm-ldap-admin2.sock + listen.mode: '0666' + pm: static + pm.max_children: 3 + pm.max_requests: 500 + pm.status_path: /php-status + ping.path: /php-ping + catch_workers_output: 'yes' + security.limit_extensions: .php + 'php_admin_value[date.timezone]': Europe/Paris + + cli: + ini: + settings: + Assertion: + zend.assertions: -1 + PHP: + default_charset: UTF-8 + Date: + date.timezone: Europe/Paris + + modules: + - bz2 + - cli + - curl + - gd + - imagick + - imap + - intl + - mbstring + - mysql + - readline + - redis + - xml + - zip From d4772f92fa7629235672f36508fea748fffb914e Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Wed, 4 Sep 2019 01:08:56 +0200 Subject: [PATCH 04/12] fix(fpm): be sure to restart all Php instances in case of multi-versions --- php/fpm/init.sls | 36 +++++++++++++++++++++++------------- php/fpm/pools.sls | 19 +++++++++++++++++++ php/fpm/service.sls | 20 ++++++++++++++++++++ 3 files changed, 62 insertions(+), 13 deletions(-) diff --git a/php/fpm/init.sls b/php/fpm/init.sls index e7b56ce..85b38fa 100644 --- a/php/fpm/init.sls +++ b/php/fpm/init.sls @@ -6,39 +6,49 @@ include: - php.fpm.pools {% set pillar_php_version = salt['pillar.get']('php:version', '7.0') %} + extend: - php_fpm_service: +{% if pillar_php_version is iterable and pillar_php_version is not string %} + {% for version in pillar_php_version %} + + php_fpm_service_{{ version }}: service: - watch: - {% if pillar_php_version is iterable and pillar_php_version is not string %} - {% for version in pillar_php_version %} - file: php_fpm_ini_config_{{ version }} - file: php_fpm_conf_config_{{ version }} - {% endfor %} - {% else %} - - file: php_fpm_ini_config - - file: php_fpm_conf_config - {% endif %} - require: - sls: php.fpm.config - {% if pillar_php_version is iterable and pillar_php_version is not string %} - {% for version in pillar_php_version %} + php_fpm_ini_config_{{ version }}: file: - require: - pkg: php_install_fpm + php_fpm_conf_config_{{ version }}: file: - require: - pkg: php_install_fpm - {% endfor %} - {% else %} + + {% endfor %} + +{% else %} + + php_fpm_service: + service: + - watch: + - file: php_fpm_ini_config + - file: php_fpm_conf_config + - require: + - sls: php.fpm.config + php_fpm_ini_config: file: - require: - pkg: php_install_fpm + php_fpm_conf_config: file: - require: - pkg: php_install_fpm - {% endif %} + +{% endif %} diff --git a/php/fpm/pools.sls b/php/fpm/pools.sls index ff03e88..01e8202 100644 --- a/php/fpm/pools.sls +++ b/php/fpm/pools.sls @@ -8,12 +8,31 @@ include: - php.fpm.service - php.fpm.pools_config +{% set pillar_php_version = salt['pillar.get']('php:version', '7.0') %} + {% if pool_states %} extend: + +{% if pillar_php_version is iterable and pillar_php_version is not string %} + {% for version in pillar_php_version %} + php_fpm_service_{{ version }}: + service: + - watch: +{{ file_requisites(pool_states) }} + - require: +{{ file_requisites(pool_states) }} + + {% endfor %} + +{% else %} + php_fpm_service: service: - watch: {{ file_requisites(pool_states) }} - require: {{ file_requisites(pool_states) }} + +{% endif %} + {% endif %} diff --git a/php/fpm/service.sls b/php/fpm/service.sls index bed2ff2..1eb2f66 100644 --- a/php/fpm/service.sls +++ b/php/fpm/service.sls @@ -3,10 +3,28 @@ {% from "php/macro.jinja" import sls_block %} {% set service_function = {True:'running', False:'dead'}.get(php.fpm.service.enabled) %} +{% set pillar_php_version = salt['pillar.get']('php:version', '7.0') %} include: - php.fpm.install +{% if pillar_php_version is iterable and pillar_php_version is not string %} + {% for version in pillar_php_version %} + +php_fpm_service_{{ version }}: + service.{{ service_function }}: + {{ sls_block(php.fpm.service.opts) }} + - name: {{ 'php' ~ version ~ '-fpm' }} + - enable: {{ php.fpm.service.enabled }} + - require: + - sls: php.fpm.install + - watch: + - pkg: php_install_fpm + + {% endfor %} + +{% else %} + php_fpm_service: service.{{ service_function }}: {{ sls_block(php.fpm.service.opts) }} @@ -16,3 +34,5 @@ php_fpm_service: - sls: php.fpm.install - watch: - pkg: php_install_fpm + +{% endif %} From 59f648c0671a96ee89b858e092713308e7342754 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Wed, 4 Sep 2019 01:12:28 +0200 Subject: [PATCH 05/12] test(package): fix package spec in case of multi Php versions --- .../default/controls/package_spec.rb | 69 +++++++++++++++---- 1 file changed, 54 insertions(+), 15 deletions(-) diff --git a/test/integration/default/controls/package_spec.rb b/test/integration/default/controls/package_spec.rb index 6023dbc..b296f4c 100644 --- a/test/integration/default/controls/package_spec.rb +++ b/test/integration/default/controls/package_spec.rb @@ -1,22 +1,61 @@ control 'Php package' do title 'should be installed' - pkg_name = - case os[:family] - when 'debian' - case os[:name] - when 'ubuntu' - 'php' - when 'debian' - 'php7.0' - end - when 'redhat', 'fedora' - 'php' - when 'suse' - 'php5' + + + def test_debian + describe package('php-imagick') do + it { should be_installed } end - describe package(pkg_name) do - it { should be_installed } + describe package('php-redis') do + it { should be_installed } + end + + %w[ + bz2 cli curl fpm gd imap intl mbstring + mysql readline xml zip + ].each do |pkg| + + describe package("php5.6-#{pkg}") do + it { should be_installed } + end + + describe package("php7.3-#{pkg}") do + it { should be_installed } + end + end + end + + def test_ubuntu + describe package(pkg_name) do + it { should be_installed } + end + end + + def test_redhat + describe package('php') do + it { should be_installed } + end + end + + def test_suse + describe package('php5') do + it { should be_installed } + end + end + + case os[:family] + when 'debian' + case os[:name] + when 'ubuntu' + test_ubuntu + when 'debian' + test_debian + end + when 'redhat', 'fedora' + test_redhat + when 'suse' + test_suse end end From baeac04bd9bb691b5a99f44a379018c59d9f7060 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Wed, 4 Sep 2019 01:12:38 +0200 Subject: [PATCH 06/12] test(service): add tests on Php services --- .../default/controls/service_spec.rb | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 test/integration/default/controls/service_spec.rb diff --git a/test/integration/default/controls/service_spec.rb b/test/integration/default/controls/service_spec.rb new file mode 100644 index 0000000..15672d5 --- /dev/null +++ b/test/integration/default/controls/service_spec.rb @@ -0,0 +1,50 @@ +control 'Php service' do + title 'should be running and enabled' + + def test_debian + describe service('php5.6-fpm') do + it { should be_enabled } + it { should be_running } + end + + describe service('php7.3-fpm') do + it { should be_enabled } + it { should be_running } + end + end + + def test_ubuntu + describe service(pkg_name) do + it { should be_enabled } + it { should be_running } + end + end + + def test_redhat + describe service('php') do + it { should be_enabled } + it { should be_running } + end + end + + def test_suse + describe service('php5') do + it { should be_enabled } + it { should be_running } + end + end + + case os[:family] + when 'debian' + case os[:name] + when 'ubuntu' + test_ubuntu + when 'debian' + test_debian + end + when 'redhat', 'fedora' + test_redhat + when 'suse' + test_suse + end +end From dc12a0bbf232436f985aeac58c3512920943b42b Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Wed, 4 Sep 2019 01:13:22 +0200 Subject: [PATCH 07/12] style(spec): remove empty lines --- test/integration/default/controls/package_spec.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/integration/default/controls/package_spec.rb b/test/integration/default/controls/package_spec.rb index b296f4c..6fdeb6e 100644 --- a/test/integration/default/controls/package_spec.rb +++ b/test/integration/default/controls/package_spec.rb @@ -1,8 +1,6 @@ control 'Php package' do title 'should be installed' - - def test_debian describe package('php-imagick') do it { should be_installed } From 6555cf043265520739312c777e1f19aa578be163 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Wed, 4 Sep 2019 01:33:06 +0200 Subject: [PATCH 08/12] test(config): add tests on Php config --- .../default/controls/config_spec.rb | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 test/integration/default/controls/config_spec.rb diff --git a/test/integration/default/controls/config_spec.rb b/test/integration/default/controls/config_spec.rb new file mode 100644 index 0000000..17e26ed --- /dev/null +++ b/test/integration/default/controls/config_spec.rb @@ -0,0 +1,46 @@ +control 'Php configuration' do + title 'should match desired lines' + + def test_debian + describe file('/etc/php/5.6/fpm/pool.d/radius-admin.conf') do + its('content') { should include '[radius-admin]' } + its('content') { should include 'php_admin_value[date.timezone] = Europe/Paris' } + end + + describe file('/etc/php/7.3/fpm/pool.d/ldap-admin.conf') do + its('content') { should include '[ldap-admin]' } + its('content') { should include 'php_admin_value[date.timezone] = Europe/Paris' } + end + + describe file('/etc/php/5.6/fpm/php.ini') do + its('content') { should include 'date.timezone = Europe/Paris' } + end + + describe file('/etc/php/7.3/fpm/php.ini') do + its('content') { should include 'date.timezone = Europe/Paris' } + end + end + + def test_ubuntu + end + + def test_redhat + end + + def test_suse + end + + case os[:family] + when 'debian' + case os[:name] + when 'ubuntu' + test_ubuntu + when 'debian' + test_debian + end + when 'redhat', 'fedora' + test_redhat + when 'suse' + test_suse + end +end From 23214bfa78a5d2abad16d997dd63e57f821387df Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Wed, 4 Sep 2019 01:39:38 +0200 Subject: [PATCH 09/12] fix(tests): don't test services on Suse and RedHat --- test/integration/default/controls/service_spec.rb | 8 -------- 1 file changed, 8 deletions(-) diff --git a/test/integration/default/controls/service_spec.rb b/test/integration/default/controls/service_spec.rb index 15672d5..15db1eb 100644 --- a/test/integration/default/controls/service_spec.rb +++ b/test/integration/default/controls/service_spec.rb @@ -21,17 +21,9 @@ control 'Php service' do end def test_redhat - describe service('php') do - it { should be_enabled } - it { should be_running } - end end def test_suse - describe service('php5') do - it { should be_enabled } - it { should be_running } - end end case os[:family] From b13bed2a48c571a99b51e9ee486174aaaf9da771 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Wed, 4 Sep 2019 02:58:06 +0200 Subject: [PATCH 10/12] test(ubuntu): fix tests on Ubuntu distro --- php/map.jinja | 3 ++- test/integration/default/controls/config_spec.rb | 10 +--------- test/integration/default/controls/package_spec.rb | 13 +------------ test/integration/default/controls/service_spec.rb | 14 +------------- test/salt/pillar/debian.sls | 9 +++++++++ 5 files changed, 14 insertions(+), 35 deletions(-) diff --git a/php/map.jinja b/php/map.jinja index 9fc102c..14ed704 100644 --- a/php/map.jinja +++ b/php/map.jinja @@ -67,7 +67,8 @@ 'php': 'php' + php_version, 'phpenmod_command': 'phpenmod -v' + php_version, 'pspell': 'php' + php_version + '-pspell', - 'redis': 'php' + php_version + '-redis', + 'readline': 'php' + php_version + '-readline', + 'redis': 'php-redis', 'seclib': ['php-phpseclib', 'php-seclib'], 'snmp': 'php' + php_version + '-snmp', 'soap': 'php' + php_version + '-soap', diff --git a/test/integration/default/controls/config_spec.rb b/test/integration/default/controls/config_spec.rb index 17e26ed..fee1f2d 100644 --- a/test/integration/default/controls/config_spec.rb +++ b/test/integration/default/controls/config_spec.rb @@ -21,9 +21,6 @@ control 'Php configuration' do end end - def test_ubuntu - end - def test_redhat end @@ -32,12 +29,7 @@ control 'Php configuration' do case os[:family] when 'debian' - case os[:name] - when 'ubuntu' - test_ubuntu - when 'debian' - test_debian - end + test_debian when 'redhat', 'fedora' test_redhat when 'suse' diff --git a/test/integration/default/controls/package_spec.rb b/test/integration/default/controls/package_spec.rb index 6fdeb6e..ce385f7 100644 --- a/test/integration/default/controls/package_spec.rb +++ b/test/integration/default/controls/package_spec.rb @@ -25,12 +25,6 @@ control 'Php package' do end end - def test_ubuntu - describe package(pkg_name) do - it { should be_installed } - end - end - def test_redhat describe package('php') do it { should be_installed } @@ -45,12 +39,7 @@ control 'Php package' do case os[:family] when 'debian' - case os[:name] - when 'ubuntu' - test_ubuntu - when 'debian' - test_debian - end + test_debian when 'redhat', 'fedora' test_redhat when 'suse' diff --git a/test/integration/default/controls/service_spec.rb b/test/integration/default/controls/service_spec.rb index 15db1eb..d1932ab 100644 --- a/test/integration/default/controls/service_spec.rb +++ b/test/integration/default/controls/service_spec.rb @@ -13,13 +13,6 @@ control 'Php service' do end end - def test_ubuntu - describe service(pkg_name) do - it { should be_enabled } - it { should be_running } - end - end - def test_redhat end @@ -28,12 +21,7 @@ control 'Php service' do case os[:family] when 'debian' - case os[:name] - when 'ubuntu' - test_ubuntu - when 'debian' - test_debian - end + test_debian when 'redhat', 'fedora' test_redhat when 'suse' diff --git a/test/salt/pillar/debian.sls b/test/salt/pillar/debian.sls index 87b53e9..64cddd0 100644 --- a/test/salt/pillar/debian.sls +++ b/test/salt/pillar/debian.sls @@ -2,11 +2,20 @@ # vim: ft=yaml --- php: +{% if salt['grains.get']('os') == 'Ubuntu' %} + use_external_repo: true + repo: + humanname: php-sury ppa + name: "deb http://ppa.launchpad.net/ondrej/php/ubuntu {{ salt['grains.get']('oscodename') }} main" + file: /etc/apt/sources.list.d/php-sury.list + key_url: https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c +{% else %} repo: humanname: php-sury repo name: "deb https://packages.sury.org/php/ {{ salt['grains.get']('oscodename') }} main" file: /etc/apt/sources.list.d/php-sury.list key_url: https://packages.sury.org/php/apt.gpg +{% endif %} version: - '5.6' From 496ec28dae41dd244bc77f92d0bfda7927f56563 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Wed, 4 Sep 2019 22:46:11 +0200 Subject: [PATCH 11/12] fix(xdebug): fix xdebug package name --- php/map.jinja | 4 ++-- test/integration/default/controls/package_spec.rb | 4 ++++ test/salt/pillar/debian.sls | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/php/map.jinja b/php/map.jinja index 14ed704..0b4cb18 100644 --- a/php/map.jinja +++ b/php/map.jinja @@ -82,7 +82,7 @@ 'tcpdf': 'php-tcpdf', 'temp_dir': '/tmp', 'tidy': 'php' + php_version + '-tidy', - 'xdebug': 'php' + php_version + '-xdebug', + 'xdebug': 'php-xdebug', 'xml': ['php' + php_version + '-xml', 'php' + php_version + '-xmlrpc'], 'xsl': 'php' + php_version + '-xsl', 'zip': 'php' + php_version + '-zip', @@ -2264,7 +2264,7 @@ 'tcpdf': 'php-tcpdf', 'temp_dir': '/tmp', 'tidy': 'php' + php_version + '-tidy', - 'xdebug': 'php' + php_version + '-xdebug', + 'xdebug': 'php-xdebug', 'xml': ['php' + php_version + '-xml', 'php' + php_version + '-xmlrpc'], 'xsl': 'php' + php_version + '-xsl', 'zip': 'php' + php_version + '-zip', diff --git a/test/integration/default/controls/package_spec.rb b/test/integration/default/controls/package_spec.rb index ce385f7..860c92c 100644 --- a/test/integration/default/controls/package_spec.rb +++ b/test/integration/default/controls/package_spec.rb @@ -10,6 +10,10 @@ control 'Php package' do it { should be_installed } end + describe package('php-xdebug') do + it { should be_installed } + end + %w[ bz2 cli curl fpm gd imap intl mbstring mysql readline xml zip diff --git a/test/salt/pillar/debian.sls b/test/salt/pillar/debian.sls index 64cddd0..16b23a5 100644 --- a/test/salt/pillar/debian.sls +++ b/test/salt/pillar/debian.sls @@ -93,5 +93,6 @@ php: - mysql - readline - redis + - xdebug - xml - zip From 6cba4af4f7ccd9f8c7f6636efb92d0cb51857705 Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Wed, 4 Sep 2019 19:26:30 +0100 Subject: [PATCH 12/12] fix(yamllint): use separate suite for `ubuntu` * Semi-automated using https://github.com/myii/ssf-formula/pull/18 * Close #174 --- .travis.yml | 10 +++++----- kitchen.yml | 32 ++++++++++++++++++++++++++++---- test/salt/pillar/debian.sls | 10 +--------- test/salt/pillar/ubuntu.sls | 12 ++++++++++++ 4 files changed, 46 insertions(+), 18 deletions(-) create mode 100644 test/salt/pillar/ubuntu.sls diff --git a/.travis.yml b/.travis.yml index cb68c07..6a9af09 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,22 +20,22 @@ services: env: matrix: - INSTANCE: debian-debian-9-develop-py3 - # - INSTANCE: debian-ubuntu-1804-develop-py3 + # - INSTANCE: ubuntu-ubuntu-1804-develop-py3 # - INSTANCE: redhat-centos-7-develop-py3 # - INSTANCE: redhat-fedora-29-develop-py3 # - INSTANCE: suse-opensuse-leap-15-develop-py3 # - INSTANCE: debian-debian-9-2019-2-py3 - - INSTANCE: debian-ubuntu-1804-2019-2-py3 + - INSTANCE: ubuntu-ubuntu-1804-2019-2-py3 - INSTANCE: redhat-centos-7-2019-2-py3 # - INSTANCE: redhat-fedora-29-2019-2-py3 # - INSTANCE: suse-opensuse-leap-15-2019-2-py3 # - INSTANCE: debian-debian-9-2018-3-py2 - # - INSTANCE: debian-ubuntu-1604-2018-3-py2 + # - INSTANCE: ubuntu-ubuntu-1604-2018-3-py2 # - INSTANCE: redhat-centos-7-2018-3-py2 - INSTANCE: redhat-fedora-29-2018-3-py2 - INSTANCE: suse-opensuse-leap-42-2018-3-py2 # - INSTANCE: debian-debian-8-2017-7-py2 - # - INSTANCE: debian-ubuntu-1604-2017-7-py2 + # - INSTANCE: ubuntu-ubuntu-1604-2017-7-py2 - INSTANCE: redhat-centos-6-2017-7-py2 # - INSTANCE: redhat-fedora-28-2017-7-py2 # - INSTANCE: suse-opensuse-leap-42-2017-7-py2 @@ -54,7 +54,7 @@ jobs: # Install and run `yamllint` - pip install --user yamllint # yamllint disable-line rule:line-length - - yamllint -s . .yamllint pillar.example test/salt/pillar/debian.sls test/salt/pillar/redhat.sls test/salt/pillar/suse.sls + - yamllint -s . .yamllint pillar.example test/salt/pillar/debian.sls test/salt/pillar/ubuntu.sls test/salt/pillar/redhat.sls test/salt/pillar/suse.sls # Install and run `commitlint` - npm install @commitlint/config-conventional -D - npm install @commitlint/travis-cli -D diff --git a/kitchen.yml b/kitchen.yml index ad77345..457532d 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -137,13 +137,9 @@ suites: - name: debian includes: - debian-9-develop-py3 - - ubuntu-1804-develop-py3 - debian-9-2019-2-py3 - - ubuntu-1804-2019-2-py3 - debian-9-2018-3-py2 - - ubuntu-1604-2018-3-py2 - debian-8-2017-7-py2 - - ubuntu-1604-2017-7-py2 provisioner: state_top: base: @@ -164,6 +160,34 @@ suites: verifier: inspec_tests: - path: test/integration/default + - name: ubuntu + includes: + - ubuntu-1804-develop-py3 + - ubuntu-1804-2019-2-py3 + - ubuntu-1604-2018-3-py2 + - ubuntu-1604-2017-7-py2 + provisioner: + state_top: + base: + '*': + - php.repo + - php.fpm.install + - php.fpm.config + - php.fpm.pools + - php.modules + - php.fpm.service + pillars: + top.sls: + base: + '*': + - php + - ubuntu + pillars_from_files: + php.sls: test/salt/pillar/debian.sls + ubuntu.sls: test/salt/pillar/ubuntu.sls + verifier: + inspec_tests: + - path: test/integration/default - name: redhat includes: - centos-7-develop-py3 diff --git a/test/salt/pillar/debian.sls b/test/salt/pillar/debian.sls index 16b23a5..d63e315 100644 --- a/test/salt/pillar/debian.sls +++ b/test/salt/pillar/debian.sls @@ -2,20 +2,12 @@ # vim: ft=yaml --- php: -{% if salt['grains.get']('os') == 'Ubuntu' %} - use_external_repo: true - repo: - humanname: php-sury ppa - name: "deb http://ppa.launchpad.net/ondrej/php/ubuntu {{ salt['grains.get']('oscodename') }} main" - file: /etc/apt/sources.list.d/php-sury.list - key_url: https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c -{% else %} repo: humanname: php-sury repo + # yamllint disable-line rule:line-length name: "deb https://packages.sury.org/php/ {{ salt['grains.get']('oscodename') }} main" file: /etc/apt/sources.list.d/php-sury.list key_url: https://packages.sury.org/php/apt.gpg -{% endif %} version: - '5.6' diff --git a/test/salt/pillar/ubuntu.sls b/test/salt/pillar/ubuntu.sls new file mode 100644 index 0000000..2f09005 --- /dev/null +++ b/test/salt/pillar/ubuntu.sls @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +php: + use_external_repo: true + repo: + humanname: php-sury ppa + # yamllint disable-line rule:line-length + name: "deb http://ppa.launchpad.net/ondrej/php/ubuntu {{ salt['grains.get']('oscodename') }} main" + file: /etc/apt/sources.list.d/php-sury.list + # yamllint disable-line rule:line-length + key_url: https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c