Hi,
I was wondering if it's possible to use an existing resource type say
file,
e.g. lets say following is all I need to do:
file {'testfile':
path => '/tmp/testfile',
ensure => present,
mode => 0640,
content => "I'm a test file.",
}
Normally,
OPTION1
- Put the resource declaration above in my site.pp. Inside a node definition like:
node my_host {
file {'testfile':
path => '/tmp/testfile',
ensure => present,
mode => 0640,
content => "I'm a test file.",
}
}
or OPTION2
- I would create .../my_module/manifests/init.pp and put the resource declaration in it.
- Create my_host.yaml in appropriate directory with:
classes:
my_module
- In my site.pp I will put:
hiera_include('classes')
- Assuming standard hiera.yaml hierarchy.
I'm wondering if there is a third option that allows me to get the best of both options:
- No hardcoding in site.pp for my node name, catalog is decided via hiera yaml config files.
- No separate module/class manifest containing just a 'single liner' resource declaration.
Thanks..