ordering ressopurces in defined types

24 views
Skip to first unread message

Michael Wörz

unread,
Jan 12, 2015, 10:10:27 AM1/12/15
to puppet...@googlegroups.com
      mounts:
         1_usr_sap:
            device: /dev/.....
            mountpoint: /usr/sap
         2_usr_sap_lmp:
            device: /dev/....
            mountpoint: /usr/sap/LMP

define mountenty(){
       # some mount ressource
       # some directory resource
}

class sysctl::mounts() {
  create_resources(mountentry, $mounts)
}

Hello,

i need to iterate over all mounts, creating mountpoint and mount the ressource.
But the generated ressources need to be ordered, bcs i can only mount /usr/sap/lmp if usr sap is mounted.

the definded type just creates ressources ans executes them randomly

thanks

Michael Wörz

unread,
Jan 12, 2015, 11:03:52 AM1/12/15
to puppet...@googlegroups.com
Solved - tags do the job

define mountentry($device,$mountpoint,$order) {
  @notify{"$name":
    tag => ["mount$order"],
  }
}

class sysctl::mounts() {
  $m=$yaml['mounts']
  create_resources(mountentry,$m)
  Notify <| tag == 'mount1' |> ->  Notify <| tag == 'mount2' |>
}


--
You received this message because you are subscribed to a topic in the Google Groups "Puppet Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/puppet-users/Es4P1tpfBRU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/b6440d12-99cb-4959-ab42-c263057d6360%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Felix Frank

unread,
Jan 12, 2015, 1:18:25 PM1/12/15
to puppet...@googlegroups.com
On 01/12/2015 05:03 PM, Michael Wörz wrote:
> Solved - tags do the job
>
> define mountentry($device,$mountpoint,$order) {
> @notify{"$name":
> tag => ["mount$order"],
> }
> }
>
> class sysctl::mounts() {
> $m=$yaml['mounts']
> create_resources(mountentry,$m)
> Notify <| tag == 'mount1' |> -> Notify <| tag == 'mount2' |>
> }

Nice one, but you can even simplify.

Mountentry<| title == '1_usr_sap' |>
->
Mountentry<| title == '2_usr_sap_lmp' |>

HTH,
Felix

Michael Wörz

unread,
Jan 12, 2015, 1:36:45 PM1/12/15
to puppet...@googlegroups.com
generally, yes.
but in this case 

--
You received this message because you are subscribed to a topic in the Google Groups "Puppet Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/puppet-users/Es4P1tpfBRU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to puppet-users...@googlegroups.com.

Michael Wörz

unread,
Jan 12, 2015, 1:42:34 PM1/12/15
to puppet...@googlegroups.com
generally yes,
but in this case the names are only examples and dont know which names are defined in the database.
so the order tag is a more generic way to seperate data from code. 
but  anyway  - thanks


2015-01-12 19:18 GMT+01:00 Felix Frank <felix...@alumni.tu-berlin.de>:
--
You received this message because you are subscribed to a topic in the Google Groups "Puppet Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/puppet-users/Es4P1tpfBRU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to puppet-users...@googlegroups.com.

Felix Frank

unread,
Jan 12, 2015, 1:43:55 PM1/12/15
to puppet...@googlegroups.com
Ah, I see.

Still, out of curiosity - have you tried Mountentry<| order == 1 |> ...?

On 01/12/2015 07:42 PM, Michael Wörz wrote:
> generally yes,
> but in this case the names are only examples and dont know which names
> are defined in the database.
> so the order tag is a more generic way to seperate data from code.
> but anyway - thanks
>
>
> 2015-01-12 19:18 GMT+01:00 Felix Frank <felix...@alumni.tu-berlin.de
> <mailto:felix...@alumni.tu-berlin.de>>:

Michael Wörz

unread,
Jan 12, 2015, 1:46:29 PM1/12/15
to puppet...@googlegroups.com
no, but thats a good hint since i have a mount and directory ressource in the defined type and i wouuld have ton define a orer for both

  Mountentry<| title == '1_usr_sap' |>
>     ->
>     Mountentry<| title == '2_usr_sap_lmp' |>

looks better

--
You received this message because you are subscribed to a topic in the Google Groups "Puppet Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/puppet-users/Es4P1tpfBRU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to puppet-users...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages