puppetlabs apache and extra conf.d files

233 views
Skip to first unread message

Arnau

unread,
Nov 5, 2015, 7:20:58 AM11/5/15
to puppet...@googlegroups.com
Hi all,

Puppetlab apache module [1] by default purges everything under /etc/httpd/conf.d . If you want to add an extra file, you must use apache::vhost. 
I'm writing a module for managin thruk. The trhuk rpm packge provides a apache conf file (/etc/httpd/conf.d/thruk.conf). At this point I'm wondering what is the best way for "translating" the conf file provided by the rpm into a apache:vhost.

Is there any automatic way for writing the apache::vhost from a http conf file (something like puppet resource ... ? )

How do other people deal with this?

TIA,
Arnau



Hunter Haugen

unread,
Nov 5, 2015, 7:21:57 PM11/5/15
to puppet...@googlegroups.com
The apache module contains many mod manifests [1] that use file
resources with templates [2] that you can pattern your code after. No
need to use apache::vhost at all.

[1] https://github.com/puppetlabs/puppetlabs-apache/tree/master/manifests/mod
[2] https://github.com/puppetlabs/puppetlabs-apache/tree/master/templates/mod
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/CAM69jx8aMtQoA80VpmVgvGGX2iLytbfB80%2BzURWq%3DiOCLKt-%2BQ%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>


--


-Hunter

Arnau

unread,
Nov 6, 2015, 5:01:05 AM11/6/15
to puppet...@googlegroups.com
Hi Hunter,

thanks for your answer.
I don't see how to do what you suggest, could you please give me a short example?
(I was using apache::custom_config as a workaround)

TIA,
Arnau

Matthew Hyclak

unread,
Nov 6, 2015, 8:49:00 AM11/6/15
to puppet...@googlegroups.com
Could/should be as simple as

class thruk {
  package { 'thruck':
    ensure => 'installed',
  }
  file { '/etc/httpd/conf.d/thruk.conf':
    ensure => 'file',
    require => Package['thruk'],
  }
}

Salt to taste.

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.

Arnau

unread,
Nov 6, 2015, 9:11:54 AM11/6/15
to puppet...@googlegroups.com
Hi,

thanks for your answer.
But with this file + apache doing a directory purge on each run, isn't it going to be add/remove the file in every run?

(custom_config is working like a charm)
TIA,
Arnau

Matthew Hyclak

unread,
Nov 6, 2015, 10:35:09 AM11/6/15
to puppet...@googlegroups.com
No, because puppet is now "managing" the file, it won't be included in the purge.

Arnau

unread,
Nov 9, 2015, 2:05:44 AM11/9/15
to puppet...@googlegroups.com
Thanks a lot for your answer,

Cheers

Reply all
Reply to author
Forward
0 new messages