|
|
(One intermediate revision by the same user not shown) |
Line 1: |
Line 1: |
|
| |
|
| === How to use ncm-metaconfig ? ===
| |
| The official documentation can be found [https://github.com/quattor/configuration-modules-core/blob/master/ncm-metaconfig/src/main/perl/metaconfig.pod here].
| |
|
| |
| Here is an example ready to be included into a machine profile for test purposes :
| |
| <pre>
| |
| # first, you need to deploy the tt file on the machine
| |
| # (the standard way is to include tt files in the the ncm-metaconfig rpm....)
| |
| variable CONTENTS = <<EOF;
| |
| name = {
| |
| [% FILTER indent -%]
| |
| hosts = [% hosts.join(',') %]
| |
| port = [% port %]
| |
| master = [% master ? "TRUE" : "FALSE" %]
| |
| description = "[% description %]"
| |
| [% IF option.defined -%]
| |
| option = "[% option %]"
| |
| [% END -%]
| |
| [% END -%]
| |
| }
| |
| EOF
| |
| '/software/components/filecopy/services' = npush(
| |
| escape('/usr/share/templates/quattor/metaconfig/example/main.tt'), nlist('config', CONTENTS, 'perms', '0644')
| |
| );
| |
|
| |
| # below, the real metaconfig work
| |
| include 'components/metaconfig/config';
| |
| include 'metaconfig/example/config';
| |
| prefix '/software/components/metaconfig/services/{/etc/example/exampled.conf}/contents';
| |
| 'hosts' = list('server1', 'server3');
| |
| 'port' = 800;
| |
| 'master' = false;
| |
| 'description' = 'My example';
| |
|
| |
| # the tt file must be created before ncm-metaconfig runs
| |
| '/software/components/metaconfig/dependencies/pre' = push('filecopy');
| |
| </pre>
| |
|
| |
| For this example to work, you need a directory metaconfig/example in your site, with the following content :
| |
|
| |
| * config.pan :
| |
| <pre>
| |
| unique template metaconfig/example/config;
| |
|
| |
| include {'metaconfig/example/schema'};
| |
|
| |
|
| |
| bind "/software/components/metaconfig/services/{/etc/example/exampled.conf}/contents" = example_service;
| |
|
| |
| prefix "/software/components/metaconfig/services/{/etc/example/exampled.conf}";
| |
| "daemon" = list("exampled");
| |
| "module" = "example/main";
| |
| </pre>
| |
|
| |
| * schema.pan :
| |
| <pre>
| |
| declaration template metaconfig/example/schema;
| |
|
| |
| include { 'pan/types' };
| |
|
| |
| type example_service = {
| |
| 'hosts' : type_hostname[]
| |
| 'port' : type_port
| |
| 'master' : boolean
| |
| 'description' : string
| |
| 'option' ? string
| |
| };
| |
| </pre>
| |
|
| |
| {{TracNotice|{{PAGENAME}}}}
| |