Skip to content

Latest commit

 

History

History
385 lines (318 loc) · 8.4 KB

ChocolateyPackages.adoc

File metadata and controls

385 lines (318 loc) · 8.4 KB

DSC Resource 'ChocolateyPackages'

ChocolateyPackages is aimed to install packages using Chocolatey.

Source

DSC Resource

Documentation

Table 1. Attributes of DSC Resource 'ChocolateyPackages'
Parameter Attribute DataType Description Allowed Values

Software

Hashtable

Chocolatey software installation

Sources

Hashtable[]

List of Chocolatey sources

Features

Hashtable[]

List of Chocolatey features

ForceRebootBefore

Boolean

Force reboot before installation of first Chocolatey package.

Only one reboot after first start of a DSC configuration is supported.
To re-enable the system reboot feature the registry key value RebootBefore_ChocolateyPackages at HKLM:\SOFTWARE\DSC Community\CommonTasks\RebootRequests must be deleted.

  • False (default)

  • True

Packages

Hashtable[]

List of Chocolatey packages

Table 2. Attributes of DSC Resource 'ChocolateyPackages/Software'
Parameter Attribute DataType Description Allowed Values

Ensure

Key

String

Specifies whether the Chocolatey Software should be installed on the machine or not.

  • Present (default)

  • Absent

OfflineInstallZip

String

Optional local zip or nupkg package to install a specific Chocolatey Software version.

ChocolateyPackageUrl

String

Optional package URL to download a specific Chocolatey Software package.

PackageFeedUrl

String

Url of a Nuget feed where the Chocolatey software package is available.
i.e. https://community.chocolatey.org/api/v2/

Version

String

Specific version of package available on the nuget Package Feed Url provided.

ChocoTempDir

String

Chocolatey Temp directory to unzip downloaded package during bootstrap.

ProxyLocation

String

Url of the proxy to use to download the Chocolatey binaries.

ProxyCredential

PSCredential

Credential to be used to authenticate to the Proxy for downloading the Chocolatey Package.

IgnoreProxy

Boolean

Ignore proxy during download.

  • True

  • False

InstallationDirectory

String

Path where Chocolatey should be installed.

During offline installation (OfflineInstallZip) the specifed installation path is set to environment variable 'ChocolateyInstall' but will be ignored by Chocolatey install script (tested with 0.10.15). In this case the Test-DscConfiguration command returns False.

Default: C:\ProgramData\Chocolatey

Table 3. Attributes of DSC Resource 'ChocolateyPackages/Sources'
Parameter Attribute DataType Description Allowed Values

Name

Key

String

Folder path where the Chocolatey Software should be installed.

Ensure

String

Specifies whether the Chocolatey Software should be installed on the machine or not.

  • Present (default)

  • Absent

Source

String

Priority

SInt16

Disabled

Boolean

  • True

  • False

BypassProxy

Boolean

  • True

  • False

SelfService

Boolean

  • True

  • False

Credential

PSCredential

Table 4. Attributes of DSC Resource 'ChocolateyPackages/Packages'
Parameter Attribute DataType Description Allowed Values

Name

Key

String

Chocolatey Package Id

Version

String

Chocolatey Package Version

  • '' → Install latest version if package is not installed

  • 1.0 → Install specified version if no newer version is installed

  • Latest → Install or upgrade to latest version

Ensure

String

Specifies whether the Chocolatey Package should be installed on the machine or not

  • Present (default)

  • Absent

Rank

Uint16

Rank to control the installation order of packages

A package with a lower rank is installed before a package with a higher rank. With specifing the rank you can control the installation order of packages in the MOF files. This is useful on multiple YAML layer scenarios to define the installation order independent from the YAML layer merging.

Default: 1000

ChocolateyOptions

String[] (KeyValuePair)

All option values shall be provided as strings, so enclose numerical values in ''.

UpdateOnly

Boolean

Only updates installed package and ignores packages not Installed.

  • True

  • False (default)

Credential

PSCredential

ForceReboot

Boolean

Force a reboot after first installation of the package.

Only one reboot after first start of a DSC configuration is supported.
A Reboot after upgrade of an installed package is currently not supported.
To re-enable the system reboot feature the registry key value RebootAfter_Chocolatey_<Name> at HKLM:\SOFTWARE\DSC Community\CommonTasks\RebootRequests must be deleted.

  • True

  • False (default)

Table 5. Attributes of DSC Resource 'ChocolateyPackages/Features'
Parameter Attribute DataType Description Allowed Values

Name

Key

String

Chocolatey Feature Name

Ensure

String

Specifies whether the Chocolatey Feature should be enabled or not.

  • Present (default)

  • Absent

Example
ChocolateyPackages:
  Software:
    Ensure: Present
    #OfflineInstallZip: C:\LocalRepo\packages\chocolatey.0.10.15.nupkg
    PackageFeedUrl: https://community.chocolatey.org/api/v2/
    Version: 0.10.15
    ChocoTempDir: C:\ChocoTemp
    InstallationDirectory: C:\ProgramData\Chocolatey

  Sources:
    - Name: Chocolatey
      Ensure: Present
      Source: https://community.chocolatey.org/api/v2/
      Priority: 0
      Disabled: False
    - Name: PrivateChocolatey
      Ensure: Absent

  Packages:
    - Name: notepadplusplus
      Ensure: Present
      Version: '1.0'
      ChocolateyOptions:
        PackageParameters: /FirstParam:Value1 /SecondParam:Value2
      Credential: '[ENC=PE9ianM...=]'
    - Name: winrar
      Version: Latest
      Rank: 100   # winrar is installed before notepadplusplus (with the default rank)
      ForceReboot: true
    - Name: very_large_package
      Ensure: Present
      Version: '1.0'
      ChocolateyOptions:
        ChocolateyOptions:
        TimeOut: '3600'  # 1h install timeout

  Features:
    - Name: checksumFiles
      Ensure: Present
    - Name: allowEmptyChecksums
      Ensure: Absent
    - Name: ignoreInvalidOptionsSwitches
Recommended Lookup Options in Datum.yml (Excerpt)
lookup_options:

  ChocolateyPackages:
    merge_hash: deep
  ChocolateyPackages\Sources:
    merge_hash_array: UniqueKeyValTuples
    merge_options:
      tuple_keys:
        - Name
  ChocolateyPackages\Packages:
    merge_hash_array: UniqueKeyValTuples
    merge_options:
      tuple_keys:
        - Name