简体   繁体   中英

create apache virtual host

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM