On 20/08/14 09:50, Vincent Miszczak wrote: <trim> > > Instead, I pass a YAML hash through an ENC (Foreman to be precise): > test: > url: "https://mygitrepos/myapp.git" > root:"/opt/apps/myapp" > user: root > require: Class[myclass] > > > I finally understand this won't work because this is expanded to > require=>"Class[myclass]" instead of require=>Class[myclass]. > I was mislead by the error message that does not have any quote to > distinguish strings from the rest. >
I wonder if this is a limitation of Foreman or how Foreman is passing the hash to Puppet? As I'm doing something similar to this in yaml with hiera: classes: - basic::directory - myservice basic::directory::instance: '/data/myservice/': owner: svc_account group: svc_account mode: '0755' require: Package[myservice] before: Service[myservice] myservice::data_dir: /data/myservice The basic::directory class is a simple wrapper around create_resources for the file resource. class basic::directory ($instance){ $real_instance = hiera_hash(basic::directory::instance) $defaults = { 'ensure' => 'directory', 'mode' => '0755', 'owner' => 'root', 'group' => 'root', } create_resources(file, $real_instance, $defaults) } The 'myservice' class handles the installation and management of the service. In it the package is an RPM that creates the user account for the service to run under, so the account doesn't exist until the package is installed. However, the directory needs to be created with the correct ownership and permissions before the service is started, as it's been configured not to use the default directory. This worked as desired when I first did it and I haven't seen any errors. However, from reading the other comments in the thread, maybe it shouldn't work? -- Joseph Swick <joseph.sw...@meltwater.com> Operations Engineer Meltwater Group
signature.asc
Description: OpenPGP digital signature