Manage Windows Packages using Chocolatey .. versionadded:: 2016.3.0
Note
Chocolatey pulls data from the Chocolatey internet database to determine current versions, find available versions, etc. This is normally a slow operation and may be optimized by specifying a local, smaller chocolatey repo.
New in version 3007.1.
Ensure chocolatey is installed on the system.
You can't upgrade an existing installation with this state. You must use chocolatey to upgrade chocolatey.
For example:
choco upgrade chocolatey --version 2.2.0
name (str) -- The name of the state that installs chocolatey. Required for all states. This is ignored.
force (bool) --
Run the bootstrap process even if Chocolatey is found in the path.
Note
If chocolatey is already installed this will just re-run the
install script over the existing version. The version
parameter is ignored.
source (str) --
The location of the .nupkg
file or .ps1
file to run from an
alternate location. This can be one of the following types of URLs:
version (str) -- The version of chocolatey to install. The latest version is
installed if this value is None
. Default is None
Example:
# Bootstrap the latest version of chocolatey
bootstrap_chocolatey:
chocolatey.bootstrapped
# Bootstrap the latest version of chocolatey
# If chocolatey is already present, re-run the install script
bootstrap_chocolatey:
chocolatey.bootstrapped:
- force: True
# Bootstrap Chocolatey version 1.4.0
bootstrap_chocolatey:
chocolatey.bootstrapped:
- version: 1.4.0
# Bootstrap Chocolatey from a local file
bootstrap_chocolatey:
chocolatey.bootstrapped:
- source: C:\Temp\chocolatey.nupkg
# Bootstrap Chocolatey from a file on the salt master
bootstrap_chocolatey:
chocolatey.bootstrapped:
- source: salt://Temp/chocolatey.nupkg
Installs a package if not already installed
name (str) -- The name of the package to be installed. Required.
version (str) -- Install a specific version of the package. Defaults to the latest
version. If the version is different to the one installed, then the
specified version will be installed. Default is None
.
source (str) -- Chocolatey repository (directory, share or remote URL, feed).
None
defaults to the official Chocolatey feed. Default is
None
.
force (bool) -- Reinstall the current version of an existing package. Do not use
with allow_multiple
. Default is False
.
pre_versions (bool) -- Include pre-release packages. Default is False
.
install_args (str) -- Install arguments you want to pass to the installation process, i.e.
product key or feature list. Default is None
.
override_args (bool) -- Set to True
to override the original install arguments (for the
native installer) in the package and use your own. When this is set
to False
, install_args will be appended to the end of the
default arguments. Default is False
.
force_x86 (bool) -- Force x86 (32bit) installation on 64bit systems. Default is
False
.
package_args (str) -- Arguments you want to pass to the package. Default is None
.
allow_multiple (bool) --
Allow multiple versions of the package to be installed. Do not use
with force
. Does not work with all packages. Default is
False
.
New in version 2017.7.0.
execution_timeout (str) -- Chocolatey execution timeout value you want to pass to the
installation process. Default is None
.
Example:
install_some_package:
chocolatey.installed:
- name: packagename
- version: '12.04'
- source: 'mychocolatey/source'
- force: True
Adds a Chocolatey source if not already present.
name (str) -- The name of the source to be added as a chocolatey repository.
source (str) -- Location of the source you want to work with.
username (str) -- The username for a chocolatey source that needs authentication credentials.
password (str) -- The password for a chocolatey source that needx authentication credentials.
force (bool) -- Salt will not modify an existing repository with the same name. Set
this option to True
to update an existing repository.
priority (int) -- The priority order of this source as compared to other sources. Lower is better. Defaults to 0 (no priority). All priorities above 0 will be evaluated first, then zero-based values will be evaluated in config file order.
Example:
add_some_source:
chocolatey.source_present:
- name: reponame
- source: https://repo.exemple.com
- username: myuser
- password: mypassword
- priority: 100
New in version 3007.1.
Ensure chocolatey is removed from the system.
name (str) -- The name of the state that uninstalls chocolatey. Required for all states. This is ignored.
Example:
# Uninstall chocolatey
uninstall_chocolatey:
chocolatey.unbootstrapped
Uninstalls a chocolatey package
name (str) -- The name of the package to be uninstalled. Required.
version (str) -- Uninstalls a specific version of the package. Defaults to the latest version installed.
uninstall_args (str) -- A list of uninstall arguments you want to pass to the uninstallation process, i.e. product key or feature list
override_args (str) -- Set to True
if you want to override the original uninstall
arguments (for the native uninstaller) in the package and use your
own. When this is set to False
, uninstall_args will be appended
to the end of the default arguments
Example:
remove_my_package:
chocolatey.uninstalled:
- name: mypackage
- version: '21.5'
Upgrades a chocolatey package. Will install the package if not installed.
New in version 2018.3.0.
name (str) -- The name of the package to be installed. Required.
version (str) -- Install a specific version of the package. Defaults to latest
version. If the version is greater than the one installed then the
specified version will be installed. Default is None
.
source (str) -- Chocolatey repository (directory, share or remote URL, feed).
Defaults to the official Chocolatey feed. Default is None
.
force (bool) -- True
will reinstall an existing package with the same version.
Default is False
.
pre_versions (bool) -- True
will include pre-release packages. Default is False
.
install_args (str) -- Install arguments you want to pass to the installation process, i.e
product key or feature list. Default is None
.
override_args (bool) -- True
will override the original install arguments (for the
native installer) in the package and use those specified in
install_args
. False
will append install_args to the end of
the default arguments. Default is False
.
force_x86 (bool) -- True
forces 32bit installation on 64bit systems. Default is
False
.
package_args (str) -- Arguments you want to pass to the package. Default is None
.
Example:
upgrade_some_package:
chocolatey.upgraded:
- name: packagename
- version: '12.04'
- source: 'mychocolatey/source'