Skip to content

Commit

Permalink
feat(ng): promote NG formula
Browse files Browse the repository at this point in the history
  • Loading branch information
nb committed Jul 24, 2019
1 parent d033381 commit 92a4456
Show file tree
Hide file tree
Showing 206 changed files with 4,140 additions and 5,211 deletions.
411 changes: 103 additions & 308 deletions docs/README.rst

Large diffs are not rendered by default.

12 changes: 3 additions & 9 deletions php/adodb.sls
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
- php
php-adodb:
pkg.installed:
- name: {{ php.adodb_pkg }}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set state = 'adodb' %}
{%- include tplroot ~ "/installed.jinja" %}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% from "php/ng/map.jinja" import php with context %}
{% from "php/ng/map.jinja" import phpng_version with context %}
{% set major = phpng_version.split('.')|first %}
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import php with context %}
{%- from tplroot ~ "/map.jinja" import php_version with context %}
{%- set major = php_version.split('.')|first %}

LoadModule php{{ major }}_module /usr/local/libexec/{{ php.lookup.apache2.name }}/libphp{{ major }}.so

Expand Down
5 changes: 3 additions & 2 deletions php/ng/apache2/ini.sls → php/apache2/ini.sls
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Manages the main Apache2 ini file
{% from "php/ng/map.jinja" import php with context %}
{% from "php/ng/ini.jinja" import php_ini %}
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import php with context %}
{%- from tplroot ~ "/ini.jinja" import php_ini %}
{% set settings = php.ini.defaults %}
{% do settings.update(php.apache2.ini.settings) %}
Expand Down
13 changes: 13 additions & 0 deletions php/apache2/init.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{%- if grains['os_family'] in ["Debian", "FreeBSD"] %}
include:
- php.apache2.install
{%- endif %} #END: os = Debian|FreeBSD
{%- if grains['os_family'] == "Debian" %}
- php.apache2.ini

extend:
php_apache2_ini:
file:
- require:
- sls: php.apache2.install
{%- endif %} #END: os = debian
19 changes: 19 additions & 0 deletions php/apache2/install.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import php with context %}
{%- set state = 'apache2' %}
{%- include tplroot ~ "/installed.jinja" %}
{%- if grains['os_family'] == "FreeBSD" %}
{{ php.lookup.apache2.module_config }}:
file.managed:
- source: salt://php/apache2/files/mod_php.conf.jinja
- template: jinja
{%- if salt['pillar.get']('php:use_apache_formula', True) %}
- makedirs: true
- require_in:
- sls: apache
- watch_in:
- module: apache-restart
{%- endif %} #END: use apache formula
{%- endif %} #END: os = debian
12 changes: 3 additions & 9 deletions php/apc.sls
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
- php
php-apc:
pkg.installed:
- name: {{ php.apc_pkg }}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set state = 'apc' %}
{%- include tplroot ~ "/installed.jinja" %}
12 changes: 3 additions & 9 deletions php/apcu.sls
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
- php
php-apcu:
pkg.installed:
- name: {{ php.apcu_pkg }}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set state = 'apcu' %}
{%- include tplroot ~ "/installed.jinja" %}
3 changes: 3 additions & 0 deletions php/auth-sasl.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%- set tplroot = tpldir.split('/')[0] %}
{%- set state = 'auth-sasl' %}
{%- include tplroot ~ "/installed.jinja" %}
12 changes: 3 additions & 9 deletions php/bcmath.sls
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
- php
php-bcmath:
pkg.installed:
- name: {{ php.bcmath_pkg }}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set state = 'bcmath' %}
{%- include tplroot ~ "/installed.jinja" %}
3 changes: 3 additions & 0 deletions php/bz2.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%- set tplroot = tpldir.split('/')[0] %}
{%- set state = 'bz2' %}
{%- include tplroot ~ "/installed.jinja" %}
3 changes: 3 additions & 0 deletions php/cache-lite.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%- set tplroot = tpldir.split('/')[0] %}
{%- set state = 'cache-lite' %}
{%- include tplroot ~ "/installed.jinja" %}
12 changes: 3 additions & 9 deletions php/cgi.sls
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
- php
php-cgi:
pkg.installed:
- name: {{ php.cgi_pkg }}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set state = 'cgi' %}
{%- include tplroot ~ "/installed.jinja" %}
9 changes: 0 additions & 9 deletions php/cli.sls

This file was deleted.

16 changes: 16 additions & 0 deletions php/cli/ini.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Manages the php cli main ini file
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import php with context %}
{%- from tplroot ~ "/ini.jinja" import php_ini %}
{%- set settings = php.ini.defaults %}
{%- for key, value in php.cli.ini.settings.items() %}
{%- if settings[key] is defined %}
{%- do settings[key].update(value) %}
{%- else %}
{%- do settings.update({key: value}) %}
{%- endif %}
{%- endfor %}
php_cli_ini:
{{ php_ini(php.lookup.cli.ini, php.cli.ini.opts, settings) }}
6 changes: 3 additions & 3 deletions php/ng/cli/init.sls → php/cli/init.sls
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Installs php-cli and manages the associated php.ini

include:
- php.ng.cli.install
- php.ng.cli.ini
- php.cli.install
- php.cli.ini

extend:
php_cli_ini:
file:
- require:
- sls: php.ng.cli.install
- sls: php.cli.install
18 changes: 18 additions & 0 deletions php/cli/install.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{%- set tplroot = tpldir.split('/')[0] %}
{%- set state = 'cli' %}
{%- include tplroot ~ "/installed.jinja" %}

{%- if salt['grains.get']('os_family') == "Debian" %}
{%- set current_php = salt['alternatives.show_current']('php') %}
{%- set php_version = salt['pillar.get']('php:version', '7.0')|string %}

php_{{ php_version }}_link:
alternatives.set:
- name: php
- path: /usr/bin/php{{ php_version }}
- require_in:
- pkg: php_install_{{ state }}
- onlyif:
- which php
- test {{ current_php }} != $(which php{{ php_version }})
{%- endif %}
36 changes: 26 additions & 10 deletions php/composer.sls
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
{%- from "php/map.jinja" import php with context %}
{%- set tplroot = tpldir.split('/')[0] %}
{% from tplroot ~ "/map.jinja" import php with context %}
{%- set install_file = php.local_bin + '/' + php.composer_bin %}
{% set install_file = php.lookup.pkgs.local_bin + '/' + php.lookup.pkgs.composer_bin %}
{%- if not salt['config.get']('sudo_user') %}
{%- set salt_user = salt['config.get']('user', 'root') %}
{%- else %}
{%- set salt_user = salt['config.get']('sudo_user', 'root') %}
{%- endif %}
{% if not salt['config.get']('sudo_user') %}
{% set salt_user = salt['config.get']('user', 'root') %}
{% else %}
{% set salt_user = salt['config.get']('sudo_user', 'root') %}
{% endif %}
{%- set salt_user_home = salt['user.info'](salt_user).get('home', '/root') %}
{% set salt_user_home = salt['user.info'](salt_user).get('home', '/root') %}
include:
- php.deprecated
- php
{% if grains['os_family'] == 'FreeBSD' %}
- php.filter
- php.hash
- php.json
- php.mbstring
- php.openssl
- php.phar
{% endif %}
get-composer:
file.managed:
- name: {{ php.temp_dir }}/installer
- name: {{ php.lookup.pkgs.temp_dir }}/installer
- mode: 0755
- unless: test -f {{ install_file }}
- source: https://getcomposer.org/installer
Expand All @@ -26,7 +34,11 @@ get-composer:
install-composer:
cmd.run:
<<<<<<< HEAD
- name: php {{ php.temp_dir }}/installer --filename={{ php.composer_bin }} --install-dir={{ php.local_bin }}
=======
- name: php {{ php.lookup.pkgs.temp_dir }}/installer --filename={{ php.lookup.pkgs.composer_bin }} --install-dir={{ php.lookup.pkgs.local_bin }}
>>>>>>> c31e513... feat(ng): promote NG formula
- unless: test -f {{ install_file }}
- env:
- HOME: {{ salt_user_home }}
Expand All @@ -47,7 +59,11 @@ update-composer:
{% else %}
- unless: test $(date -d "60 days $({{ install_file }} --version | cut -d ' ' -f 4,5)" "+%s") -gt $(date "+%s")
{% endif %}
<<<<<<< HEAD
- cwd: {{ php.local_bin }}
=======
- cwd: {{ php.lookup.pkgs.local_bin }}
>>>>>>> c31e513... feat(ng): promote NG formula
- env:
- HOME: {{ salt_user_home }}
- require:
Expand Down
3 changes: 3 additions & 0 deletions php/console-table.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%- set tplroot = tpldir.split('/')[0] %}
{%- set state = 'console-table' %}
{%- include tplroot ~ "/installed.jinja" %}
3 changes: 3 additions & 0 deletions php/ctype.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%- set tplroot = tpldir.split('/')[0] %}
{%- set state = 'ctype' %}
{%- include tplroot ~ "/installed.jinja" %}
12 changes: 3 additions & 9 deletions php/curl.sls
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
- php
php-curl:
pkg.installed:
- name: {{ php.curl_pkg }}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set state = 'curl' %}
{%- include tplroot ~ "/installed.jinja" %}
3 changes: 3 additions & 0 deletions php/dba.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%- set tplroot = tpldir.split('/')[0] %}
{%- set state = 'dba' %}
{%- include tplroot ~ "/installed.jinja" %}
12 changes: 3 additions & 9 deletions php/dev.sls
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
- php
php-dev:
pkg.installed:
- name: {{ php.dev_pkg }}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set state = 'dev' %}
{%- include tplroot ~ "/installed.jinja" %}
3 changes: 3 additions & 0 deletions php/dom.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%- set tplroot = tpldir.split('/')[0] %}
{%- set state = 'dom' %}
{%- include tplroot ~ "/installed.jinja" %}
3 changes: 3 additions & 0 deletions php/fileinfo.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%- set tplroot = tpldir.split('/')[0] %}
{%- set state = 'fileinfo' %}
{%- include tplroot ~ "/installed.jinja" %}
File renamed without changes.
3 changes: 3 additions & 0 deletions php/filter.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%- set tplroot = tpldir.split('/')[0] %}
{%- set state = 'filter' %}
{%- include tplroot ~ "/installed.jinja" %}
11 changes: 0 additions & 11 deletions php/fpm.sls

This file was deleted.

5 changes: 3 additions & 2 deletions php/ng/fpm/config.sls → php/fpm/config.sls
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Manages the php-fpm main ini file
{% from 'php/ng/map.jinja' import php with context %}
{% from "php/ng/ini.jinja" import php_ini %}
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import php with context %}
{%- from tplroot ~ "/ini.jinja" import php_ini %}
{% set ini_settings = php.ini.defaults %}
{% for key, value in php.fpm.config.ini.settings.items() %}
Expand Down
8 changes: 4 additions & 4 deletions php/ng/fpm/init.sls → php/fpm/init.sls
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Meta-state to fully install php.fpm

include:
- php.ng.fpm.config
- php.ng.fpm.service
- php.ng.fpm.pools
- php.fpm.config
- php.fpm.service
- php.fpm.pools

extend:
php_fpm_service:
Expand All @@ -12,7 +12,7 @@ extend:
- file: php_fpm_ini_config
- file: php_fpm_conf_config
- require:
- sls: php.ng.fpm.config
- sls: php.fpm.config
php_fpm_ini_config:
file:
- require:
Expand Down
3 changes: 3 additions & 0 deletions php/fpm/install.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%- set tplroot = tpldir.split('/')[0] %}
{% set state = 'fpm' %}
{% include tplroot ~ "/installed.jinja" %}
11 changes: 6 additions & 5 deletions php/ng/fpm/pools.sls → php/fpm/pools.sls
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Manages the php-fpm pools config files
{% from "php/ng/map.jinja" import php with context %}
{% from "php/ng/macro.jinja" import sls_block %}
{% from "php/ng/fpm/pools_config.sls" import pool_states with context %}
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import php with context %}
{%- from tplroot ~ "/macro.jinja" import sls_block %}
{%- from tplroot ~ "/fpm/pools_config.sls" import pool_states with context %}
{% macro file_requisites(states) %}
{%- for state in states %}
Expand All @@ -10,8 +11,8 @@
{% endmacro %}
include:
- php.ng.fpm.service
- php.ng.fpm.pools_config
- php.fpm.service
- php.fpm.pools_config
{% if pool_states %}
extend:
Expand Down
Loading

0 comments on commit 92a4456

Please sign in to comment.