There are other options. As Jon suggest file(mountpoint) and mount are
related, so perhaps it is easy to do something like:
hiera:
test::mountit:
'/local_area':
device : "mymachine:/software"
fstype : "nfs"
ensure : "mounted"
options : "nfsvers=3,tcp,noatime,hard,intr,exec,rw,bg,nosuid"
atboot : true
owner: root
group: root
mode: 0644
# require : [ File['/local_area'] ],
define megamount ( $mp=$title, $device, $fstype, $options, $atboot, $owner,
$group, $mode)
file { $mp:
owner => $owner,
group => $group,
mode => ·mode.
}
mount { $mp:
device => $device ....
... more parameters here...
}
File[$mp] -> Mount[$mp]
}
then in the manifests
$mounts=hiera(test::mountit)
create_resources(megamount,$mounts)
}
and there is yet another option (although I'm not fan of it). You can set
tags in the hiera and use a resource collector. This would be something
like:
$mount_point = hiera('test::mount_point', [])
$defaults = {
'ensure' => 'directory',
}
$mountit = hiera('test::mountit')
create_resources (file, $mount_point, $defaults)
create_resources (mount, $mountit)
File<|tag==first|> -> Mount<|tag==second|>
#<<<<<<<<<<<<<<<<<<<<<<<<<<<<-------------
hiera_yaml is
test::mount_point:
'/local_area':
owner: root
group: root
mode: 0644
tag: "first" #<<<<<<<<<<<<<<<<<<<<<<<<<<<<-------------
test::mountit:
'/local_area':
device : "mymachine:/software"
fstype : "nfs"
ensure : "mounted"
options : "nfsvers=3,tcp,noatime,hard,intr,exec,rw,bg,nosuid"
atboot : true
# require : [ File['/local_area'] ],
tag: "second" #<<<<<<<<<<<<<<<<<<<<<<<<<<<<-------------
About using the "require" I think the problem is the parser doesn't found
the File['/local_area'] beacuse it's created in the "create_resources",
although IMHO it should work (although I don't know the complexity of make
this possible)
On Tue, Mar 25, 2014 at 11:39 AM, Adam Stacey <[email protected]> wrote:
> I would be interested to know if you found a solution for this...?
>
> Adam
>
> On Monday, 2 September 2013 11:57:44 UTC+1, kashif wrote:
>>
>>
>> Hi
>> I am using create_resource to create a dir and then mount it. I am using
>> two create_resources and want one to be completed before other.
>>
>> $mount_point = hiera('test::mount_point', [])
>> $defaults = {
>> 'ensure' => 'directory',
>> }
>> $mountit = hiera('test::mountit')
>> create_resources (file, $mount_point, $defaults)
>> create_resources (mount, $mountit)
>>
>> hiera_yaml is
>>
>> test::mount_point:
>> '/local_area':
>> owner: root
>> group: root
>> mode: 0644
>>
>> test::mountit:
>> '/local_area':
>> device : "mymachine:/software"
>> fstype : "nfs"
>> ensure : "mounted"
>> options : "nfsvers=3,tcp,noatime,hard,intr,exec,rw,bg,nosuid"
>> atboot : true
>> # require : [ File['/local_area'] ],
>>
>>
>> It works if I comment out require line but fail with this error if I
>> un-comment require line
>>
>> Error: Failed to apply catalog: Could not find dependency
>> File['/local_area'] for Mount[/local_area]
>>
>> Is there any other way to chain two create_resources statements ?
>>
>> Thanks
>> Kashif
>>
>>
>>
> This message may contain confidential material. If you are not the
> intended recipient, please notify the sender and destroy all copies.
> We may monitor communications to and from our network.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/a4755499-86d7-40ef-915a-0c094c74d3a6%40googlegroups.com<https://groups.google.com/d/msgid/puppet-users/a4755499-86d7-40ef-915a-0c094c74d3a6%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
José Luis Ledesma
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/CAF_B3dc6WV4gM4oAu0w2Z63bpgeDELri-7jHWS3uq%3DubLgvcsQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.