Forked from ferventcoder/entire_chocolatey_setup.pp
Created
September 24, 2021 07:44
-
-
Save akamas/7fe75ff745cfee18d8097558844e1a35 to your computer and use it in GitHub Desktop.
Setting up and configuring Chocolatey with Puppet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case $operatingsystem { | |
'windows': { | |
Package { | |
provider => chocolatey, | |
} | |
} | |
} | |
# ensure Chocolatey is installed - host the package internally | |
class {'chocolatey': | |
chocolatey_download_url => 'https://internalurl/to/chocolatey.nupkg', | |
use_7zip => false, | |
choco_install_timeout_seconds => 2700, | |
} | |
# ensure installation of the Chocolatey Simple Server package repository | |
# NOTE: requires version that doesn't have a dependency on the approved chocolatey/chocolatey module | |
class {'chocolatey_server': | |
server_package_source => 'https://internalurl/odata/server', | |
} | |
file { ['C:/ProgramData/chocolatey','C:/ProgramData/chocolatey/license']: | |
ensure => directory, | |
} | |
file {'C:/ProgramData/chocolatey/license/chocolatey.license.xml': | |
ensure => file, | |
source => 'puppet:///modules/internal/chocolatey.license.xml', | |
source_permissions => ignore, | |
} | |
# configure sources | |
chocolateysource {'chocolatey': | |
ensure => disabled, | |
} | |
chocolateysource {'internal_chocolatey': | |
ensure => enabled, | |
location => 'http://internal/server', | |
user => 'chocolateyRocks', | |
password => 'superS3cr#t!', | |
priority => 1, | |
} | |
chocolateysource {'chocolatey.licensed': | |
ensure => disabled, | |
require => File['C:/ProgramData/chocolatey/license/chocolatey.license.xml'], | |
} | |
package { 'chocolatey.extension': | |
ensure => latest, | |
source => 'internal_chocolatey', | |
require => File['C:/ProgramData/chocolatey/license/chocolatey.license.xml'], | |
} | |
# set features appropriately | |
chocolateyfeature {'checksumFiles': | |
ensure => enabled, | |
} | |
#not suggested for external use | |
chocolateyfeature {'allowEmptyChecksums': | |
ensure => enabled, | |
} | |
chocolateyfeature {'useFipsCompliantChecksums': | |
ensure => enabled, | |
} | |
# configuration | |
chocolateyconfig {'cacheLocation': | |
value => 'c:\ProgramData\choco-cache', | |
} | |
chocolateyconfig {'commandExecutionTimeoutSeconds': | |
value => '2700', | |
} | |
# Additional setup - requires Business edition | |
# https://chocolatey.org/docs/features-automatically-recompile-packages | |
chocolateyfeature {'internalizeAppendUseOriginalLocation': | |
ensure => enabled, | |
require => Package['chocolatey.extension'], | |
} | |
# https://chocolatey.org/docs/features-synchronize | |
chocolateyfeature {'allowSynchronization': | |
ensure => enabled, | |
require => Package['chocolatey.extension'], | |
} | |
# https://chocolatey.org/docs/features-virus-check | |
chocolateyfeature {'virusCheck': | |
ensure => enabled, | |
} | |
chocolateyconfig {'virusScannerType': | |
value => 'Generic', | |
require => Package['chocolatey.extension'], | |
} | |
chocolateyconfig {'genericVirusScannerPath': | |
value => 'C:\antivirus\virusscanner.exe', | |
require => Package['chocolatey.extension'], | |
} | |
chocolateyconfig {'genericVirusScannerArgs': | |
value => '[[File]]', | |
require => Package['chocolatey.extension'], | |
} | |
chocolateyconfig {'genericVirusScannerValidExitCodes': | |
value => '0', | |
require => Package['chocolatey.extension'], | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment