GithubHelp home page GithubHelp logo

Comments (6)

alvagante avatar alvagante commented on July 17, 2024

Actually the (automatic) management of parents directory with Puppet has always been a problem.
Generally because you have to define every single directory in the path. This can be fixed in a pure ruby class, but as you've said this won't work on pre 2.6.
In this case a generic virtualhost define that tries to recreate the parent dir, would fail if called twice having a duplicate recource for the parent dir, so I can't fix i upstream.
What I can say is that you should manage this a a custom way, that fits your needs and takes some assumptions.
For example have a custom apache::domain define that just creates the parent directory and is called only once (hand then have all the apache::virtualhosts defines that you need.
ThisiIs not particularly pratical but maybe can be useful to manage, besides the /var/www/domain.com dir, whatever other resource you might manage that is related to the single domain.

So you would end up with nodes (or roles) with something like:
apache::domain { "mydomain1.com": }
apache::virtualhost { "site1": documentroot => "/var/www/mydomain1.com/site1" ... }
apache::virtualhost { "site2": documentroot => "/var/www/mydomain1.com/site2" ... }

apache::domain { "mydomain2.com": }
apache::virtualhost { "site1": documentroot => "/var/www/mydomain2.com/site1" ... }
apache::virtualhost { "site2": documentroot => "/var/www/mydomain2.com/site2" ... }

Not particularly attractive, but it works.

from psick.

gerapeldoorn avatar gerapeldoorn commented on July 17, 2024

Yes, that would work nicely, thanks!!

(I'm keeping you busy agian.. :) )

from psick.

saz avatar saz commented on July 17, 2024

Wouldn't a virtual resource fix the problem? The parent directory (in this case /var/www) is defined as a virtual resource and realized in apache::virtualhost.

from psick.

alvagante avatar alvagante commented on July 17, 2024

Well, don't know, I suppose we have to try. The point is what happens when you realize the same virtual resource twice (as it would happen when you call the virtualhost deifne more than once). I actually never use virtual resources (only exported resources, when needed) so I don't know exactly how they behaves in these cases.

from psick.

saz avatar saz commented on July 17, 2024

Virtual resources are made for this. Think about users. Maybe you need a specific user in different modules. Puppet deals with it, as soon as it gets realized. If there is another Realize(File...) it won't get realized again.

More about here: http://docs.puppetlabs.com/guides/virtual_resources.html

from psick.

alvagante avatar alvagante commented on July 17, 2024

Quite useful indeed. I suppose I'll start to use Virtual Resources more often now that I realize their usefulness in these cases (generally I used to place in specific classes resources that could be applied more than once), thanks

from psick.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.