From a126bf658b7c5e29dc37b519b5f4e0cef6ef7858 Mon Sep 17 00:00:00 2001 From: "Adrien \"ze\" Urban" Date: Tue, 2 Apr 2019 14:33:22 +0200 Subject: [PATCH 1/3] php.ng.modules: install modules... --- php/ng/modules.sls | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 php/ng/modules.sls diff --git a/php/ng/modules.sls b/php/ng/modules.sls new file mode 100644 index 00000000..d7e4a040 --- /dev/null +++ b/php/ng/modules.sls @@ -0,0 +1,23 @@ +{% from "php/ng/map.jinja" import php with context %} + +{% set modules = salt['pillar.get']('php:ng:modules') or [] %} +{% set base_name = 'php.ng.' %} +{% set existing_states = salt['cp.list_states']() %} + +{% set includes = [] %} +{% set install = [] %} + +{% for module in modules %} +{% set state = base_name + module %} +{% if state in existing_states %} +{% do includes.append(state) %} +{% else %} +{% do install.append(module) %} +{% endif %} +{% endfor %} + +include: {{ includes|json }} + +{% for state in install %} +{% include "php/ng/installed.jinja" %} +{% endfor %} From 2d1d8f23adef1b48635697fa341d52062d8e8225 Mon Sep 17 00:00:00 2001 From: "Adrien \"ze\" Urban" Date: Tue, 2 Apr 2019 14:26:35 +0200 Subject: [PATCH 2/3] php.ng.modules: documentation --- README.rst | 7 +++++++ pillar.example | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/README.rst b/README.rst index 316b2185..11399aeb 100644 --- a/README.rst +++ b/README.rst @@ -502,6 +502,13 @@ Disabled on opensuse need server:php:extensions repo Installs the php-memcached package. Disabled on opensuse need server:php:extensions repo +``php.ng.module`` +-------------------- + +Calls ``php.ng.`` for each entry in ``php:ng:modules`` if available, or +try to install the matching packages that can be set via from +``php:ng:lookup:pkgs`` + ``php.ng.mongo`` -------------------- diff --git a/pillar.example b/pillar.example index a2cd342f..60239525 100644 --- a/pillar.example +++ b/pillar.example @@ -178,6 +178,15 @@ php: 'CLI Server': cli_server_color: 'On' + # List of modules to install via php.ng.modules + modules: + # Calls `php.ng.` if available, or try to install the matching + # packages that can be set via from php:ng:lookup:pkgs + - cli + - fpm + - curl + - mysql + # When using php.ng.apache2 on FreeBSD: # Set this to False if you're not using apache-formula use_apache_formula: True From 0e431473cd7a6ed74031d6ecf5a183070fbacd92 Mon Sep 17 00:00:00 2001 From: "Adrien \"ze\" Urban" Date: Thu, 11 Apr 2019 10:41:25 +0200 Subject: [PATCH 3/3] php/ng/modules: use ~ operator Convert module to string before appending it to the base path to search for existing modules... --- php/ng/modules.sls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/ng/modules.sls b/php/ng/modules.sls index d7e4a040..56b20de0 100644 --- a/php/ng/modules.sls +++ b/php/ng/modules.sls @@ -8,7 +8,7 @@ {% set install = [] %} {% for module in modules %} -{% set state = base_name + module %} +{% set state = base_name ~ module %} {% if state in existing_states %} {% do includes.append(state) %} {% else %}