exported resource collector using arrays

asked 2017-01-18 01:27:15 -0600

felipe1982 gravatar image

I'm using puppet 3.8 with Passenger.

I'm using echocat/nfs module to configure some NFS exports on "backupserver".

On "database" server, I want to mount that NFS share, and I am trying to use the $nfstag attribute, which is described in the README.

It works when $nfstag is a string, but not an array. I would like to be able to mount more than one export resource at a time. I am using hiera to define the mount.

Puppet documentation states

== (equality search)

This operator is non-symmetric:

The left operand (attribute) must be the name of a resource attribute or the word title (which searches on the resource’s title).
The right operand (search key) must be a string, boolean, number, resource reference, or undef. The behavior of arrays and hashes in the right operand is undefined in this version of Puppet.
For a given resource, this operator will match if the value of the attribute (or one of the value’s members, if the value is an array) is identical to the search key.

But how can the "attribute" (LHS) be an array?

my hiera:

# backup server
    ensure: 'mounted'
    clients: ',sync),sync)'
    mount: '/var/oracle'
    owner: 'oracle'
    group: 'oracle'
    perms: '0775'
    nfstag: 'rman_offsite_backup'
    options: '_netdev,rw,bg,hard,nointr,tcp'


# database
profiles::nfs_client::nfstag: 'test_u2'
  #-  'test_u2'
  #- 'rman_offsite_backup'

My NFS client side:

# sets up nfs client
class profiles::nfs_client (
  $nfstag = hiera('profiles::nfs_client::nfstag', undef),
  include ::nfs::client
  if $nfstag != undef {
    Nfs::Client::Mount <<| nfstag == $nfstag |>>
edit retag flag offensive close merge delete