> Then you'll probably have to copy down the configuration file into a
> separate location, and use an exec to cp it into the proper destination
> with an onlyif test.
That sounds like a good suggestion. Have to stop being so
straightforward with my thinking.
On Nov 21, 11:30 am, Mike Renfro <[
On 11/21/2008 10:18 AM, Hang Chan wrote:
> I looked through his definitions and it only checks if the proper
> packages exists before setting up his configuration files.
site.pp also includes an apache::site definition that can create or
remove a configuration file depending on if you call the
I looked through his definitions and it only checks if the proper
packages exists before setting up his configuration files. I need to
check if the directory exists as a condition. I don't want to create
the directory if it doesn't, as it is created manually right now and
needs to stay that way
Hang Chan wrote:
> I don't need puppet to create the /var/www/html/site1 directory as
> that is created manually. Want puppet to check If the /var/www/html/
> site1 directory exists and create the /apps/apache/conf.d/site1.conf
> file if it does. Also need puppet to delete the /apps/apache/conf
I'm trying to create a virtual host file only if the document root
directory exists. I could care less what method I use as long as it
works. Please let me know the best way to do this. I realize now
that require won't accomplish what I want.
I don't need puppet to create the /var/www/html/sit
hardcoding what? what are you trying to debug?
Read what 'require' does. Require is not a conditional branch, it makes
ordering explicit.
Exec with onlyif is one way you could get the behavior, or an if condition
with a custom fact would. There might be another way too.
I believe all of those
I'm just hardcoding it to debug it, actual configuation isn't like
this.
I tried it the other way too and it's still creating the file.
file { "/apps/apache/conf.d/site1.conf":
ensure => present,
content => template("apache/virtual_host.erb"),
notify => Service["jboss_apa
Hang,
The 'require' is going to look for a resource definition and make sure that
the current resource is applied later. 'require' establishes explicit order,
not conditional logic.
Also... Please don't take what I'm about to write the wrong way.
Are you familiar with the concept of 'code smells
Your require is actually creating the site1 directory if it doesn't
exist (unless your file def. for that directory has ensure => absent).
I think you want to go the other way and ensure that the site1.conf is
created by the definition for the site1 directory. In other words,
put a require for th