Hi

Some of my playbooks involve configuring files in languages such as PHP.
The configuration is basically a large PHP array, for example this
SimpleSAMLphp config file:

<?php
$config = array (
  'language.i18n.backend' => 'gettext/gettext',
  'template.debug' => true,
  'baseurlpath'           => 'wayf/',
  'certdir'               => '/etc/simplesamlphp/wayf/cert/',
  'logging.handler'       => 'file',
  'loggingdir'            => '/var/log/simplesamlphp/wayf/',
  'datadir'               => '/var/lib/simplesamlphp/wayf/data/',
  'tempdir'               => '/tmp/simplesaml-wayf',
  'attributenamemapdir'   => '/etc/simplesamlphp/wayf/attributemap/',
  'secretsalt'            => 'secret',
  'auth.adminpassword'    => 'secret',
  'logging.processname'   => 'simplesamlphp.wayf',
  'language.available'  => array('en', 'no', 'nn', 'se', 'da', 'de', 'es',
'sv', 'fi', 'es', 'fr', 'it', 'nl', 'lb', 'cs', 'sl', 'hr', 'hu', 'pl', 'pt',
'pt-BR', 'tr', 'ja', 'zh-tw', 'el', 'lt', 'sam', 'ru'),
  'session.cookie.secure' => TRUE,

etc etc

The way I now do this is a template with variables such as:

simplesamlphp_template_debug
simplesamlphp_datadir
simplesamlphp_secretsalt

There are many possible configuration options, so I'm only using a subset
as ansible variables.
This doesn't really scale well.
 Also, it's not just a simple array, but it can be nested as well (see
example above).

I'm looking for a way to configure things in Ansible using the native data
structure (yaml), and then templating that out to another language.

So if we consider the above example, you would have this var in a playbook:

config:
    language.i18n.backend: gettext/gettext
    template.debug: true
    baseurlpath: wayf/
    certdir: /etc/simplesamlphp/wayf/cert/
    logging.handler: file
    loggingdir: /var/log/simplesamlphp/wayf/
    datadir: /var/lib/simplesamlphp/wayf/data/
    tempdir: /tmp/simplesaml-wayf
    attributenamemapdir: /etc/simplesamlphp/wayf/attributemap/
    secretsalt: secret
    auth.adminpassword: secret
    language.available:
        - en
        - no
        - nn
        - se
        - da
        - es
        - sv
        - fi
        - fr
        - it
    logging.processname: simplesamlphp.wayf
    session.cookie.secure: TRUE


I was thinking about some way to serialize the yaml data structure and
unserialize it using PHP?
But that requires PHP, which is not ideal.

Any ideas on how I can do this?

Many thanks







-- 
Dick Visser
Sr. System & Network Engineer
GÉANT

Want to join us? We're hiring: http://www.geant.org/jobs

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEQQDNnxN7zFTvqv%2BwFnvt%2BBwj1%3DztwGh%3D7d34f%3Dx3kg7ueEmQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to