Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated to work with Puppet 4 and updated IIS module #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 31 additions & 34 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -30,66 +30,63 @@
# means. e.g. environment variable ChocolateyBinRoot. Defaults to
# 'C:\tools\chocolatey.server'
class chocolatey_server (
$port = $::chocolatey_server::params::service_port,
$server_package_source = $::chocolatey_server::params::server_package_source,
$server_install_location = $::chocolatey_server::params::server_install_location,
) inherits ::chocolatey_server::params {
$service_port = '80',
$server_package_source = 'https://chocolatey.org/api/v2/',
$server_install_location = 'C:\tools\chocolatey.server',
$chocolatey_server_app_pool_name = 'chocolatey.server',
$chocolatey_server_app_port = $port,
) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We prefer the params pattern because it allows for hiera values. It's possible this will also allow that, but I'm unsure. And keep in mind this should also continue to work with v3.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because these are now parameterized, they will still be looked up via hiera.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will that still be compatible with both versions? Having the extra logic here doesn't hurt anything that I'm aware of, so I'm not ready to modernize until v3 EOLs completely.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automatic parameter lookup also works in v3.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well then there really isn't a reason to be doing params pattern then. Unless there is something I'm not thinking of offhand

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. AFAIK Puppet recommends not using params pattern going forward.

require chocolatey

$_chocolatey_server_location = $server_install_location
$_chocolatey_server_app_pool_name = 'chocolatey.server'
$_chocolatey_server_app_port = $port
$_server_package_url = $server_package_source

# package install
package {'chocolatey.server':
ensure => installed,
provider => chocolatey,
source => $_server_package_url,
ensure => installed,
provider => chocolatey,
source => $server_package_source,
} ->

# add windows features
windowsfeature { 'Web-WebServer':
installmanagementtools => true,
} ->
windowsfeature { 'Web-Asp-Net45':
windowsfeature { 'Web-Asp-Net45':
} ->

# remove default web site
iis::manage_site {'Default Web Site':
ensure => absent,
site_path => 'any',
app_pool => 'DefaultAppPool'
iis_site {'Default Web Site':
ensure => stopped,
app_pool => 'DefaultAppPool'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a different change than what the module originally did. It removed the default website. Are you proposing to just stop it instead?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am simply because there is a bug which I meant to include. When no sites exist, this creates an issue. voxpupuli/puppet-iis#123

} ->

# application in iis
iis::manage_app_pool { "${_chocolatey_server_app_pool_name}":
iis::manage_app_pool { "${chocolatey_server_app_pool_name}":
enable_32_bit => true,
managed_runtime_version => 'v4.0',
} ->
iis::manage_site {'chocolatey.server':
site_path => $_chocolatey_server_location,
port => "${_chocolatey_server_app_port}",
ip_address => '*',
app_pool => "${_chocolatey_server_app_pool_name}",
iis_site {'chocolatey.server':
ensure => 'started',
path => $server_install_location,
port => $service_port,
app_pool => $chocolatey_server_app_pool_name,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really the only set of changes related to upgrading?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upgrading modules, yes.

} ->

# lock down web directory
acl { "${_chocolatey_server_location}":
purge => true,
acl { "${server_install_location}":
purge => true,
inherit_parent_permissions => false,
permissions => [
{ identity => 'Administrators', rights => ['full'] },
{ identity => 'IIS_IUSRS', rights => ['read'] },
{ identity => 'IUSR', rights => ['read'] },
{ identity => "IIS APPPOOL\\${_chocolatey_server_app_pool_name}", rights => ['read'] }
],
{ identity => 'Administrators', rights => ['full'] },
{ identity => 'IIS_IUSRS', rights => ['read'] },
{ identity => 'IUSR', rights => ['read'] },
{ identity => "IIS APPPOOL\\${chocolatey_server_app_pool_name}", rights => ['read'] }
],
} ->
acl { "${_chocolatey_server_location}/App_Data":

acl { "${server_install_location}/App_Data":
permissions => [
{ identity => "IIS APPPOOL\\${_chocolatey_server_app_pool_name}", rights => ['modify'] },
{ identity => 'IIS_IUSRS', rights => ['modify'] }
],
{ identity => "IIS APPPOOL\\${chocolatey_server_app_pool_name}", rights => ['modify'] },
{ identity => 'IIS_IUSRS', rights => ['modify'] }
],
}
# technically you may only need IIS_IUSRS but I have not tested this yet.
}
16 changes: 0 additions & 16 deletions manifests/params.pp

This file was deleted.