On 7/21/12 4:13 AM, treydock wrote:
> I've begun using Hiera in combination with Foreman, primarily storing
> data that is best left in Array/Hash form. I'd like to be able to have
> a module, in this case BackupPC, query all the Hiera data for each node
> where the backup directories/databases are stored. Then use all that
> information on the BackupPC server to generate proper configuration
> files for each node's backups. Here's what I have so far...
>
> $ cat /etc/puppet/hiera.yaml
> ---
> :hierarchy:
> - %{fqdn}
> - common
> :backends:
> - yaml
> - puppet
> :yaml:
> :datadir: '/etc/puppet/hieradata'
> :puppet:
> :datasource: data
>
>
> An example of the BackupPC information in hiera
> $ cat /etc/puppet/hieradata/dc-ctrl.tamu.edu.yaml
> ---
> backuppc_db_dumps:
> foreman:
> backup_dir: '/usr/share/foreman'
> mysql:
> backup_dir: '/etc'
>
> I am currently using that data to create dump scripts on each node, and
> would like to re-use the same information to automatically configure the
> backup server to grab those locations.
>
> This attempt may work, but it doesn't 'feel' right to me by overriding
> the fqdn fact.
>
> /etc/puppet/modules/test $ cat manifests/hiera_lookup.pp
> class test::hiera_lookup {
> $nodes = foreman('fact_values', 'fact = fqdn')
>
> if $nodes {
> create_resources('test::hiera_lookup::get_data', $nodes)
> }
> }
>
> define test::hiera_lookup::get_data (
> $fqdn
> ) {
>
> $data = hiera("backuppc_db_dumps", false)
>
> if $data { notify { $data: } }
>
> }
>
> Is there a better approach to override scope and grab what data from
> hiera that would normally not be available to a node?
>
> Thanks
> - Trey
This would be a great place to use exported resources[1]. Each node
could still use Hiera to determine if they should be backed up (or what
should be backed up) and export a resource and the backup server could
collect.
[1] - http://docs.puppetlabs.com/guides/exported_resources.html
-g
--
Garrett Honeycutt
206.414.8658
http://puppetlabs.com
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.