Ask Your Question

Create DocumentRoot directory for puppetlabs/apache

asked 2013-12-20 12:40:19 -0600

josh gravatar image

updated 2013-12-20 12:41:23 -0600

I am using the puppetlabs/apache module and defining vhost data in hiera like so:

    servername: el6pupclient
    docroot: /www/el6pupclient/html
    port: '80'

The 'apache' module has a mechanism to create the docroot directory on the client, but this failing since the parent directory (el6pupclient) does not exist. It is attempting to create the "html" directory:

err: /Stage[main]/Profiles::Apache/Apache::Vhost[el6pupclient]/File[/www/el6pupclient/html]/ensure: change from absent to directory failed: Cannot create /www//html; parent directory /www/ does not exist

Can anyone think of a way to get ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-12-23 11:40:21 -0600

bmurts gravatar image

updated 2013-12-23 11:40:47 -0600

If the servername will always be used in the docroot '/www/servername/html' then you could just reference that value from hiera and use a file resource to build the required directory:

$docroot_dir = hiera('servername')

file "/www/$docroot_dir" {
   ensure => directory,
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-12-20 12:40:19 -0600

Seen: 838 times

Last updated: Dec 23 '13