0

I have to create api.conf in /etc/apache2/sites-available dir in a server(xyz02.software.com). The apache config is managed via apache module(apache::vhost) in role::script..so basically it is ///modules/role/manifest/script.pp......

<VirtualHost *:80>

ServerAdmin webmaster@localhost

ServerName xyz02.software.com

ErrorLog ${APACHE_LOG_DIR}/api-error.log

CustomLog ${APACHE_LOG_DIR}/api-access.log combined


apache::vhost { 'xyz02.software.com':

ensure => present,

port => 80,

docroot => /var/www,

serveradmin => webmaster@localhost,

servername => xyz02.software.com,

notify => [ Service['apache2'], ], }

when i write this in puppet this way, it create with name 25-xyz.software.com.conf while i have to get with name api.conf....I don't know how i should mention to get with api.conf name.....also this script create the file also in other servers like xyz01 and xyz03 which also shouldn't happen....Is their anything like if statement I should provide?

1 Answer 1

0

Sorry, but fundamentally the apache module assumes it has complete control over the Apache config files, their names and locations. This means that you can't tell apache::vhost to use api.conf.

The Puppet manifest for apache::vhost is hardcoded to use filenames of the form 25-vhostname.conf:

https://github.com/puppetlabs/puppetlabs-apache/blob/main/manifests/vhost.pp#L2205

The good news is that this almost certainly doesn't matter. The way Apache config works, api.conf and the Puppet vhost config will most likely play together nicely.

Sign up to request clarification or add additional context in comments.

1 Comment

I used this way and it wrked for me but it didn't add the file in /etc/apache2/sites-enabled/ dir ..what is missing? file { '/etc/apache2/sites-available/api.conf': ensure => present, owner => root, group => root, mode => '0644', links => follow, source => 'puppet:///modules/server/api.conf', notify => [Exec["enable api.conf"],], }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.