If you’re going to generate something using a config management system; why not just template config.php itself?
jinja templating in Salt is my preference. Ansible should be the same.
Pretty certain Puppet and Chef support the same capability too. Probably in a slightly more archaic way but still usable.
e.g.
[~/SRC/salt/file_root/observium]$ cat init.sls | grep ^observium_config_file -A 10observium_config_file:file.managed:- name: /etc/observium/config.php- user: root- group: root- mode: 0644- source: salt://observium/files/config.php- template: jinja- require:- file: observium_config_dir
[~/SRC/salt/file_root/observium]$ head files/config.php<?php
// /etc/observium/config.php
// This file is managed by Salt Stack. Make changes to the state NOT this file.
// Database config$config['db_host'] = '{{ salt['pillar.get']('observium:db:host', 'localhost') }}';$config['db_user'] = '{{ salt['pillar.get']('observium:db:user', 'observium') }}';$config['db_pass'] = '{{ salt['pillar.get']('observium:db:pass', 'FIX_ME') }}';$config['db_name'] = '{{ salt['pillar.get']('observium:db:name', 'observium') }}';$config['db_extension'] = 'mysqli';[~/SRC/salt/file_root/observium]$
On 4 February 2016 at 22:36, Dirk-Willem van Gulik <dirkx@webweaving.org> wrote:
Couple of small feature suggestions
- Would be nice if we could rely on a
http://www.observium.org/observium-0.16.1.7533.tar.gz
in parallel to the standard
http://www.observium.org/observium-community-latest.tar.gz
for the varius dpkg/debian/freebd/brew port collections.
- Would be nice if the block in defaults.inc.php with:
// Location of executables
$config['rrdtool'] = "/usr/local/bin/rrdtool”;
…….
$config['file'] = "/usr/bin/file”;
could be overwridden by a <ROOTDIR>/config.os.php - and perhaps itself
live separate from the defaults.
As this allows a puppet/ansible/chef recipe (or the various ports collections) to manage this file as an OS specific thing; and keep the per system configs strictly in config.php.
Making the latter the only thing to preserve across migrations (and not having to cross check it for OS specific ‘new’ things).
With more and more people using things like vagrant/docker/etc - that sort of abstraction becomes useful.
Dw.
_______________________________________________
observium mailing list
observium@observium.org
http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
_______________________________________________ observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium