Unable to create virtual directories or applications of the same name in different IIS sites

asked 2018-01-28 21:27:41 -0500

Nico gravatar image

Hi guys,

I am using the puppetlabs/iis module and I need to manage several sites but I am not able to create virtual directories or applications with the same name in different IIS sites.

I am using the following code, which is used for each ${client} ${env}.

iis_virtual_directory { "cgi-bin for ${client} ${env}":
ensure       => 'present',
sitename     => "${client} ${env}",
physicalpath => "E:\\${client}\\${env}\\Web\\cgi-bin",
name         => 'cgi-bin',
}

iis_application { "${client} ${env} webapi":
ensure           => 'present',
sitename         => "${client} ${env}",
physicalpath     => "E:\\${client}\\${env}\\Web\\ASP\\webapi",
enabledprotocols => 'http',
applicationpool  => "${client} ${env}",
applicationname  => 'webapi',
}

The errors when running the agent are:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Resource Statement, Cannot alias Iis_virtual_directory[cgi-bin for puppet2 TEST] to ["cgi-bin"] at /etc/puppetlabs/code/environments/mywebsite/site/mywebsite/manifests/client/iis.pp:74; resource ["Iis_virtual_directory", "cgi-bin"] already declared at /etc/puppetlabs/code/environments/mywebsite/site/mywebsite/manifests/client/iis.pp:74 at /etc/puppetlabs/code/environments/mywebsite/site/mywebsite/manifests/client/iis.pp:74:3 at /etc/puppetlabs/code/environments/mywebsite/site/mywebsite/manifests/client.pp:92 on node puppet-2

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Resource Statement, Cannot alias Iis_application[puppet2 TEST webapi] to ["webapi"] at /etc/puppetlabs/code/environments/mywebsite/site/mywebsite/manifests/client/iis.pp:84; resource ["Iis_application", "webapi"] already declared at /etc/puppetlabs/code/environments/mywebsite/site/mywebsite/manifests/client/iis.pp:84 at /etc/puppetlabs/code/environments/mywebsite/site/mywebsite/manifests/client/iis.pp:84:3 at /etc/puppetlabs/code/environments/mywebsite/site/mywebsite/manifests/client.pp:92 on node puppet-2

Using applicationname => "webapi for ${client} ${env}", or name => "cgi-bin for ${client} ${env}", solve the issue in puppet but my applications are not working anymore has the pas is changed.

Does anyone has an idea to help me ?.

edit retag flag offensive close merge delete