Ask Your Question
0

File Resource - Ignore Attribute

asked 2015-08-05 18:07:19 -0500

jsemerica gravatar image

updated 2015-08-05 18:54:29 -0500

Hi all,

We have a module for managing GPFS and it uses blank files in /var/mmfs/etc to identify which GPFS mounts it should not mount (it's the opposite of common sense). Since this doesn't exactly translate well into puppet this was the best way I could manage the empty files.

case $::hostname {
  /hostname1/:        {file { "${gpfs_mount_dir}":
                          ensure  =>  present,
                          owner   =>  'root',
                          group   =>  'root',
                          mode    =>  '0644',
                          recurse =>  true,
                          source  =>  "puppet:///modules/gpfs/etc.${host_region}",
                          ignore  =>  "ignoreAnyMount.fsgg1",
                          }
                        }
  /hostname2/:        {file { "${gpfs_mount_dir}":
                          ensure  =>  present,
                          owner   =>  'root',
                          group   =>  'root',
                          mode    =>  '0644',
                          recurse =>  true,
                          source  =>  "puppet:///modules/gpfs/etc.${host_region}",
                          ignore  =>  "ignoreAnyMount.fsgg2",
                          }
                        }
}

My problem is that both hosts will need ignoreAnyMount.fsor1, hostname1 will need fsgg1 and hostname2 will need fsgg2. Puppet's documentation says that the ignore attribute supports regex:

Uses Ruby’s builtin globbing engine, so shell metacharacters are fully supported, e.g. [a-z]. Matches that would descend into the directory structure are ignored, e.g., /.*

My questions are, what are the possible shell metacharacters supported and is this kind of flexibility possible with ignore?

Thanks for any and all help!

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2015-08-06 03:53:06 -0500

the ignore attribute supports all the ruby globbing - glob

as a simple example you could use something like

ignore => [".fsor1","fsgg1"] etc..

cheers Stuart

edit flag offensive delete link more

Comments

I tried the line below and removed the two files, it's saying that they should be present so it doesn't look like it's being correctly matched. ignore => "ignoreAnyMount.['fsor1','fsgg1']",

jsemerica gravatar imagejsemerica ( 2015-08-06 16:12:08 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-08-05 18:07:19 -0500

Seen: 615 times

Last updated: Aug 06 '15