looping over directory array

18 views
Skip to first unread message

Stefan Wiederoder

unread,
Jan 8, 2013, 2:18:49 PM1/8/13
to puppet...@googlegroups.com
I´ve an application which has always the same directory structure:
/some/where/app1/foo
/some/where/app1/bar
/some/where/app2/foo
/some/where/app2/bar
/some/where/app3/foo
/some/where/app3/bar
and so on.....

I´de like to set owner/group permissions while using a loop with an array:
$path = "/some/where"
# array
apps = [ "app1", "app2", "app3", ]

but - how can I achieve this?

thanks
,
Stefan




joe

unread,
Jan 8, 2013, 2:59:49 PM1/8/13
to puppet...@googlegroups.com
Create a defined type and call it with the array of app names:

define app_dirs {

  file {"/some/where/${title}/foo":
    mode => '0644'
  }

  file {"/some/where/${title}/bar":
    mode => '0644',
  }
}

app_dirs { apps: }

joe

unread,
Jan 8, 2013, 3:39:00 PM1/8/13
to puppet...@googlegroups.com
Sorry, that should be app_dirs { $apps: }
Reply all
Reply to author
Forward
0 new messages