-
Notifications
You must be signed in to change notification settings - Fork 193
Update module to support puppetcore on Windows #766
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
base: main
Are you sure you want to change the base?
Conversation
Now possible to run the install task specifying puppetcore collection: ``` /opt/puppetlabs/bolt/bin/bolt task run puppet_agent::install \ collection=puppetcore8 \ version=8.11.0 \ username=forge-key \ password=${PUPPET_FORGE_TOKEN} \ --targets 'winrm://HOST' \ --user Administrator \ --password ... ``` If the `windows_source` class parameter is explicitly given, then the task will use that. Also add additional logging as to where we are downloading the MSI from and the exception message if downloading fails.
b3acb27
to
a57e338
Compare
When using the puppetcore collection on Windows, if we detect the installed version does not match, then upgrade the MSI. Due to a puppet bug, we cannot pass credentials in the `source` parameter. And `curl.exe` is not present in our puppet-agent packages. So use powershell to download. Co-authored-by: Kevin <[email protected]>
If `$puppet_agent::collection` was undef, then the regex match would result in an error: $ bundle exec puppet apply -e '$foo = undef if $foo =~ /core/ { }' Error: Evaluation Error: Left match operand must result in a String value. Got an Undef Value.
a57e338
to
11b51fb
Compare
Wanted to discuss the old 'puppet8-nightly' collection. With the new layout do we still require a different collection? Or can we get by with just always using |
The Beaker tests like |
Use '@api private' for private classes, so they are excluded from REFERENCES.md Use 'String[1]' for username parameter. If it is specified, then it should not be empty. Use 'Sensitive[String[1]]' for password parameter. Use ruby-style way of conditionally setting a variable.
"os_version" = "<%= $facts['os']['release']['major'] %>" | ||
"os_arch" = "<%= $facts['os']['architecture'] %>" | ||
"fips" = "<%= $facts['fips_enabled'] %>" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Attempts to install a nightly dev build is failing, failed when version=8.11.0.22.gb1c13c900
is set:
Started on winrm://hot-connection.delivery.puppetlabs.net...
Failed on winrm://hot-connection.delivery.puppetlabs.net:
The task failed with exit code 1
Downloading the Puppet Agent installer on HOT-CONNECTION from https://artifacts-puppetcore.puppet.com/v1/download?version=8.11.0.22.gb1c13c900&os_name=windows&os_version=10&os_arch=x64&fips=false
Download exception: The remote server returned an error: (404) Not Found.
Retrying... [1/5]
Download exception: The remote server returned an error: (404) Not Found.
Retrying... [2/5]
Download exception: The remote server returned an error: (404) Not Found.
Retrying... [3/5]
Download exception: The remote server returned an error: (404) Not Found.
Retrying... [4/5]
Download exception: The remote server returned an error: (404) Not Found.
Retrying... [5/5]
Download exception: The remote server returned an error: (404) Not Found.
This is analogous to #757 but for windows.
Updates the
puppet_agent::install_task
so it's possible to install msi-based packages from https://artifacts-puppetcore.puppet.com. Credentials are required when installing from puppetcore. The username defaults toforge-key
and the password must be set to your forge API token.When using WinRM, you must specify Windows credentials (using
--user
and--password
arguments) to log into the host and puppetcore credentials to download the MSI (asusername
andpassword
task parameters)Also updates the
puppet_agent
class so it's possible to manage agent versions over time:The
puppet_agent::prepare::package
class on Windows normally uses afile
resource to download the MSI from thesource
. However, due to a bug in puppet, it is not possible to pass credentials as theuserinfo
component of the URL, e.g.https://forge-id:[email protected]
So instead use a powershell script to download the MSI. That code is borrowed from https://github.com/klab-systems/puppet_core_agent, credit to @klab-systems