Add support for external config generation
diff --git a/README.rst b/README.rst
index 67b17c9..8f580b7 100644
--- a/README.rst
+++ b/README.rst
@@ -687,6 +687,32 @@
multipath:
enabled: false
+External config generation
+--------------------------
+
+You are able to use config support metadata between formulas and only generate
+config files for external use, eg. docker, etc.
+
+.. code-block:: yaml
+
+ parameters:
+ linux:
+ system:
+ config:
+ pillar:
+ jenkins:
+ master:
+ home: /srv/volumes/jenkins
+ approved_scripts:
+ - method java.net.URL openConnection
+ credentials:
+ - type: username_password
+ scope: global
+ id: test
+ desc: Testing credentials
+ username: test
+ password: test
+
Usage
=====
diff --git a/linux/system/config.sls b/linux/system/config.sls
new file mode 100644
index 0000000..5e6c51e
--- /dev/null
+++ b/linux/system/config.sls
@@ -0,0 +1,33 @@
+{%- from "linux/map.jinja" import system with context %}
+{%- macro load_support_file(file, pillar, grains) %}{% include file %}{% endmacro %}
+
+{%- if system.enabled %}
+
+ {%- for config_name, config in system.get('config', {}).iteritems() %}
+ {%- if config.enabled|default(True) %}
+ {%- for service_name in config.pillar.keys() %}
+ {%- if pillar.get(service_name, {}).get('_support', {}).get('config', {}).get('enabled', False) %}
+ {%- set support_fragment_file = service_name+'/meta/config.yml' %}
+ {%- set service_config_files = load_support_file(support_fragment_file, config.pillar, config.get('grains', {}))|load_yaml %}
+ {%- for service_config_name, service_config in service_config_files.config.iteritems() %}
+
+{{ service_config.path }}:
+ file.managed:
+ - source: {{ service.config.source }}
+ {%- if service.config.template is defined %}
+ - template: {{ service.config.template }}
+ {%- endif %}
+ - makedirs: true
+ - defaults:
+ pillar: {{ config.pillar|yaml }}
+ grains: {{ config.get('grains', {}) }}
+
+ {%- endfor %}
+ {%- endif %}
+ {%- endfor %}
+ {%- else %}
+ {# TODO: configmap not using support between formulas #}
+ {%- endif %}
+ {%- endfor %}
+
+{%- endif %}
diff --git a/linux/system/init.sls b/linux/system/init.sls
index 51e6245..96d2290 100644
--- a/linux/system/init.sls
+++ b/linux/system/init.sls
@@ -60,3 +60,6 @@
{%- if system.haveged is defined %}
- linux.system.haveged
{%- endif %}
+{%- if system.config is defined %}
+- linux.system.config
+{%- endif %}