Sorted. Thanks Kevin,
https://gist.github.com/1674234
On Jan 25, 1:42 pm, denmat <tu2bg...@gmail.com>
wrote:> Hi list,
>
> I''m trying to deploy a configuration file via a template (puppet
2.6.13).
>
> The problem is that I can''t get my iteration right.
>
> You can check out the gist here:https://gist.github.com/1674234
>
> But the code is like the following:
>
> $drbd_resource = { data_share1 => { ''node1.local''
=>
> [''192.168.222.21'',''/dev/drbd1''],
>
''node2.local'' =>
> [''192.168.222.22'',''/dev/drbd1''] },
> data_share2 => {
''node1.local'' =>
> [''192.168.222.21'',''/dev/drbd2''],
>
''node2.local''
> => [''192.168.222.22'',''/dev/drbd2''] }
> }
> $data = inline_template("
> <% drbd_resource.each do |res,resdata| -%>
> resource <%= res -%> {
> <% resdata.each do |nodedata| -%>
> device <%= nodedata[1][1] -%>;
> disk /dev/vg_shared/drbd_<%= res -%>;
> meta-disk internal;
>
> startup { become-primary-on both; }
>
> on <%= fqdn %> {
> address <%= nodedata[1][0] %>:7789;
> }}
>
> <% end -%>
> <% end -%>
> ")
> notify{$data: }
>
> and the output is like the following:
>
> notice:
> resource data_share1 {
>
> device /dev/drbd1;
> disk /dev/vg_shared/drbd_data_share1;
> meta-disk internal;
>
> startup { become-primary-on both; }
>
> on test.local {
> address 192.168.222.22:7789;
> }
>
> }
>
> device /dev/drbd1;
> disk /dev/vg_shared/drbd_data_share1;
> meta-disk internal;
>
> startup { become-primary-on both; }
>
> on test.local {
> address 192.168.222.21:7789;
> }
>
> }
>
> resource data_share2 {
>
> device /dev/drbd2;
> disk /dev/vg_shared/drbd_data_share2;
> meta-disk internal;
>
> startup { become-primary-on both; }
>
> on test.local {
> address 192.168.222.22:7789;
> }
>
> }
>
> device /dev/drbd2;
> disk /dev/vg_shared/drbd_data_share2;
> meta-disk internal;
>
> startup { become-primary-on both; }
>
> on test.local {
> address 192.168.222.21:7789;
> }
>
> }
>
> What I want to see is that a file is created containing the following
> (drbd.d/data_share2.res):
> resource data_share2 {
>
> device /dev/drbd1;
> disk /dev/vg_shared/drbd_data_share2;
> meta-disk internal;
>
> startup { become-primary-on both; }
>
> on test.local {
> address 192.168.222.22:7789;
> address 192.168.222.21:7789;
> }
>
> }
>
> Any help?
>
> Den
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.