summaryrefslogtreecommitdiffstats
path: root/ansible_collections/chocolatey
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-18 05:52:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-18 05:52:27 +0000
commit3b0807ad7b283c46c21862eb826dcbb4ad04e5e2 (patch)
tree6461ea75f03eca87a5a90c86c3c9a787a6ad037e /ansible_collections/chocolatey
parentAdding debian version 7.7.0+dfsg-3. (diff)
downloadansible-3b0807ad7b283c46c21862eb826dcbb4ad04e5e2.tar.xz
ansible-3b0807ad7b283c46c21862eb826dcbb4ad04e5e2.zip
Merging upstream version 9.4.0+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--ansible_collections/chocolatey/chocolatey/FILES.json372
-rw-r--r--ansible_collections/chocolatey/chocolatey/MANIFEST.json7
-rw-r--r--ansible_collections/chocolatey/chocolatey/README.md2
-rw-r--r--ansible_collections/chocolatey/chocolatey/changelogs/changelog.yaml22
-rw-r--r--ansible_collections/chocolatey/chocolatey/changelogs/config.yaml10
-rw-r--r--ansible_collections/chocolatey/chocolatey/plugins/module_utils/Packages.psm1149
-rw-r--r--ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey.ps129
-rw-r--r--ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey.py115
-rw-r--r--ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_config.ps14
-rw-r--r--ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_config.py12
-rw-r--r--ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_facts.ps155
-rw-r--r--ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_facts.py56
-rw-r--r--ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_feature.ps12
-rw-r--r--ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_feature.py12
-rw-r--r--ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_source.ps18
-rw-r--r--ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_source.py18
-rw-r--r--ansible_collections/chocolatey/chocolatey/tests/integration/targets/setup_win_chocolatey/files/test-package/tools/chocolateyinstall.ps14
-rw-r--r--ansible_collections/chocolatey/chocolatey/tests/integration/targets/setup_win_chocolatey/tasks/main.yml10
-rw-r--r--ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey-legacy/aliases1
-rw-r--r--ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey-legacy/defaults/main.yml2
-rw-r--r--ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey-legacy/meta/main.yml3
-rw-r--r--ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey-legacy/tasks/main.yml58
-rw-r--r--ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey/tasks/bootstrap_tests.yml10
-rw-r--r--ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey/tasks/choco_v1_tests.yml79
-rw-r--r--ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey/tasks/main.yml8
-rw-r--r--ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey/tasks/tests.yml147
-rw-r--r--ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey_facts/tasks/main.yml4
-rw-r--r--ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey_facts/tasks/test_gather_facts.yml71
28 files changed, 935 insertions, 335 deletions
diff --git a/ansible_collections/chocolatey/chocolatey/FILES.json b/ansible_collections/chocolatey/chocolatey/FILES.json
index 69d065e65..60b4a79e2 100644
--- a/ansible_collections/chocolatey/chocolatey/FILES.json
+++ b/ansible_collections/chocolatey/chocolatey/FILES.json
@@ -15,24 +15,52 @@
"format": 1
},
{
- "name": "README.md",
+ "name": "changelogs",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "changelogs/config.yaml",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "13d9b56079473d7edd2e75e5dfa8c6b660b331f46010dd4f3f01f9265fcf4eb4",
+ "chksum_sha256": "5a7a8b5f38edf6727f8612439178480a7ee3300274b293882876ac2d6e72de04",
"format": 1
},
{
- "name": "plugins",
- "ftype": "dir",
- "chksum_type": null,
- "chksum_sha256": null,
+ "name": "changelogs/.plugin-cache.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "460cd508cdfe4e78550d41f82799da2b385c2ef932c6ce2def9586242c7291b1",
"format": 1
},
{
- "name": "plugins/README.md",
+ "name": "changelogs/changelog.yaml",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "c82ee692702ec1dd604cdbc38ff252114e5204e1b0627045a66c9451e7a918ac",
+ "chksum_sha256": "0576d3d1a33f2d81693a0ce9bb99c70bc34af406a16b22b4b91b11e5be7b5adf",
+ "format": 1
+ },
+ {
+ "name": "LICENSE",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986",
+ "format": 1
+ },
+ {
+ "name": "README.md",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "91e94c18cea1258fc85f52730fd645180f973b81b8ce08808c25525d2c2bdec8",
+ "format": 1
+ },
+ {
+ "name": "plugins",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
"format": 1
},
{
@@ -43,73 +71,80 @@
"format": 1
},
{
- "name": "plugins/modules/win_chocolatey_feature.py",
+ "name": "plugins/modules/win_chocolatey.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "cfba5ceaa61a179e0365bb4be375da1f94167919ab9d4a2470c57a2e362cdb85",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/win_chocolatey_source.ps1",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "57e80df8e6dcd192fc561a0a7b46480cf763fef9f44f8b892221f75031e3a118",
+ "chksum_sha256": "e38489c151bc5de8be400967b1b58dbfa6f42e32647af246e1b8317f32b5a5f9",
"format": 1
},
{
"name": "plugins/modules/win_chocolatey_config.ps1",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "92bcc6c2bad15c2a283ee7fe0cecd734e9b240e40f87e6c3aeafe0f9791592f5",
+ "chksum_sha256": "824fdf6338d4d3d3fe33c00cce288720813cec31adf85c121b331f77690677e5",
"format": 1
},
{
- "name": "plugins/modules/win_chocolatey.ps1",
+ "name": "plugins/modules/win_chocolatey_facts.py",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "063ec818ff51f33a9aa4608dad943ca9ffcbe53b84821ee2bdcf13d276dae412",
+ "chksum_sha256": "e188c1580e99af44a4e4eaa359f05886e5042908591e5257fd93eadb7269bec7",
"format": 1
},
{
- "name": "plugins/modules/win_chocolatey_config.py",
+ "name": "plugins/modules/win_chocolatey.ps1",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "303591e8fea73ad3c206d84a6e46bdb7840be79ccc00308b9e86b1cc933bcd86",
+ "chksum_sha256": "690f0958a777dd10b3642e2f0ca7cb2a89f37bd1fed6f9edd2436faa0653b119",
"format": 1
},
{
- "name": "plugins/modules/win_chocolatey_source.ps1",
+ "name": "plugins/modules/win_chocolatey_facts.ps1",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "b0812f9701b0e67a680a4c1b47d5e1862d8c2d94c341cc407914f67e10b90481",
+ "chksum_sha256": "f71e8d74ebe2d3dcec2ae051ec1f7fbae6862e684ee145d811af9d4409ef39a0",
"format": 1
},
{
"name": "plugins/modules/win_chocolatey_source.py",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "f8b44537cd8e9a2dcecea5ddf33e83975876dc982b6253a7be6618419d30c4d1",
+ "chksum_sha256": "a77aaf8ef5b53f84c269ebce6f95e8c8b3a19301ca0c91baa30f3e7694c15783",
"format": 1
},
{
- "name": "plugins/modules/win_chocolatey_facts.py",
+ "name": "plugins/modules/win_chocolatey_config.py",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "a9c8236d8831c9ffbb6860256577c216e3063c93f3eb8b6d91a1b9d724b99e68",
+ "chksum_sha256": "5bc7b7a0400df1e34da75ea2b423457d09a55ecec407a8fac9c7a9d151f97da4",
"format": 1
},
{
- "name": "plugins/modules/win_chocolatey_facts.ps1",
+ "name": "plugins/modules/win_chocolatey_feature.py",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "0a1a372c739f13c3c312fba6ea107a859f17a6d2a3a839b2ee5c700028857b8a",
+ "chksum_sha256": "c2752e9a2d332e3700fece353b0aa66ae2090205e6041335581472f49b8942e1",
"format": 1
},
{
"name": "plugins/modules/win_chocolatey_feature.ps1",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "b927db93d38b0a840956238d25d3887996c863e4c0dea7e90811c91922d7afeb",
+ "chksum_sha256": "80cf32f69065686fc5ac6c66720adb1902f21c2753c7c02c4ccb619273471fd3",
"format": 1
},
{
- "name": "plugins/modules/win_chocolatey.py",
+ "name": "plugins/README.md",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "82abc61f449f7a19ddcfb4c8c26f732fb314455ab4328cdb26c6bf83a091f00f",
+ "chksum_sha256": "c82ee692702ec1dd604cdbc38ff252114e5204e1b0627045a66c9451e7a918ac",
"format": 1
},
{
@@ -120,31 +155,31 @@
"format": 1
},
{
- "name": "plugins/module_utils/Sources.psm1",
+ "name": "plugins/module_utils/Packages.psm1",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "02c9b473a1f9bb85d9a6b03a04d1cd80469e229d7cf8ae47edc12be123a807b1",
+ "chksum_sha256": "10d9aa09af375370cd8faa529d41d9ca874452ce9d3d987d941dc9e0cb676202",
"format": 1
},
{
- "name": "plugins/module_utils/Features.psm1",
+ "name": "plugins/module_utils/Common.psm1",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "5921060e1db8ab04b0e409e78a134a40f21a35f3363231eec653a0ad916aa83a",
+ "chksum_sha256": "b3061bf96b117d90f9d114ef6ee408379d6fdee885c164d2ddf3b6db058925da",
"format": 1
},
{
- "name": "plugins/module_utils/Common.psm1",
+ "name": "plugins/module_utils/Sources.psm1",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "b3061bf96b117d90f9d114ef6ee408379d6fdee885c164d2ddf3b6db058925da",
+ "chksum_sha256": "02c9b473a1f9bb85d9a6b03a04d1cd80469e229d7cf8ae47edc12be123a807b1",
"format": 1
},
{
- "name": "plugins/module_utils/Packages.psm1",
+ "name": "plugins/module_utils/Features.psm1",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "621785112b5fe3552784991b836f19caf6a20eeb7819c5ae88ef974b95f9a05e",
+ "chksum_sha256": "5921060e1db8ab04b0e409e78a134a40f21a35f3363231eec653a0ad916aa83a",
"format": 1
},
{
@@ -155,276 +190,290 @@
"format": 1
},
{
- "name": "changelogs",
+ "name": "tests",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
- "name": "changelogs/.plugin-cache.yaml",
+ "name": "tests/requirements.txt",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "460cd508cdfe4e78550d41f82799da2b385c2ef932c6ce2def9586242c7291b1",
+ "chksum_sha256": "2aab9022ec2491bbca95b4b3007a18ae31dd82c0314e70ad30558c4767568b64",
"format": 1
},
{
- "name": "changelogs/config.yaml",
- "ftype": "file",
- "chksum_type": "sha256",
- "chksum_sha256": "86f5c20527e0f4c34f5a146b7f75abf25ccb80ad9773cd29d60818172bd1a5f7",
+ "name": "tests/integration",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
"format": 1
},
{
- "name": "changelogs/changelog.yaml",
+ "name": "tests/integration/targets",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/win_chocolatey_config",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/win_chocolatey_config/aliases",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "ae16d31c0405f5105938ade0d840298a1a54a060fedf5deb2046165b512f994e",
+ "chksum_sha256": "5663f103af71f218bb9a50a0d25b7dd6cc83f8761d3ef3c93c7f697f6b6bd1c0",
"format": 1
},
{
- "name": "meta",
+ "name": "tests/integration/targets/win_chocolatey_config/tasks",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
- "name": "meta/runtime.yml",
+ "name": "tests/integration/targets/win_chocolatey_config/tasks/main.yml",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "00d55e0821a4dc0ffa87a17190e1a05365c96cec54ab33c45f6ba649d0e5e6ab",
+ "chksum_sha256": "232a0d4ea9dec480dca82da0d6a0793f856ec931e2da647d8b3ba21a7f8cfd70",
"format": 1
},
{
- "name": "LICENSE",
+ "name": "tests/integration/targets/win_chocolatey_config/tasks/tests.yml",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986",
+ "chksum_sha256": "036b46a3a288f6e0340979b08a6593ebaa866156767c72e3d302acf592eb9601",
"format": 1
},
{
- "name": "tests",
+ "name": "tests/integration/targets/win_chocolatey",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
- "name": "tests/requirements.txt",
+ "name": "tests/integration/targets/win_chocolatey/aliases",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "2aab9022ec2491bbca95b4b3007a18ae31dd82c0314e70ad30558c4767568b64",
+ "chksum_sha256": "d7127ace6c1571fdf343a57b543cd35ed5b5181a330ab6e79ea892bf1ffff082",
"format": 1
},
{
- "name": "tests/integration",
+ "name": "tests/integration/targets/win_chocolatey/defaults",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
- "name": "tests/integration/targets",
- "ftype": "dir",
- "chksum_type": null,
- "chksum_sha256": null,
+ "name": "tests/integration/targets/win_chocolatey/defaults/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "01a04aa89bcde328dde931e7edead0967c33345fcb54d40f62f66d54044499f9",
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey_source",
+ "name": "tests/integration/targets/win_chocolatey/files",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey_source/library",
+ "name": "tests/integration/targets/win_chocolatey/files/bootstrap.ps1",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e0dfdf67688de03cf518902615d62e15fb1bd6d25b8cb8ffdb833e696dc9bc9e",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/win_chocolatey/tasks",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey_source/library/choco_source.ps1",
+ "name": "tests/integration/targets/win_chocolatey/tasks/bootstrap_tests.yml",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "671eebe42952a97e794f931fa3adf720ede5ff7f70f87e47eb3cb829c88336b0",
+ "chksum_sha256": "9d0474eea5ab9e7477f9321f836ed75188fa73bb2804c185922c7925af4690cd",
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey_source/aliases",
+ "name": "tests/integration/targets/win_chocolatey/tasks/choco_v1_tests.yml",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "5663f103af71f218bb9a50a0d25b7dd6cc83f8761d3ef3c93c7f697f6b6bd1c0",
+ "chksum_sha256": "dd27d84cc81f63b48f5d6035ef2fac4e550830038d56b0e670f9030f6bb87824",
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey_source/tasks",
- "ftype": "dir",
- "chksum_type": null,
- "chksum_sha256": null,
- "format": 1
- },
- {
- "name": "tests/integration/targets/win_chocolatey_source/tasks/main.yml",
+ "name": "tests/integration/targets/win_chocolatey/tasks/main.yml",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "e3d3968783e4dd78a412424ffe5f39b02bab9ff07e07b42e91e56eedc3f6a123",
+ "chksum_sha256": "49032805e62390e84e399dc8486ef56fefdc1807fdb1ed8c01459036e6d15365",
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey_source/tasks/tests.yml",
+ "name": "tests/integration/targets/win_chocolatey/tasks/tests.yml",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "5248736132833a34099a1e498b5d0bff891eba15cc7d7c2696b4a38157be4a51",
+ "chksum_sha256": "79cd66a8b8003e4077b4131563e51ea9d3331c6bdd95a03eabbc0760cdcaab5d",
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey_source/defaults",
+ "name": "tests/integration/targets/win_chocolatey/meta",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey_source/defaults/main.yml",
+ "name": "tests/integration/targets/win_chocolatey/meta/main.yml",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "8ce2dd60dd1e390b58a66799872b0c963333260d073dc422c84b4e6f67e7a243",
+ "chksum_sha256": "f2ff87de8d6a548997a43bb73d09427cdd67389a03cd75870425a16ccbe2e59e",
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey_feature",
+ "name": "tests/integration/targets/win_chocolatey-legacy",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey_feature/aliases",
+ "name": "tests/integration/targets/win_chocolatey-legacy/aliases",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "5663f103af71f218bb9a50a0d25b7dd6cc83f8761d3ef3c93c7f697f6b6bd1c0",
+ "chksum_sha256": "d7127ace6c1571fdf343a57b543cd35ed5b5181a330ab6e79ea892bf1ffff082",
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey_feature/tasks",
+ "name": "tests/integration/targets/win_chocolatey-legacy/defaults",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey_feature/tasks/main.yml",
+ "name": "tests/integration/targets/win_chocolatey-legacy/defaults/main.yml",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "c8ff10835a1cd7c34875cae9e11ad27247b0c2b0f94ea1ba0ba15e09a537b84f",
+ "chksum_sha256": "2422155801bc76e3d1aeafcf0072f43296cba92f777352a58c5d9ed29e62ffae",
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey_feature/tasks/tests.yml",
+ "name": "tests/integration/targets/win_chocolatey-legacy/tasks",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/win_chocolatey-legacy/tasks/main.yml",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "768167bb9b6e2c7668086534fb80f9c2a6c75a153a9e01134c67ab53aa9886be",
+ "chksum_sha256": "a262a0ed380e5fe367b4c90b41eb5bc5bbb1834c95fbf30751318bf4332cc516",
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey_feature/filter_plugins",
+ "name": "tests/integration/targets/win_chocolatey-legacy/meta",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey_feature/filter_plugins/choco_checksum_state.py",
+ "name": "tests/integration/targets/win_chocolatey-legacy/meta/main.yml",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "13f3796b9fec73258e34c83d4fd9441c97551c3c8603822c3e1e3db4878dc59d",
+ "chksum_sha256": "e34d7947512b4df1f24c9a95541c99797936028075647d4e8a01e26404ad654b",
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey",
+ "name": "tests/integration/targets/setup_win_chocolatey",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey/files",
+ "name": "tests/integration/targets/setup_win_chocolatey/defaults",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey/files/bootstrap.ps1",
+ "name": "tests/integration/targets/setup_win_chocolatey/defaults/main.yml",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "e0dfdf67688de03cf518902615d62e15fb1bd6d25b8cb8ffdb833e696dc9bc9e",
+ "chksum_sha256": "5b3b2331959ebc286052039c9491e05e7d1044f3c5af3e493626333d09f46c64",
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey/aliases",
- "ftype": "file",
- "chksum_type": "sha256",
- "chksum_sha256": "d7127ace6c1571fdf343a57b543cd35ed5b5181a330ab6e79ea892bf1ffff082",
+ "name": "tests/integration/targets/setup_win_chocolatey/files",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey/tasks",
+ "name": "tests/integration/targets/setup_win_chocolatey/files/test-package",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey/tasks/main.yml",
- "ftype": "file",
- "chksum_type": "sha256",
- "chksum_sha256": "2fb43545e78cd3c17433428ac618a77d84115e07b942e1c7815a4f17d5091d5a",
+ "name": "tests/integration/targets/setup_win_chocolatey/files/test-package/tools",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey/tasks/tests.yml",
+ "name": "tests/integration/targets/setup_win_chocolatey/files/test-package/tools/chocolateyUninstall.ps1",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "17e5bfc912ffa7f0a98fd4bc47ed3e9435a0a86007a301d678f826e52eaee5a7",
+ "chksum_sha256": "8910b0e63722f580b03fcf061b7bb50475ff4794af3ee6e2f9e7a01e526434d8",
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey/tasks/bootstrap_tests.yml",
+ "name": "tests/integration/targets/setup_win_chocolatey/files/test-package/tools/chocolateyinstall.ps1",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "d9a65b1816c77b399e1bb743d07f0170268ecf5a7ad8be47be0ffd36d32be547",
+ "chksum_sha256": "175d63bdcc39e28f438625075317dc7f8661cc5733ba2f9c7ce09fb818b281fa",
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey/meta",
- "ftype": "dir",
- "chksum_type": null,
- "chksum_sha256": null,
- "format": 1
- },
- {
- "name": "tests/integration/targets/win_chocolatey/meta/main.yml",
+ "name": "tests/integration/targets/setup_win_chocolatey/files/test-package/package.nuspec",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "f2ff87de8d6a548997a43bb73d09427cdd67389a03cd75870425a16ccbe2e59e",
+ "chksum_sha256": "4c34e690d87231f1f5739293de8d6d354fa13c454801914583bbec7e2b615197",
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey/defaults",
+ "name": "tests/integration/targets/setup_win_chocolatey/tasks",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey/defaults/main.yml",
+ "name": "tests/integration/targets/setup_win_chocolatey/tasks/main.yml",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "01a04aa89bcde328dde931e7edead0967c33345fcb54d40f62f66d54044499f9",
+ "chksum_sha256": "d08d72e18e427edf3dc062e828ce01c92c3c1df8f4f144fb6164383b6f31d139",
"format": 1
},
{
@@ -449,10 +498,10 @@
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey_facts/tasks/main.yml",
+ "name": "tests/integration/targets/win_chocolatey_facts/tasks/test_gather_facts.yml",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "8afc9a00fd56b053c92c47c9ff4ae026a119143807aaab79bb4b969c5a954d50",
+ "chksum_sha256": "d494930aec30ca6aec654c8fb8516c740ed308c95ef02e1bbd4e3a69b34e4375",
"format": 1
},
{
@@ -463,6 +512,13 @@
"format": 1
},
{
+ "name": "tests/integration/targets/win_chocolatey_facts/tasks/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "6478183fda91eaf1232b6feb989267341b751568da9a36f218094034e0ee4d1d",
+ "format": 1
+ },
+ {
"name": "tests/integration/targets/win_chocolatey_facts/meta",
"ftype": "dir",
"chksum_type": null,
@@ -477,122 +533,136 @@
"format": 1
},
{
- "name": "tests/integration/targets/setup_win_chocolatey",
+ "name": "tests/integration/targets/win_chocolatey_source",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
- "name": "tests/integration/targets/setup_win_chocolatey/files",
- "ftype": "dir",
- "chksum_type": null,
- "chksum_sha256": null,
+ "name": "tests/integration/targets/win_chocolatey_source/aliases",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "5663f103af71f218bb9a50a0d25b7dd6cc83f8761d3ef3c93c7f697f6b6bd1c0",
"format": 1
},
{
- "name": "tests/integration/targets/setup_win_chocolatey/files/test-package",
+ "name": "tests/integration/targets/win_chocolatey_source/defaults",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
- "name": "tests/integration/targets/setup_win_chocolatey/files/test-package/tools",
+ "name": "tests/integration/targets/win_chocolatey_source/defaults/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "8ce2dd60dd1e390b58a66799872b0c963333260d073dc422c84b4e6f67e7a243",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/win_chocolatey_source/library",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
- "name": "tests/integration/targets/setup_win_chocolatey/files/test-package/tools/chocolateyinstall.ps1",
+ "name": "tests/integration/targets/win_chocolatey_source/library/choco_source.ps1",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "76675cb944e6ae4a2f9e0064eeb9dca1daef7b3c7a8fcfa8b21fe2831848083d",
+ "chksum_sha256": "671eebe42952a97e794f931fa3adf720ede5ff7f70f87e47eb3cb829c88336b0",
"format": 1
},
{
- "name": "tests/integration/targets/setup_win_chocolatey/files/test-package/tools/chocolateyUninstall.ps1",
+ "name": "tests/integration/targets/win_chocolatey_source/tasks",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/win_chocolatey_source/tasks/main.yml",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "8910b0e63722f580b03fcf061b7bb50475ff4794af3ee6e2f9e7a01e526434d8",
+ "chksum_sha256": "e3d3968783e4dd78a412424ffe5f39b02bab9ff07e07b42e91e56eedc3f6a123",
"format": 1
},
{
- "name": "tests/integration/targets/setup_win_chocolatey/files/test-package/package.nuspec",
+ "name": "tests/integration/targets/win_chocolatey_source/tasks/tests.yml",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "4c34e690d87231f1f5739293de8d6d354fa13c454801914583bbec7e2b615197",
+ "chksum_sha256": "5248736132833a34099a1e498b5d0bff891eba15cc7d7c2696b4a38157be4a51",
"format": 1
},
{
- "name": "tests/integration/targets/setup_win_chocolatey/tasks",
+ "name": "tests/integration/targets/win_chocolatey_feature",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
- "name": "tests/integration/targets/setup_win_chocolatey/tasks/main.yml",
+ "name": "tests/integration/targets/win_chocolatey_feature/aliases",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "2a91149efc93e253c2570e944623c5337eecbea461b55eb374db77d571a6c718",
+ "chksum_sha256": "5663f103af71f218bb9a50a0d25b7dd6cc83f8761d3ef3c93c7f697f6b6bd1c0",
"format": 1
},
{
- "name": "tests/integration/targets/setup_win_chocolatey/defaults",
+ "name": "tests/integration/targets/win_chocolatey_feature/filter_plugins",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
- "name": "tests/integration/targets/setup_win_chocolatey/defaults/main.yml",
+ "name": "tests/integration/targets/win_chocolatey_feature/filter_plugins/choco_checksum_state.py",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "5b3b2331959ebc286052039c9491e05e7d1044f3c5af3e493626333d09f46c64",
+ "chksum_sha256": "13f3796b9fec73258e34c83d4fd9441c97551c3c8603822c3e1e3db4878dc59d",
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey_config",
+ "name": "tests/integration/targets/win_chocolatey_feature/tasks",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey_config/aliases",
+ "name": "tests/integration/targets/win_chocolatey_feature/tasks/main.yml",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "5663f103af71f218bb9a50a0d25b7dd6cc83f8761d3ef3c93c7f697f6b6bd1c0",
+ "chksum_sha256": "c8ff10835a1cd7c34875cae9e11ad27247b0c2b0f94ea1ba0ba15e09a537b84f",
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey_config/tasks",
- "ftype": "dir",
- "chksum_type": null,
- "chksum_sha256": null,
+ "name": "tests/integration/targets/win_chocolatey_feature/tasks/tests.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "768167bb9b6e2c7668086534fb80f9c2a6c75a153a9e01134c67ab53aa9886be",
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey_config/tasks/main.yml",
+ "name": "tests/integration/vagrant-inventory.winrm",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "232a0d4ea9dec480dca82da0d6a0793f856ec931e2da647d8b3ba21a7f8cfd70",
+ "chksum_sha256": "fb2a78d84c21c105be7960d69f267495a6e46d3f5593fcd1c40c99d11c96fb9e",
"format": 1
},
{
- "name": "tests/integration/targets/win_chocolatey_config/tasks/tests.yml",
- "ftype": "file",
- "chksum_type": "sha256",
- "chksum_sha256": "036b46a3a288f6e0340979b08a6593ebaa866156767c72e3d302acf592eb9601",
+ "name": "meta",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
"format": 1
},
{
- "name": "tests/integration/vagrant-inventory.winrm",
+ "name": "meta/runtime.yml",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "fb2a78d84c21c105be7960d69f267495a6e46d3f5593fcd1c40c99d11c96fb9e",
+ "chksum_sha256": "00d55e0821a4dc0ffa87a17190e1a05365c96cec54ab33c45f6ba649d0e5e6ab",
"format": 1
}
],
diff --git a/ansible_collections/chocolatey/chocolatey/MANIFEST.json b/ansible_collections/chocolatey/chocolatey/MANIFEST.json
index 4b2706405..11ef0db57 100644
--- a/ansible_collections/chocolatey/chocolatey/MANIFEST.json
+++ b/ansible_collections/chocolatey/chocolatey/MANIFEST.json
@@ -2,9 +2,10 @@
"collection_info": {
"namespace": "chocolatey",
"name": "chocolatey",
- "version": "1.4.0",
+ "version": "1.5.1",
"authors": [
- "Joel Francis (@vexx32)",
+ "Rain Sallow (@vexx32)",
+ "Josh King (@windos)",
"Adil Leghari (@adilio)",
"Trond Hindenes (@trondhindenes)",
"Peter Mounce (@petemounce)",
@@ -33,7 +34,7 @@
"name": "FILES.json",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "9acc2eb046f478ff4b091585830987e32bd6ae0a4f4451ccd7e3c484be502f6e",
+ "chksum_sha256": "8afa9b3cc2ef3f87cf8f00d7a9b32b1b6bcc5ad9fc5028c2f3d6ced945d758d9",
"format": 1
},
"format": 1
diff --git a/ansible_collections/chocolatey/chocolatey/README.md b/ansible_collections/chocolatey/chocolatey/README.md
index 7728a583e..3b9ad5927 100644
--- a/ansible_collections/chocolatey/chocolatey/README.md
+++ b/ansible_collections/chocolatey/chocolatey/README.md
@@ -9,7 +9,7 @@ The `chocolatey.chocolatey` Ansible Collection includes the modules required to
## Ansible version compatibility
This collection has been tested against the following Ansible versions:
-**>= 2.12, 2.13, 2.14**
+**>= 2.13, 2.14, 2.15**
## Installation and Usage
diff --git a/ansible_collections/chocolatey/chocolatey/changelogs/changelog.yaml b/ansible_collections/chocolatey/chocolatey/changelogs/changelog.yaml
index 3c3f9c5b3..4de6edf1f 100644
--- a/ansible_collections/chocolatey/chocolatey/changelogs/changelog.yaml
+++ b/ansible_collections/chocolatey/chocolatey/changelogs/changelog.yaml
@@ -1,6 +1,28 @@
# See: https://github.com/ansible-community/antsibull-changelog/blob/main/docs/changelog.yaml-format.md
ancestor: null
releases:
+ 1.5.1:
+ release_date: '2023-07-10'
+ changes:
+ release_summary: |
+ 1.5.1 - Bugfixes
+ bugfixes:
+ - win-chocolatey - unable to install packages if a license is already installed and chocolatey.extension is not installed
+ 1.5.0:
+ release_date: '2023-06-27'
+ changes:
+ release_summary: |
+ 1.5.0 - Chocolatey CLI v2 compatibility, add checksum and fact subset options, documentation fixes
+ major_changes:
+ - win_chocolatey - add options for specifying checksums
+ - win_chocolatey_facts - add filter / gather_subset option
+ minor_changes:
+ - All modules - Ensure modules are compatible with both Chocolatey CLI v2.x and v1.x
+ - win_chocolatey - Improve error messages when installation of Chocolatey CLI v2.x fails due to unmet .NET Framework 4.8 dependency on client
+ documentation:
+ - All modules - Use true/false for all booleans in module docs
+ - win_chocolatey - see_also contains references to wrong collection
+ - win_chocolatey - Improve docs around install_args and package_params
1.4.0:
release_date: '2022-12-15'
changes:
diff --git a/ansible_collections/chocolatey/chocolatey/changelogs/config.yaml b/ansible_collections/chocolatey/chocolatey/changelogs/config.yaml
index 00d40364b..d3e846aef 100644
--- a/ansible_collections/chocolatey/chocolatey/changelogs/config.yaml
+++ b/ansible_collections/chocolatey/chocolatey/changelogs/config.yaml
@@ -11,20 +11,22 @@ prelude_section_name: release_summary
prelude_section_title: Release Summary
sanitize_changelog: true
sections:
-- - major_changes
- - Major Changes
-- - minor_changes
- - Minor Changes
- - breaking_changes
- Breaking Changes / Porting Guide
- - deprecated_features
- Deprecated Features
- - removed_features
- Removed Features (previously deprecated)
+- - major_changes
+ - Major Changes
+- - minor_changes
+ - Minor Changes
- - security_fixes
- Security Fixes
- - bugfixes
- Bugfixes
+- - documentation
+ - Documentation
- - known_issues
- Known Issues
title: Chocolatey.Chocolatey
diff --git a/ansible_collections/chocolatey/chocolatey/plugins/module_utils/Packages.psm1 b/ansible_collections/chocolatey/chocolatey/plugins/module_utils/Packages.psm1
index 4944b85ef..c29b24a02 100644
--- a/ansible_collections/chocolatey/chocolatey/plugins/module_utils/Packages.psm1
+++ b/ansible_collections/chocolatey/chocolatey/plugins/module_utils/Packages.psm1
@@ -5,7 +5,9 @@
# As of chocolatey 0.9.10, non-zero success exit codes can be returned
# See https://github.com/chocolatey/choco/issues/512#issuecomment-214284461
-$script:successExitCodes = (0, 1605, 1614, 1641, 3010)
+$script:SuccessExitCodes = (0, 1605, 1614, 1641, 3010)
+
+$script:ChocolateyVersion = $null
function Get-ChocolateyOutdated {
<#
@@ -71,7 +73,9 @@ function Get-ChocolateyPackage {
$command = Argv-ToString -Arguments @(
$ChocoCommand.Path
"list"
- "--local-only"
+ if ((Get-ChocolateyVersion -ChocoCommand $ChocoCommand) -lt [version]'2.0.0') {
+ "--local-only"
+ }
"--limit-output"
if ($Version) {
@@ -158,6 +162,49 @@ function Get-ChocolateyPackageVersion {
}
}
+function Get-ChocolateyVersion {
+ <#
+ .SYNOPSIS
+ Gets the version of Chocolatey that is currently installed and being used to execute instructions.
+ #>
+ [CmdletBinding()]
+ param(
+ # A CommandInfo object containing the path to choco.exe.
+ [Parameter(Mandatory = $true)]
+ [System.Management.Automation.CommandInfo]
+ $ChocoCommand
+ )
+
+ # If we've already found the choco version, just return the known version.
+ if ($script:ChocolateyVersion) {
+ $script:ChocolateyVersion
+ return
+ }
+
+ # Query choco.exe for the version and cache it in the module-scope variable.
+ $command = Argv-ToString -Arguments @(
+ $ChocoCommand.Path
+ "--version"
+ )
+ $result = Run-Command -Command $command
+
+ # Prerelease versions are not relevant for our purposes.
+ # Stripping off any prerelease tag here gets us enough for what we need.
+ # Also, if a license is installed, but the licensed extension is missing,
+ # choco.exe output will contain an error which we need to ignore for the
+ # purposes of determining the version of Chocolatey CLI.
+ # We're using the suggested regex for matching SemVer strings:
+ # https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
+ $SemVerRegex = '(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?'
+ if ($result.stdout -match $SemVerRegex) {
+ ($script:ChocolateyVersion = [version]($matches[0] -replace '-.+$'))
+ }
+ else {
+ $message = "Error getting version of Chocolatey CLI"
+ Assert-TaskFailed -Message $message -Command $command -CommandResult $result
+ }
+}
+
function Get-CommonChocolateyArgument {
<#
.SYNOPSIS
@@ -235,6 +282,28 @@ function ConvertTo-ChocolateyArgument {
[string]
$Architecture,
+ # Specify to override package checksum.
+ [Parameter()]
+ [string]
+ $Checksum,
+
+ # Specify to override package checksum for x64 installers.
+ [Parameter()]
+ [string]
+ $Checksum64,
+
+ # Specify to override package checksum type.
+ [Parameter()]
+ [ValidateSet('md5', 'sha1', 'sha256', 'sha512')]
+ [string]
+ $ChecksumType,
+
+ # Specify to override package checksum type for x64 installers.
+ [Parameter()]
+ [ValidateSet('md5', 'sha1', 'sha256', 'sha512')]
+ [string]
+ $ChecksumType64,
+
# Any additional arguments to be passed directly to `choco.exe`
[Parameter()]
[string[]]
@@ -329,6 +398,10 @@ function ConvertTo-ChocolateyArgument {
if ($AllowMultiple) { "--allow-multiple" }
if ($AllowPrerelease) { "--prerelease" }
if ($Architecture -eq "x86") { "--x86" }
+ if ($Checksum) { '--checksum', $Checksum }
+ if ($Checksum64) { '--checksum64', $Checksum64 }
+ if ($ChecksumType) { '--checksumtype', $ChecksumType }
+ if ($ChecksumType64) { '--checksumtype64', $ChecksumType64 }
if ($Force) { "--force" }
if ($IgnoreChecksums) { "--ignore-checksums" }
if ($IgnoreDependencies) { "--ignore-dependencies" }
@@ -506,6 +579,28 @@ function Update-ChocolateyPackage {
[string]
$Architecture,
+ # Specify to override package checksum.
+ [Parameter()]
+ [string]
+ $Checksum,
+
+ # Specify to override package checksum for x64 installers.
+ [Parameter()]
+ [string]
+ $Checksum64,
+
+ # Specify to override package checksum type.
+ [Parameter()]
+ [ValidateSet('md5', 'sha1', 'sha256', 'sha512')]
+ [string]
+ $ChecksumType,
+
+ # Specify to override package checksum type for x64 installers.
+ [Parameter()]
+ [ValidateSet('md5', 'sha1', 'sha256', 'sha512')]
+ [string]
+ $ChecksumType64,
+
# Any additional arguments to be passed directly to `choco.exe`
[Parameter()]
[string[]]
@@ -608,7 +703,7 @@ function Update-ChocolateyPackage {
$result = Run-Command -Command $command
$Module.Result.rc = $result.rc
- if ($result.rc -notin $script:successExitCodes) {
+ if ($result.rc -notin $script:SuccessExitCodes) {
$message = "Error updating package(s) '$($Package -join ", ")'"
Assert-TaskFailed -Message $message -Command $command -CommandResult $result
}
@@ -676,6 +771,28 @@ function Install-ChocolateyPackage {
[string]
$Architecture,
+ # Specify to override package checksum.
+ [Parameter()]
+ [string]
+ $Checksum,
+
+ # Specify to override package checksum for x64 installers.
+ [Parameter()]
+ [string]
+ $Checksum64,
+
+ # Specify to override package checksum type.
+ [Parameter()]
+ [ValidateSet('md5', 'sha1', 'sha256', 'sha512')]
+ [string]
+ $ChecksumType,
+
+ # Specify to override package checksum type for x64 installers.
+ [Parameter()]
+ [ValidateSet('md5', 'sha1', 'sha256', 'sha512')]
+ [string]
+ $ChecksumType64,
+
# Any additional arguments to be passed directly to `choco.exe`
[Parameter()]
[string[]]
@@ -778,7 +895,7 @@ function Install-ChocolateyPackage {
$result = Run-Command -Command $command
$Module.Result.rc = $result.rc
- if ($result.rc -notin $script:successExitCodes) {
+ if ($result.rc -notin $script:SuccessExitCodes) {
$message = "Error installing package(s) '$($Package -join ", ")'"
Assert-TaskFailed -Message $message -Command $command -CommandResult $result
}
@@ -883,7 +1000,7 @@ function Uninstall-ChocolateyPackage {
$result = Run-Command -Command $command
$Module.Result.rc = $result.rc
- if ($result.rc -notin $script:successExitCodes) {
+ if ($result.rc -notin $script:SuccessExitCodes) {
$message = "Error uninstalling package(s) '$($Package -join ", ")'"
Assert-TaskFailed -Message $message -Command $command -CommandResult $result
}
@@ -960,6 +1077,27 @@ function Install-Chocolatey {
$chocoCommand = Get-ChocolateyCommand -IgnoreMissing
if ($null -eq $chocoCommand) {
# We need to install chocolatey
+
+ # Chocolatey CLI v2.0.0 and above requires .NET Framework 4.8 to be installed.
+ # If the user has specified a 1.x version of Chocolatey to install, or the .NET requirement is met, we'll install Chocolatey.
+ $dotNetRegistryPath = "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full"
+ $installedDotNetVersion = [version]((Get-ItemProperty -Path $dotNetRegistryPath -Name Version).Version)
+
+ $chocolateyLegacyVersion = if ($Version) {
+ [version]$Version -lt [version]"2.0.0"
+ } else {
+ $false
+ }
+
+ if ((-not $chocolateyLegacyVersion) -and ($installedDotNetVersion -lt [version]"4.8")) {
+ $message = @(
+ "Chocolatey 2.0.0 requires .NET Framework 4.8 or higher to be installed."
+ "Please install .NET Framework 4.8 or higher and try again,"
+ "or specify a 1.x version of Chocolatey to install."
+ ) -join ' '
+ Assert-TaskFailed -Message $message
+ }
+
# Enable necessary TLS versions if they're available but disabled.
# Default for win_chocolatey is to allow TLS 1.1, 1.2, and 1.3 (if available)
$protocols = [System.Net.ServicePointManager]::SecurityProtocol -bor [System.Net.SecurityProtocolType]::SystemDefault
@@ -1151,6 +1289,7 @@ Export-ModuleMember -Function @(
'Get-ChocolateyPackage'
'Get-ChocolateyPackageVersion'
'Get-ChocolateyPin'
+ 'Get-ChocolateyVersion'
'Get-CommonChocolateyArgument'
'Set-ChocolateyPin'
'Install-Chocolatey'
diff --git a/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey.ps1 b/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey.ps1
index a6a4b92cf..b5e60cd02 100644
--- a/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey.ps1
+++ b/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey.ps1
@@ -32,6 +32,7 @@ function Get-ModuleSpec {
allow_empty_checksums = @{ type = "bool"; default = $false }
allow_multiple = @{ type = "bool"; default = $false; removed_in_version = '2.0.0'; removed_from_collection = 'chocolatey.chocolatey' }
allow_prerelease = @{ type = "bool"; default = $false }
+ architecture = @{ type = "str"; default = "default"; choices = "default", "x86" }
bootstrap_script = @{ type = "str"; aliases = "install_ps1", "bootstrap_ps1" }
bootstrap_tls_version = @{
type = "list"
@@ -40,7 +41,10 @@ function Get-ModuleSpec {
default = "tls12", "tls13"
aliases = "tls_version", "tls_versions", "bootstrap_tls_versions"
}
- architecture = @{ type = "str"; default = "default"; choices = "default", "x86" }
+ checksum = @{ type = "str" }
+ checksum64 = @{ type = "str" }
+ checksum_type = @{ type = "str"; choices = "md5", "sha1", "sha256", "sha512" }
+ checksum_type64 = @{ type = "str"; choices = "md5", "sha1", "sha256", "sha512" }
choco_args = @{ type = "list"; elements = "str"; aliases = "licensed_args" }
force = @{ type = "bool"; default = $false }
ignore_checksums = @{ type = "bool"; default = $false }
@@ -77,6 +81,10 @@ $allow_multiple = $module.Params.allow_multiple
$allow_prerelease = $module.Params.allow_prerelease
$architecture = $module.Params.architecture
$bootstrap_script = $module.Params.bootstrap_script
+$checksum = $module.Params.checksum
+$checksum64 = $module.Params.checksum64
+$checksum_type = $module.Params.checksum_type
+$checksum_type64 = $module.Params.checksum_type64
$choco_args = $module.Params.choco_args
$force = $module.Params.force
$ignore_checksums = $module.Params.ignore_checksums
@@ -137,6 +145,15 @@ if ('all' -in $name -and $state -in @('present', 'reinstalled')) {
# Get the installed versions of all specified packages
$packageInfo = $name | Get-ChocolateyPackageVersion -ChocoCommand $chocoCommand
+$chocolateyVersion = Get-ChocolateyVersion -ChocoCommand $chocoCommand
+
+# Ensure module output contains the choco CLI version in case folks need it for
+# debugging purposes.
+$module.Result.choco_cli_version = "$chocolateyVersion"
+
+if ($chocolateyVersion -ge [version]'2.0.0' -and $allow_multiple) {
+ Assert-TaskFailed -Message "Option 'allow_multiple' is not supported on the installed version of Chocolatey CLI"
+}
if ($state -in "absent", "reinstalled") {
$installedPackages = $packageInfo.Keys | Where-Object { $null -ne $packageInfo.$_ }
@@ -226,6 +243,8 @@ if ($state -in @("downgrade", "latest", "upgrade", "present", "reinstalled")) {
AllowMultiple = $allow_multiple
AllowPrerelease = $allow_prerelease
Architecture = $architecture
+ Checksum = $checksum
+ Checksum64 = $checksum64
ChocoArgs = $choco_args
Force = $force
IgnoreChecksums = $ignore_checksums
@@ -244,6 +263,14 @@ if ($state -in @("downgrade", "latest", "upgrade", "present", "reinstalled")) {
Version = $version
}
+ if ($checksum_type -and $checksum_type -ne '') {
+ $commonParams.Add('ChecksumType', $checksum_type)
+ }
+
+ if ($checksum_type64 -and $checksum_type64 -ne '') {
+ $commonParams.Add('ChecksumType64', $checksum_type64)
+ }
+
if ($missingPackages.Count -gt 0) {
Install-ChocolateyPackage -Package $missingPackages @commonParams
}
diff --git a/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey.py b/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey.py
index a660da9ff..c31277a10 100644
--- a/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey.py
+++ b/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey.py
@@ -31,13 +31,16 @@ options:
- Use M(chocolatey.chocolatey.win_chocolatey_feature) with the name C(allowEmptyChecksums) to
control this option globally.
type: bool
- default: no
+ default: false
version_added: '0.2.2'
allow_multiple:
description:
- This option is deprecated and will be removed in v2.0.0 of this collection.
Chocolatey CLI has L(deprecated side-by-side installations, https://github.com/chocolatey/choco/issues/2787)
as of its v1.2.0 release and plans to remove them in its v2.0.0 release.
+ - Chocolatey CLI (choco) v2.0.0 and higher do not support this option.
+ This module will return an error if this option is enabled and the
+ installed version of Chocolatey CLI on the client is v2.0.0 or higher.
- Allow the installation of multiple packages when I(version) is specified.
- Having multiple packages at different versions can cause issues if the
package doesn't support this. Use at your own risk.
@@ -46,7 +49,7 @@ options:
I(version) is not specified, and the specific version only if I(version)
is specified.
type: bool
- default: no
+ default: false
version_added: '0.2.8'
allow_prerelease:
description:
@@ -54,7 +57,7 @@ options:
- If I(state) is C(latest), the latest pre-release package will be
installed.
type: bool
- default: no
+ default: false
version_added: '0.2.6'
architecture:
description:
@@ -97,38 +100,62 @@ options:
default: [ tls12, tls13 ]
version_added: '1.4.0'
aliases: [ bootstrap_tls_versions, tls_version, tls_versions ]
+ checksum:
+ description:
+ - Override a package's checksums for files downloaded during installation.
+ - If the checksum is not MD5, you will need to specify the I(checksum_type) as well.
+ type: str
+ version_added: '1.5.0'
+ checksum_type:
+ description:
+ - Override a package's checksum type for files downloaded during install. Use in conjunction with I(checksum).
+ choices: [ md5, sha1, sha256, sha512 ]
+ version_added: '1.5.0'
+ checksum64:
+ description:
+ - Override a package's checksums for 64-bit files downloaded during installation.
+ - If the checksum is not MD5, you will need to specify the I(checksum_type64) as well.
+ type: str
+ version_added: '1.5.0'
+ checksum_type64:
+ description:
+ - Override a package's checksum type for files downloaded during install. Use in conjunction with I(checksum64).
+ choices: [ md5, sha1, sha256, sha512 ]
+ version_added: '1.5.0'
force:
description:
- Forces the install of a package, even if it already is installed.
- Using I(force) will cause Ansible to always report that a change was
made.
type: bool
- default: no
+ default: false
ignore_checksums:
description:
- Ignore the checksums provided by the package.
- Use M(chocolatey.chocolatey.win_chocolatey_feature) with the name C(checksumFiles) to control
this option globally.
type: bool
- default: no
+ default: false
version_added: '0.2.2'
ignore_dependencies:
description:
- Ignore dependencies, only install/upgrade the package itself.
type: bool
- default: no
+ default: false
version_added: '0.2.1'
remove_dependencies:
description:
- Remove a package's dependencies on uninstall.
type: bool
- default: no
+ default: false
version_added: '1.1.0'
install_args:
description:
- - Arguments to pass to the native installer.
- - These are arguments that are passed directly to the installer the
- Chocolatey package runs, this is generally an advanced option.
+ - These are arguments that are passed directly to the installer run by
+ the Chocolatey package, for example MSI properties or command-line
+ arguments for the specific native installer used by the package.
+ - For parameters that need to be passed to the chocolateyInstall script
+ for the Chocolatey package itself, use I(package_params).
type: str
version_added: '0.2.1'
name:
@@ -137,21 +164,23 @@ options:
- Set to C(all) to run the action on all the installed packages.
type: list
elements: str
- required: yes
+ required: true
override_args:
description:
- Override arguments of native installer with arguments provided by user.
- Should install arguments be used exclusively without appending
to current package passed arguments.
type: bool
- default: no
+ default: false
version_added: '0.2.10'
package_params:
description:
- - Parameters to pass to the package.
+ - Parameters to pass to the package's chocolateyInstall script.
- These are parameters specific to the Chocolatey package and are generally
documented by the package itself.
- - Before Ansible 2.7, this option was just I(params).
+ - For parameters that should be passed directly to the underlying installer
+ (for example, MSI installer properties and arguments), use I(install_args)
+ instead.
type: str
version_added: '0.2.1'
aliases: [ params ]
@@ -175,7 +204,7 @@ options:
- Whether to pin the Chocolatey package or not.
- If omitted then no checks on package pins are done.
- Will pin/unpin the specific version if I(version) is set.
- - Will pin the latest version of a package if C(yes), I(version) is not set
+ - Will pin the latest version of a package if C(true), I(version) is not set
and and no pin already exists.
- Will unpin all versions of a package if C(no) and I(version) is not set.
- This is ignored when C(state=absent).
@@ -211,7 +240,7 @@ options:
- Do not run I(chocolateyInstall.ps1) or I(chocolateyUninstall.ps1) scripts
when installing a package.
type: bool
- default: no
+ default: false
version_added: '0.2.4'
source:
description:
@@ -276,7 +305,7 @@ options:
- This should only be used on personally controlled sites using self-signed
certificate.
type: bool
- default: yes
+ default: true
version_added: '0.2.7'
version:
description:
@@ -286,7 +315,7 @@ options:
- When I(state) is set to C(present) and the package is already installed
at a version that does not match, this task fails.
- If a different version of package is already installed, I(state) must be
- C(latest), C(upgrade), or C(downgrade), or I(force) must be set to C(yes) to install
+ C(latest), C(upgrade), or C(downgrade), or I(force) must be set to C(true) to install
the desired version.
- Provide as a string (e.g. C('6.1')), otherwise it is considered to be
a floating-point number and depending on the locale could become C(6,1),
@@ -306,19 +335,26 @@ notes:
Even if you are connecting as local Administrator, using C(become) to
become Administrator will give you an interactive user logon, see examples
below.
-- If C(become) is unavailable, use M(community.windows.win_hotfix) to install hotfixes instead
- of M(chocolatey.chocolatey.win_chocolatey) as M(community.windows.win_hotfix) avoids using C(wusa.exe) which cannot
+- If C(become) is unavailable, use M(ansible.windows.win_hotfix) to install hotfixes instead
+ of M(chocolatey.chocolatey.win_chocolatey) as M(ansible.windows.win_hotfix) avoids using C(wusa.exe) which cannot
be run without C(become).
+- From Chocolatey CLI 2.0.0 and above, the minimum .NET Framework version required
+ was changed to .NET Framework 4.8.
+ If this requirement is not met, and a 1.x version of Chocolatey CLI is not specified,
+ then M(chocolatey.chocolatey.win_chocolatey) will not attempt to install Chocolatey CLI.
+ See the examples section below for one method of meeting the .NET Framework 4.8
+ requirement and also refer to the L(Chocolatey documentation,https://docs.chocolatey.org/en-us/guides/upgrading-to-chocolatey-v2-v6)
+ for more information about Chocolatey CLI 2.0.0.
seealso:
- module: chocolatey.chocolatey.win_chocolatey_config
- module: chocolatey.chocolatey.win_chocolatey_facts
- module: chocolatey.chocolatey.win_chocolatey_feature
- module: chocolatey.chocolatey.win_chocolatey_source
-- module: community.windows.win_feature
-- module: community.windows.win_hotfix
+- module: ansible.windows.win_feature
+- module: ansible.windows.win_hotfix
description: Use when C(become) is unavailable, to avoid using C(wusa.exe).
-- module: community.windows.win_package
-- module: community.windows.win_updates
+- module: ansible.windows.win_package
+- module: ansible.windows.win_updates
- name: Chocolatey website
description: More information about the Chocolatey tool.
link: http://chocolatey.org/
@@ -335,6 +371,8 @@ author:
- Adam Keech (@smadam813)
- Pierre Templier (@ptemplier)
- Jordan Borean (@jborean93)
+- Rain Sallow (@vexx32)
+- Josh King (@windos)
'''
# TODO:
@@ -434,7 +472,7 @@ EXAMPLES = r'''
- name: Uninstall a package and dependencies
win_chocolatey:
name: audacity-lame
- remove_dependencies: yes
+ remove_dependencies: true
state: absent
- name: Install curl using proxy
@@ -447,7 +485,7 @@ EXAMPLES = r'''
- name: Install a package that requires 'become'
win_chocolatey:
name: officepro2013
- become: yes
+ become: true
become_user: Administrator
become_method: runas
@@ -455,13 +493,13 @@ EXAMPLES = r'''
win_chocolatey:
name: notepadplusplus
version: 7.6.3
- pinned: yes
+ pinned: true
state: present
- name: remove all pins for Notepad++ on all versions
win_chocolatey:
name: notepadplusplus
- pinned: no
+ pinned: false
state: present
- name: install a package with options that require licensed edition
@@ -472,6 +510,27 @@ EXAMPLES = r'''
- --skip-download-cache
- --package-parameters-sensitive
- '/Password=SecretPassword'
+
+- name: ensure .NET Framework 4.8 requirement is satisfied for Chocolatey CLI v2.0.0+
+ block:
+ - name: install Chocolatey CLI v1.4.0
+ win_chocolatey:
+ name: 'chocolatey'
+ state: present
+ version: '1.4.0'
+
+ - name: install Microsoft .NET Framework 4.8
+ win_chocolatey:
+ name: 'netfx-4.8'
+ state: present
+
+ - name: Reboot the host to complete .NET Framework 4.8 install
+ ansible.windows.win_reboot:
+
+ - name: install Chocolatey CLI v2.0.0+ when .NET Framework 4.8 dependency is met
+ win_chocolatey:
+ name: 'chocolatey'
+ state: latest
'''
RETURN = r'''
diff --git a/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_config.ps1 b/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_config.ps1
index d88fefc37..2c67cf60f 100644
--- a/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_config.ps1
+++ b/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_config.ps1
@@ -88,7 +88,7 @@ if ($state -eq "absent" -and -not [string]::IsNullOrEmpty($config.$name)) {
Remove-ChocolateyConfig -ChocoCommand $chocoCommand -Name $name
}
- $module.Result.changed = $true
+ Set-TaskResultChanged
}
elseif ($state -eq "present" -and $value -ne $config.$name) {
# choco.exe config set is not case sensitive, it won't make a change if the
@@ -99,7 +99,7 @@ elseif ($state -eq "present" -and $value -ne $config.$name) {
Set-ChocolateyConfig -ChocoCommand $chocoCommand -Name $name -Value $value
}
- $module.Result.changed = $true
+ Set-TaskResultChanged
if ($module.DiffMode) {
$module.Diff.after = $value
}
diff --git a/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_config.py b/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_config.py
index 06bbb998a..952e747e6 100644
--- a/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_config.py
+++ b/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_config.py
@@ -25,7 +25,7 @@ options:
- Any config values that contain encrypted values like a password are not
idempotent as the plaintext value cannot be read.
type: str
- required: yes
+ required: true
state:
description:
- When C(absent), it will ensure the setting is unset or blank.
@@ -42,12 +42,14 @@ options:
value instead.
type: str
seealso:
-- module: win_chocolatey
-- module: win_chocolatey_facts
-- module: win_chocolatey_feature
-- module: win_chocolatey_source
+- module: chocolatey.chocolatey.win_chocolatey
+- module: chocolatey.chocolatey.win_chocolatey_facts
+- module: chocolatey.chocolatey.win_chocolatey_feature
+- module: chocolatey.chocolatey.win_chocolatey_source
author:
- Jordan Borean (@jborean93)
+- Rain Sallow (@vexx32)
+- Josh King (@windos)
'''
EXAMPLES = r'''
diff --git a/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_facts.ps1 b/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_facts.ps1
index edbd425ed..6ffd3c0d8 100644
--- a/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_facts.ps1
+++ b/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_facts.ps1
@@ -32,7 +32,15 @@ Set-StrictMode -Version 2.0
# Documentation: https://docs.ansible.com/ansible/2.10/dev_guide/developing_modules_general_windows.html#windows-new-module-development
function Get-ModuleSpec {
@{
- options = @{}
+ options = @{
+ filter = @{
+ type = "list"
+ elements = "str"
+ choices = "all", "config", "feature", "outdated", "packages", "sources"
+ default = "all"
+ aliases = "gather_subset"
+ }
+ }
supports_check_mode = $true
}
}
@@ -42,24 +50,43 @@ $spec = Get-ModuleSpec
$module = [Ansible.Basic.AnsibleModule]::Create($args, $spec)
Set-ActiveModule $module
+$gather_filter = $module.Params.filter
+
$chocoCommand = Get-ChocolateyCommand
$module.Result.ansible_facts = @{
- ansible_chocolatey = @{
- config = @{}
- feature = @{}
- sources = @()
- packages = @()
- outdated = @()
- }
+ ansible_chocolatey = @{}
+}
+
+if ($gather_filter -contains "all" -or $gather_filter -contains "config") {
+ $module.Result.ansible_facts.ansible_chocolatey.Add(
+ "config", (Get-ChocolateyConfig -ChocoCommand $chocoCommand)
+ )
+}
+if ($gather_filter -contains "all" -or $gather_filter -contains "feature") {
+ $module.Result.ansible_facts.ansible_chocolatey.Add(
+ "feature", (Get-ChocolateyFeature -ChocoCommand $chocoCommand)
+ )
+}
+if ($gather_filter -contains "all" -or $gather_filter -contains "sources") {
+ $module.Result.ansible_facts.ansible_chocolatey.Add(
+ "sources", @(Get-ChocolateySource -ChocoCommand $chocoCommand)
+ )
+}
+if ($gather_filter -contains "all" -or $gather_filter -contains "packages") {
+ $module.Result.ansible_facts.ansible_chocolatey.Add(
+ "packages", @(Get-ChocolateyPackage -ChocoCommand $chocoCommand)
+ )
+}
+if ($gather_filter -contains "all" -or $gather_filter -contains "outdated") {
+ $module.Result.ansible_facts.ansible_chocolatey.Add(
+ "outdated", @(Get-ChocolateyOutdated -ChocoCommand $chocoCommand)
+ )
}
-$chocolateyFacts = $module.Result.ansible_facts.ansible_chocolatey
-$chocolateyFacts.config = Get-ChocolateyConfig -ChocoCommand $chocoCommand
-$chocolateyFacts.feature = Get-ChocolateyFeature -ChocoCommand $chocoCommand
-$chocolateyFacts.sources = @(Get-ChocolateySource -ChocoCommand $chocoCommand)
-$chocolateyFacts.packages = @(Get-ChocolateyPackage -ChocoCommand $chocoCommand)
-$chocolateyFacts.outdated = @(Get-ChocolateyOutdated -ChocoCommand $chocoCommand)
+$module.Result.ansible_facts.ansible_chocolatey.Add(
+ "filter", @($gather_filter)
+)
# Return result
$module.ExitJson()
diff --git a/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_facts.py b/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_facts.py
index ea75a67cb..37e0d7ee0 100644
--- a/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_facts.py
+++ b/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_facts.py
@@ -18,6 +18,18 @@ version_added: '0.2.8'
short_description: Create a facts collection for Chocolatey
description:
- This module shows information from Chocolatey, such as installed packages, outdated packages, configuration, feature and sources.
+options:
+ filter:
+ version_added: "1.5.0"
+ description:
+ - "If supplied, restrict the facts collected to the given subset.
+ Possible values: C(all), C(config), C(feature), C(outdated),
+ C(packages), C(sources)."
+ - You can provide a list of values to specify a larger subset.
+ type: list
+ elements: str
+ default: "all"
+ aliases: [ gather_subset ]
notes:
- Chocolatey must be installed beforehand, use M(chocolatey.chocolatey.win_chocolatey) to do this.
seealso:
@@ -28,6 +40,8 @@ seealso:
author:
- Simon Bärlocher (@sbaerlocher)
- ITIGO AG (@itigoag)
+- Rain Sallow (@vexx32)
+- Josh King (@windos)
'''
EXAMPLES = r'''
@@ -53,6 +67,31 @@ EXAMPLES = r'''
- name: Displays the Outdated packages
debug:
var: ansible_chocolatey.outdated
+
+- name: Gather all facts from chocolatey, except outdated packages
+ win_chocolatey_facts:
+ filter:
+ - 'config'
+ - 'feature'
+ - 'packages'
+ - 'sources'
+
+- name: Displays the collected facts from chocolatey without the outdated packages
+ debug:
+ var: ansible_chocolatey
+
+- name: Clear existing facts from chocolatey
+ ansible.builtin.meta: clear_facts
+
+- name: Gather config and feature facts only from chocolatey
+ win_chocolatey_facts:
+ filter:
+ - 'config'
+ - 'feature'
+
+- name: Displays the collected config and feature facts from chocolatey
+ debug:
+ var: ansible_chocolatey
'''
RETURN = r'''
@@ -68,14 +107,14 @@ ansible_facts:
contains:
config:
description: Detailed information about stored the configurations
- returned: always
+ returned: always (except when filter is set to exclude config)
type: dict
sample:
commandExecutionTimeoutSeconds: 2700
containsLegacyPackageInstalls: true
feature:
description: Detailed information about enabled and disabled features
- returned: always
+ returned: always (except when filter is set to exclude feature)
type: dict
sample:
allowEmptyCheckums: false
@@ -83,7 +122,7 @@ ansible_facts:
failOnAutoUninstaller: false
sources:
description: List of Chocolatey sources
- returned: always
+ returned: always (except when filter is set to exclude sources)
type: complex
contains:
admin_only:
@@ -131,9 +170,16 @@ ansible_facts:
returned: always
type: str
sample: username
+ filter:
+ description: The list of subsets that were gathered
+ returned: always
+ type: list
+ elements: str
+ sample: ['all']
+ version_added: '1.5.0'
packages:
description: List of installed Packages
- returned: always
+ returned: always (except when filter is set to exclude packages)
type: complex
contains:
package:
@@ -148,7 +194,7 @@ ansible_facts:
sample: '1.27.2'
outdated:
description: List of packages for which an update is available
- returned: always
+ returned: always (except when filter is set to exclude outdated)
type: complex
version_added: '1.3.0'
contains:
diff --git a/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_feature.ps1 b/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_feature.ps1
index b73ce91c0..d0db8c1c4 100644
--- a/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_feature.ps1
+++ b/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_feature.ps1
@@ -58,7 +58,7 @@ if ($isEnabled -ne $shouldBeEnabled) {
Set-ChocolateyFeature -ChocoCommand $chocoCommand -Name $name -Enabled:$shouldBeEnabled
}
- $module.Result.changed = $true
+ Set-TaskResultChanged
}
$module.ExitJson()
diff --git a/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_feature.py b/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_feature.py
index c67504437..abbe259d8 100644
--- a/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_feature.py
+++ b/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_feature.py
@@ -24,7 +24,7 @@ options:
managed.
- For a list of options see L(Chocolatey feature docs,https://chocolatey.org/docs/chocolatey-configuration#features)
type: str
- required: yes
+ required: true
state:
description:
- When C(disabled) then the feature will be disabled.
@@ -33,12 +33,14 @@ options:
choices: [ disabled, enabled ]
default: enabled
seealso:
-- module: win_chocolatey
-- module: win_chocolatey_config
-- module: win_chocolatey_facts
-- module: win_chocolatey_source
+- module: chocolatey.chocolatey.win_chocolatey
+- module: chocolatey.chocolatey.win_chocolatey_config
+- module: chocolatey.chocolatey.win_chocolatey_facts
+- module: chocolatey.chocolatey.win_chocolatey_source
author:
- Jordan Borean (@jborean93)
+- Rain Sallow (@vexx32)
+- Josh King (@windos)
'''
EXAMPLES = r'''
diff --git a/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_source.ps1 b/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_source.ps1
index 5a3b75fd5..4d55753f0 100644
--- a/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_source.ps1
+++ b/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_source.ps1
@@ -91,7 +91,7 @@ if ($module.DiffMode) {
if ($state -eq "absent" -and $null -ne $targetSource) {
Remove-ChocolateySource -ChocoCommand $chocoCommand -Name $name
- $module.Result.changed = $true
+ Set-TaskResultChanged
}
elseif ($state -in ("disabled", "present")) {
$change = $false
@@ -117,7 +117,7 @@ elseif ($state -in ("disabled", "present")) {
if ($change) {
Remove-ChocolateySource -ChocoCommand $chocoCommand -Name $Name
- $module.Result.changed = $true
+ Set-TaskResultChanged
}
}
@@ -149,7 +149,7 @@ elseif ($state -in ("disabled", "present")) {
}
$targetSource = New-ChocolateySource @sourceParams
- $module.Result.changed = $true
+ Set-TaskResultChanged
}
# enable/disable the source if necessary
@@ -183,7 +183,7 @@ elseif ($state -in ("disabled", "present")) {
}
$targetSource.disabled = ($action -eq "disable")
- $module.Result.changed = $true
+ Set-TaskResultChanged
}
if ($module.DiffMode) {
diff --git a/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_source.py b/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_source.py
index 420639d69..f873bf0c5 100644
--- a/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_source.py
+++ b/ansible_collections/chocolatey/chocolatey/plugins/modules/win_chocolatey_source.py
@@ -22,19 +22,19 @@ options:
description:
- Makes the source visible to Administrators only.
- Requires Chocolatey >= 0.10.8.
- - When creating a new source, this defaults to C(no).
+ - When creating a new source, this defaults to C(false).
type: bool
allow_self_service:
description:
- Allow the source to be used with self-service
- Requires Chocolatey >= 0.10.4.
- - When creating a new source, this defaults to C(no).
+ - When creating a new source, this defaults to C(false).
type: bool
bypass_proxy:
description:
- Bypass the proxy when using this source.
- Requires Chocolatey >= 0.10.4.
- - When creating a new source, this defaults to C(no).
+ - When creating a new source, this defaults to C(false).
type: bool
certificate:
description:
@@ -49,7 +49,7 @@ options:
name:
description:
- The name of the source to configure.
- required: yes
+ required: true
type: str
priority:
description:
@@ -98,12 +98,14 @@ options:
default: always
type: str
seealso:
-- module: win_chocolatey
-- module: win_chocolatey_config
-- module: win_chocolatey_facts
-- module: win_chocolatey_feature
+- module: chocolatey.chocolatey.win_chocolatey
+- module: chocolatey.chocolatey.win_chocolatey_config
+- module: chocolatey.chocolatey.win_chocolatey_facts
+- module: chocolatey.chocolatey.win_chocolatey_feature
author:
- Jordan Borean (@jborean93)
+- Rain Sallow (@vexx32)
+- Josh King (@windos)
'''
EXAMPLES = r'''
diff --git a/ansible_collections/chocolatey/chocolatey/tests/integration/targets/setup_win_chocolatey/files/test-package/tools/chocolateyinstall.ps1 b/ansible_collections/chocolatey/chocolatey/tests/integration/targets/setup_win_chocolatey/files/test-package/tools/chocolateyinstall.ps1
index 47d3ee0d8..991d47898 100644
--- a/ansible_collections/chocolatey/chocolatey/tests/integration/targets/setup_win_chocolatey/files/test-package/tools/chocolateyinstall.ps1
+++ b/ansible_collections/chocolatey/chocolatey/tests/integration/targets/setup_win_chocolatey/files/test-package/tools/chocolateyinstall.ps1
@@ -50,6 +50,10 @@ $timeout = $env:chocolateyResponseTimeout
$package_info = @{
allow_empty_checksums = $allow_empty_checksums
+ checksum = $env:ChocolateyChecksum32
+ checksum_type = $env:ChocolateyChecksumType32
+ checksum64 = $env:ChocolateyChecksum64
+ checksum_type64 = $env:ChocolateyChecksumType64
#env_vars = $env_vars
force = $force
force_x86 = $force_x86
diff --git a/ansible_collections/chocolatey/chocolatey/tests/integration/targets/setup_win_chocolatey/tasks/main.yml b/ansible_collections/chocolatey/chocolatey/tests/integration/targets/setup_win_chocolatey/tasks/main.yml
index d9cc0304d..cc83fb70c 100644
--- a/ansible_collections/chocolatey/chocolatey/tests/integration/targets/setup_win_chocolatey/tasks/main.yml
+++ b/ansible_collections/chocolatey/chocolatey/tests/integration/targets/setup_win_chocolatey/tasks/main.yml
@@ -25,11 +25,11 @@
$packages_path = '{{ test_choco_source }}'
$packages_path_override = '{{ test_choco_source2 }}'
$packages = @(
- @{ name = "ansible"; version = "0.0.1"; override = $false },
- @{ name = "ansible"; version = "0.1.0"; override = $false },
- @{ name = "ansible"; version = "0.1.0"; override = $true },
- @{ name = "ansible-test"; version = "1.0.0"; override = $false },
- @{ name = "ansible-test"; version = "1.0.1-beta1"; override = $false }
+ @{ name = "{{ test_choco_package1 }}"; version = "0.0.1"; override = $false },
+ @{ name = "{{ test_choco_package1 }}"; version = "0.1.0"; override = $false },
+ @{ name = "{{ test_choco_package1 }}"; version = "0.1.0"; override = $true },
+ @{ name = "{{ test_choco_package2 }}"; version = "1.0.0"; override = $false },
+ @{ name = "{{ test_choco_package2 }}"; version = "1.0.1-beta1"; override = $false }
)
$nuspec_src = "$root_path\package.nuspec"
$install_src = "$root_path\tools\chocolateyinstall.ps1"
diff --git a/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey-legacy/aliases b/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey-legacy/aliases
new file mode 100644
index 000000000..4f4664b68
--- /dev/null
+++ b/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey-legacy/aliases
@@ -0,0 +1 @@
+shippable/windows/group5
diff --git a/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey-legacy/defaults/main.yml b/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey-legacy/defaults/main.yml
new file mode 100644
index 000000000..d53863b4e
--- /dev/null
+++ b/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey-legacy/defaults/main.yml
@@ -0,0 +1,2 @@
+---
+choco_install_dir: 'C:/ProgramData/chocolatey/'
diff --git a/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey-legacy/meta/main.yml b/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey-legacy/meta/main.yml
new file mode 100644
index 000000000..0f5075981
--- /dev/null
+++ b/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey-legacy/meta/main.yml
@@ -0,0 +1,3 @@
+---
+
+dependencies: []
diff --git a/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey-legacy/tasks/main.yml b/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey-legacy/tasks/main.yml
new file mode 100644
index 000000000..1c8601063
--- /dev/null
+++ b/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey-legacy/tasks/main.yml
@@ -0,0 +1,58 @@
+---
+- name: Check for current Microsoft .NET Framework 4 version
+ win_reg_stat:
+ path: HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full
+ name: Version
+ register: dotnet_version
+
+- block:
+ - name: install Chocolatey CLI v2.0+ when .NET Framework 4.8 dependency is not met
+ win_chocolatey:
+ name: 'chocolatey'
+ state: latest
+ register: install_choco_cli_v2
+ ignore_errors: true
+
+ - name: assert installing Chocolatey CLI v2.0+ fails when .NET Framework 4.8 dependency is not met
+ assert:
+ that:
+ - install_choco_cli_v2.failed
+ - install_choco_cli_v2.msg == "Chocolatey 2.0.0 requires .NET Framework 4.8 or higher to be installed. Please install .NET Framework 4.8 or higher and try again, or specify a 1.x version of Chocolatey to install."
+
+ - name: install Chocolatey CLI v1.4.0
+ win_chocolatey:
+ name: 'chocolatey'
+ state: present
+ version: '1.4.0'
+ register: install_choco_cli_v14
+
+ - name: assert installing Chocolatey CLI v1.4 succeeds
+ assert:
+ that:
+ - install_choco_cli_v14 is changed
+
+ - name: install Microsoft .NET Framework 4.8
+ win_chocolatey:
+ name: 'netfx-4.8'
+ state: present
+
+ - name: Reboot the host to complete .NET Framework 4.8 install
+ ansible.windows.win_reboot:
+
+ - name: ensure Chocolatey is not installed
+ win_file:
+ path: '{{ choco_install_dir }}'
+ state: absent
+
+ - name: install Chocolatey CLI v2.0+ when .NET Framework 4.8 dependency is met
+ win_chocolatey:
+ name: 'chocolatey'
+ state: latest
+ register: install_choco_cli_v2
+
+ - name: assert installing Chocolatey CLI v2.0+ succeeds when .NET Framework 4.8 dependency is met
+ assert:
+ that:
+ - install_choco_cli_v2 is changed
+
+ when: "dotnet_version.value is version('4.8', '<')"
diff --git a/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey/tasks/bootstrap_tests.yml b/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey/tasks/bootstrap_tests.yml
index f7095131d..92c7b8e45 100644
--- a/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey/tasks/bootstrap_tests.yml
+++ b/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey/tasks/bootstrap_tests.yml
@@ -30,6 +30,16 @@
that:
- (bootstrap_file_check.stdout|from_json).bootstrap
+- name: remove chocolatey package directory
+ win_file:
+ path: 'C:/ProgramData/chocolatey/lib/chocolatey'
+ state: absent
+
+- name: ensure we can still upgrade packages with chocolatey package files missing
+ win_chocolatey:
+ name: chocolatey
+ state: upgrade
+
- name: ensure Chocolatey is not installed
win_file:
path: '{{ choco_install_dir }}'
diff --git a/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey/tasks/choco_v1_tests.yml b/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey/tasks/choco_v1_tests.yml
new file mode 100644
index 000000000..30f714ff6
--- /dev/null
+++ b/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey/tasks/choco_v1_tests.yml
@@ -0,0 +1,79 @@
+---
+- name: install choco v1.4.0
+ win_chocolatey:
+ name: chocolatey
+ version: '1.4.0'
+ state: downgrade
+
+- name: install older package with allow_multiple
+ win_chocolatey:
+ name: '{{ test_choco_package1 }}'
+ state: present
+ allow_multiple: yes
+ version: '0.0.1'
+ register: allow_multiple
+
+- name: get result of install older package with allow_multiple
+ win_command: choco.exe list --local-only --limit-output --all-versions
+ register: allow_multiple_actual
+
+- name: assert install older package with allow_multiple
+ assert:
+ that:
+ - allow_multiple is changed
+ - '"{{ test_choco_package1 }}|0.1.0" in allow_multiple_actual.stdout_lines'
+ - '"{{ test_choco_package1 }}|0.0.1" in allow_multiple_actual.stdout_lines'
+
+- name: pin specific older version
+ win_chocolatey:
+ name: '{{ test_choco_package1 }}'
+ state: present
+ pinned: yes
+ version: '0.0.1'
+ register: pin_older
+
+- name: get result of pin specific older version
+ win_command: choco.exe pin list --limit-output
+ register: pin_older_actual
+
+- name: assert pin specific older version
+ assert:
+ that:
+ - pin_older is changed
+ - '"{{ test_choco_package1 }}|0.0.1" in pin_older_actual.stdout_lines'
+
+- name: unpin package at version
+ win_chocolatey:
+ name: '{{ test_choco_package1 }}'
+ state: present
+ pinned: no
+ version: '0.0.1'
+ register: unpin_version
+
+- name: get result of unpin package at version
+ win_command: choco.exe pin list --limit-output
+ register: unpin_version_actual
+
+- name: assert unpin package at version
+ assert:
+ that:
+ - unpin_version is changed
+ - '"{{ test_choco_package1 }}|0.0.1" not in unpin_version_actual.stdout_lines'
+
+- name: uninstall specific version installed with allow_multiple
+ win_chocolatey:
+ name: '{{ test_choco_package1 }}'
+ state: absent
+ version: '0.0.1'
+ register: remove_multiple
+
+- name: get result of uninstall specific version installed with allow_multiple
+ win_command: choco.exe list --local-only --limit-output --all-versions
+ register: remove_multiple_actual
+
+- name: assert uninstall specific version installed with allow_multiple
+ assert:
+ that:
+ - remove_multiple is changed
+ - '"{{ test_choco_package1 }}|0.0.1" not in remove_multiple_actual.stdout_lines'
+ - '"{{ test_choco_package1 }}|0.1.0" in remove_multiple_actual.stdout_lines'
diff --git a/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey/tasks/main.yml b/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey/tasks/main.yml
index 3b52a53f6..f6cebbbd7 100644
--- a/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey/tasks/main.yml
+++ b/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey/tasks/main.yml
@@ -7,6 +7,9 @@
- name: run tests
include_tasks: tests.yml
+ - name: run choco v1 tests
+ include_tasks: choco_v1_tests.yml
+
always:
- name: ensure test package is uninstalled after tests
win_chocolatey:
@@ -25,3 +28,8 @@
win_file:
path: '{{ test_choco_path }}'
state: absent
+
+ - name: ensure latest choco is installed after tests run
+ win_chocolatey:
+ name: chocolatey
+ state: upgrade
diff --git a/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey/tasks/tests.yml b/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey/tasks/tests.yml
index ed0eedcf8..e428979f5 100644
--- a/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey/tasks/tests.yml
+++ b/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey/tasks/tests.yml
@@ -21,7 +21,7 @@
register: install_check
- name: get result of install package (check mode)
- win_command: choco.exe list --local-only --exact --limit-output {{ test_choco_package1|quote }}
+ win_command: choco.exe list --exact --limit-output {{ test_choco_package1|quote }}
register: install_actual_check
failed_when: not install_actual_check.rc in [0, 2] # v0.10.12+ returns 2 for no package
@@ -38,7 +38,7 @@
register: install
- name: get result of install package
- win_command: choco.exe list --local-only --exact --limit-output {{ test_choco_package1|quote }}
+ win_command: choco.exe list --exact --limit-output {{ test_choco_package1|quote }}
register: install_actual
- name: get package info of install package
@@ -80,7 +80,7 @@
register: remove_check
- name: get result of remove package (check mode)
- win_command: choco.exe list --local-only --exact --limit-output {{ test_choco_package1|quote }}
+ win_command: choco.exe list --exact --limit-output {{ test_choco_package1|quote }}
register: remove_actual_check
- name: assert remove package (check mode)
@@ -96,7 +96,7 @@
register: remove
- name: get result of remove package
- win_command: choco.exe list --local-only --exact --limit-output {{ test_choco_package1|quote }}
+ win_command: choco.exe list --exact --limit-output {{ test_choco_package1|quote }}
register: remove_actual
failed_when: not remove_actual.rc in [0, 2]
@@ -131,7 +131,7 @@
register: install_multiple
- name: get list of installed packages with timeout
- win_command: choco.exe list --local-only --limit-output ansible
+ win_command: choco.exe list --limit-output ansible
register: install_multiple_actual
- name: get info on package 1
@@ -186,7 +186,7 @@
register: remove_multiple
- name: get list of installed packages after removal
- win_command: choco.exe list --local-only --limit-output ansible
+ win_command: choco.exe list --limit-output ansible
register: remove_multiple_actual
failed_when: not remove_multiple_actual.rc in [0, 2]
@@ -227,7 +227,7 @@
register: install_with_version_and_state_present
- name: get result of install package with explicit version and state=present
- win_command: choco.exe list --local-only --exact --limit-output {{ test_choco_package1|quote }}
+ win_command: choco.exe list --exact --limit-output {{ test_choco_package1|quote }}
register: install_with_version_and_state_present_actual
- name: get package info of install package with explicit version and state=present
@@ -262,11 +262,11 @@
force: yes
ignore_checksums: yes
proxy_url: http://proxyhost
- version: 0.0.1
+ version: '0.0.1'
register: install_params
- name: get result of install package with params
- win_command: choco.exe list --local-only --limit-output --exact {{ test_choco_package1|quote }}
+ win_command: choco.exe list --limit-output --exact {{ test_choco_package1|quote }}
register: install_params_actual
- name: get info of install package with params
@@ -313,7 +313,7 @@
register: install_manual_params
- name: get result of install package with manually specified params
- win_command: choco.exe list --local-only --limit-output --exact {{ test_choco_package1|quote }}
+ win_command: choco.exe list --limit-output --exact {{ test_choco_package1|quote }}
register: install_manual_params_actual
- name: get info of install package with manually specified params
@@ -342,7 +342,7 @@
win_chocolatey:
name: '{{ test_choco_package1 }}'
state: present
- version: 0.0.1
+ version: '0.0.1'
register: install_with_version
- name: assert install package with version (idempotent)
@@ -354,7 +354,7 @@
win_chocolatey:
name: '{{ test_choco_package1 }}'
state: present
- version: 0.1.0
+ version: '0.1.0'
register: fail_multiple_versions
failed_when: fail_multiple_versions.msg != "Chocolatey package '" + test_choco_package1 + "' is already installed with version(s) '0.0.1' but was expecting '0.1.0'. Either change the expected version, set state=latest or state=upgrade, set allow_multiple=yes, or set force=yes to continue"
@@ -362,12 +362,12 @@
win_chocolatey:
name: '{{ test_choco_package1 }}'
state: present
- version: 0.1.0
+ version: '0.1.0'
force: yes
register: force_different_version
- name: get result of force the upgrade of an existing version
- win_command: choco.exe list --local-only --limit-output --exact {{ test_choco_package1|quote }}
+ win_command: choco.exe list --limit-output --exact {{ test_choco_package1|quote }}
register: force_different_version_actual
- name: get result of forced package install file
@@ -396,7 +396,7 @@
register: install_source_name
- name: get result of install package with reference to source name
- win_command: choco.exe list --local-only --limit-output --exact {{ test_choco_package1|quote }}
+ win_command: choco.exe list --limit-output --exact {{ test_choco_package1|quote }}
register: install_source_name_actual
- name: get result fo installed package with reference to source name info
@@ -434,7 +434,7 @@
register: downgraded_package
- name: get result of downgrade package
- win_command: choco.exe list --local-only --limit-output --exact {{ test_choco_package1|quote }}
+ win_command: choco.exe list --limit-output --exact {{ test_choco_package1|quote }}
register: downgraded_package_actual
- name: assert downgrade package
@@ -462,7 +462,7 @@
register: downgrade_without_version
- name: get result of downgrade without version
- win_command: choco.exe list --local-only --limit-output --exact {{ test_choco_package1|quote }}
+ win_command: choco.exe list --limit-output --exact {{ test_choco_package1|quote }}
register: downgrade_without_version_actual
- name: assert downgrade package without version specified
@@ -478,7 +478,7 @@
register: upgrade_package
- name: get result of upgrade package
- win_command: choco.exe list --local-only --limit-output --exact {{ test_choco_package1|quote }}
+ win_command: choco.exe list --limit-output --exact {{ test_choco_package1|quote }}
register: upgrade_package_actual
- name: assert upgrade package
@@ -500,7 +500,7 @@
register: upgrade_package_with_state_upgrade
- name: get result of upgrade package with state=upgrade
- win_command: choco.exe list --local-only --limit-output --exact {{ test_choco_package1|quote }}
+ win_command: choco.exe list --limit-output --exact {{ test_choco_package1|quote }}
register: actual_after_upgrade_with_state_upgrade
- name: assert upgrade package with state=upgrade
@@ -528,7 +528,7 @@
register: install_prerelease
- name: get result of install prerelease package
- win_command: choco.exe list --local-only --limit-output --exact {{ test_choco_package2|quote }}
+ win_command: choco.exe list --limit-output --exact {{ test_choco_package2|quote }}
register: install_prerelease_actual
- name: assert install prerelease package
@@ -541,7 +541,7 @@
win_chocolatey:
name: '{{ test_choco_package1 }}'
state: downgrade
- version: 0.0.1
+ version: '0.0.1'
- name: upgrade all packages
win_chocolatey:
@@ -550,7 +550,7 @@
register: all_latest
- name: get result of upgrade all packages
- win_command: choco.exe list --local-only --limit-output --exact {{ test_choco_package1|quote }}
+ win_command: choco.exe list --limit-output --exact {{ test_choco_package1|quote }}
register: all_latest_actual
- name: assert upgrade all packages
@@ -564,24 +564,20 @@
name: '{{ test_choco_package1 }}'
state: present
-- name: install older package with allow_multiple
+- name: installing older package with allow_multiple fails on CLI v2.0+
win_chocolatey:
name: '{{ test_choco_package1 }}'
state: present
- allow_multiple: True
+ allow_multiple: yes
version: '0.0.1'
- register: allow_multiple
-
-- name: get result of install older package with allow_multiple
- win_command: choco.exe list --local-only --limit-output --all-versions
- register: allow_multiple_actual
+ register: allow_multiple_cli_v2
+ ignore_errors: true
-- name: assert install older package with allow_multiple
+- name: assert installing older package with allow_multiple fails on CLI v2.0+
assert:
that:
- - allow_multiple is changed
- - '"{{ test_choco_package1 }}|0.1.0" in allow_multiple_actual.stdout_lines'
- - '"{{ test_choco_package1 }}|0.0.1" in allow_multiple_actual.stdout_lines'
+ - allow_multiple_cli_v2.failed
+ - allow_multiple_cli_v2.msg == "Option 'allow_multiple' is not supported on the installed version of Chocolatey CLI"
- name: pin 2 packages (check mode)
win_chocolatey:
@@ -636,24 +632,6 @@
that:
- not pin_multiple_again is changed
-- name: pin specific older version
- win_chocolatey:
- name: '{{ test_choco_package1 }}'
- state: present
- pinned: yes
- version: '0.0.1'
- register: pin_older
-
-- name: get result of pin specific older version
- win_command: choco.exe pin list --limit-output
- register: pin_older_actual
-
-- name: assert pin specific older version
- assert:
- that:
- - pin_older is changed
- - pin_older_actual.stdout_lines == ["ansible|0.1.0", "ansible|0.0.1", "ansible-test|1.0.1-beta1"]
-
- name: unpin package at version
win_chocolatey:
name: '{{ test_choco_package1 }}'
@@ -670,7 +648,7 @@
assert:
that:
- unpin_version is changed
- - unpin_version_actual.stdout_lines == ["ansible|0.0.1", "ansible-test|1.0.1-beta1"]
+ - unpin_version_actual.stdout_lines == ["ansible-test|1.0.1-beta1"]
- name: unpin multiple packages without a version
win_chocolatey:
@@ -691,24 +669,6 @@
- unpin_multiple is changed
- unpin_multiple_actual.stdout == ""
-- name: uninstall specific version installed with allow_multiple
- win_chocolatey:
- name: '{{ test_choco_package1 }}'
- state: absent
- version: '0.0.1'
- register: remove_multiple
-
-- name: get result of uninstall specific version installed with allow_multiple
- win_command: choco.exe list --local-only --limit-output --all-versions
- register: remove_multiple_actual
-
-- name: assert uninstall specific version installed with allow_multiple
- assert:
- that:
- - remove_multiple is changed
- - '"{{ test_choco_package1 }}|0.0.1" not in remove_multiple_actual.stdout_lines'
- - '"{{ test_choco_package1 }}|0.1.0" in remove_multiple_actual.stdout_lines'
-
- name: attempt to uninstall a nonexistent version of an installed package
win_chocolatey:
name: '{{ test_choco_package1 }}'
@@ -717,7 +677,7 @@
register: remove_nonexistent_version
- name: get result of uninstall a nonexistent version of an installed package
- win_command: choco.exe list --local-only --limit-output --all-versions
+ win_command: choco.exe list --limit-output --all-versions
register: remove_nonexistent_version_result
- name: assert uninstall of nonexistent version of an installed package
@@ -726,30 +686,31 @@
- not remove_nonexistent_version is changed
- '"{{ test_choco_package1 }}|0.1.0" in remove_nonexistent_version_result.stdout_lines'
-- name: remove existing Chocolatey installation
- win_shell: Remove-Item -Path "C:/ProgramData/chocolatey" -Recurse -Force
-
-- name: install Chocolatey using the test bootstrap script
+- name: install package with checksum overrides
win_chocolatey:
- name: chocolatey
+ name: '{{ test_choco_package1 }}'
state: present
- bootstrap_script: "{{ test_choco_bootstrap_script }}"
-
-- name: checking if the bootstrap file has been created
- win_shell: Get-Content -Path "C:/temp/confirm-bootstrap.txt" -Raw
- register: bootstrap_file_check
+ checksum: 96e27a3dbef8b4a9f890162c475b9192fee6c9b9
+ checksum_type: sha1
+ checksum64: a3a1f075f5b0e9ee7cd2ba33afbb5f67b9e335117ef3ea352fc361b098aecad4
+ checksum_type64: sha256
+ force: true
+ register: checksum
+
+- name: get result of install package with checksum overrides
+ win_command: choco.exe list --exact --limit-output {{ test_choco_package1|quote }}
+ register: checksum_actual
+
+- name: get package info of install package with checksum overrides
+ win_shell: Get-Content -Path '{{ test_choco_path }}\{{ test_choco_package1 }}-0.1.0.txt' -Raw
+ register: checksum_actual_info
-- name: assert bootstrap file has been created
+- name: assert install package with checksum overrides
assert:
that:
- - (bootstrap_file_check.stdout|from_json).bootstrap
-
-- name: remove chocolatey package directory
- win_file:
- path: 'C:/ProgramData/chocolatey/lib/chocolatey'
- state: absent
-
-- name: ensure we can still upgrade packages with chocolatey package files missing
- win_chocolatey:
- name: chocolatey
- state: upgrade
+ - checksum is changed
+ - checksum_actual.stdout_lines == [test_choco_package1 + "|0.1.0"]
+ - (checksum_actual_info.stdout|from_json).checksum == "96e27a3dbef8b4a9f890162c475b9192fee6c9b9"
+ - (checksum_actual_info.stdout|from_json).checksum_type == "sha1"
+ - (checksum_actual_info.stdout|from_json).checksum64 == "a3a1f075f5b0e9ee7cd2ba33afbb5f67b9e335117ef3ea352fc361b098aecad4"
+ - (checksum_actual_info.stdout|from_json).checksum_type64 == "sha256"
diff --git a/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey_facts/tasks/main.yml b/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey_facts/tasks/main.yml
index d242656e8..8aee6a4fd 100644
--- a/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey_facts/tasks/main.yml
+++ b/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey_facts/tasks/main.yml
@@ -94,3 +94,7 @@
- ansible_chocolatey.sources[1].priority == 9
- ansible_chocolatey.sources[1].source == 'http://test-server/chocolatey'
- ansible_chocolatey.sources[1].source_username == 'test-user'
+
+# Testing of the new gather_subset option has been isolated to its own file
+- name: win_chocolatey_fact gather_subset option tests
+ include_tasks: test_gather_facts.yml
diff --git a/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey_facts/tasks/test_gather_facts.yml b/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey_facts/tasks/test_gather_facts.yml
new file mode 100644
index 000000000..ba46c60f8
--- /dev/null
+++ b/ansible_collections/chocolatey/chocolatey/tests/integration/targets/win_chocolatey_facts/tasks/test_gather_facts.yml
@@ -0,0 +1,71 @@
+---
+- name: Ensure there are no facts from previous tests
+ ansible.builtin.meta: clear_facts
+
+- name: Gather all facts, with implied "all" filter
+ win_chocolatey_facts:
+
+- name: assert all chocolatey facts are gathered
+ assert:
+ that:
+ - ansible_chocolatey is not changed
+ - ansible_chocolatey.outdated is defined
+ - ansible_chocolatey.config is defined
+ - ansible_chocolatey.feature is defined
+ - ansible_chocolatey.packages is defined
+ - ansible_chocolatey.sources is defined
+ - '"config" not in ansible_chocolatey.filter'
+ - '"feature" not in ansible_chocolatey.filter'
+ - '"packages" not in ansible_chocolatey.filter'
+ - '"sources" not in ansible_chocolatey.filter'
+ - '"outdated" not in ansible_chocolatey.filter'
+ - '"all" in ansible_chocolatey.filter'
+
+- name: Ensure there are no facts from previous tests
+ ansible.builtin.meta: clear_facts
+
+- name: Gather facts, except outdated packages
+ win_chocolatey_facts:
+ filter:
+ - 'config'
+ - 'feature'
+ - 'packages'
+ - 'sources'
+
+- name: assert all chocolatey facts except for outdated packages are gathered
+ assert:
+ that:
+ - ansible_chocolatey is not changed
+ - ansible_chocolatey.outdated is not defined
+ - ansible_chocolatey.config is defined
+ - ansible_chocolatey.feature is defined
+ - ansible_chocolatey.packages is defined
+ - ansible_chocolatey.sources is defined
+ - '"config" in ansible_chocolatey.filter'
+ - '"feature" in ansible_chocolatey.filter'
+ - '"packages" in ansible_chocolatey.filter'
+ - '"sources" in ansible_chocolatey.filter'
+ - '"outdated" not in ansible_chocolatey.filter'
+ - '"all" not in ansible_chocolatey.filter'
+
+- name: Ensure there are no facts from previous tests
+ ansible.builtin.meta: clear_facts
+
+- name: Gather config and feature facts only
+ win_chocolatey_facts:
+ filter:
+ - 'config'
+ - 'feature'
+
+- name: assert only config and feature chocolatey facts are gathered
+ assert:
+ that:
+ - ansible_chocolatey is not changed
+ - ansible_chocolatey.config is defined
+ - ansible_chocolatey.feature is defined
+ - ansible_chocolatey.outdated is not defined
+ - ansible_chocolatey.packages is not defined
+ - ansible_chocolatey.sources is not defined
+ - '"config" in ansible_chocolatey.filter'
+ - '"feature" in ansible_chocolatey.filter'
+ - '"all" not in ansible_chocolatey.filter'