ansible-core 2.17.6rc1__py3-none-any.whl → 2.18.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ansible-core might be problematic. Click here for more details.

Files changed (325) hide show
  1. ansible/__main__.py +2 -17
  2. ansible/cli/__init__.py +3 -15
  3. ansible/cli/config.py +187 -24
  4. ansible/cli/console.py +1 -1
  5. ansible/cli/doc.py +38 -16
  6. ansible/cli/galaxy.py +3 -49
  7. ansible/cli/inventory.py +2 -2
  8. ansible/cli/pull.py +2 -2
  9. ansible/cli/scripts/ansible_connection_cli_stub.py +1 -10
  10. ansible/config/base.yml +127 -57
  11. ansible/config/manager.py +89 -11
  12. ansible/constants.py +32 -9
  13. ansible/errors/__init__.py +5 -0
  14. ansible/executor/interpreter_discovery.py +1 -1
  15. ansible/executor/play_iterator.py +16 -0
  16. ansible/executor/playbook_executor.py +1 -4
  17. ansible/executor/powershell/become_wrapper.ps1 +4 -5
  18. ansible/executor/powershell/bootstrap_wrapper.ps1 +2 -3
  19. ansible/executor/powershell/exec_wrapper.ps1 +1 -1
  20. ansible/executor/powershell/module_manifest.py +2 -2
  21. ansible/executor/task_executor.py +50 -39
  22. ansible/executor/task_queue_manager.py +1 -1
  23. ansible/executor/task_result.py +1 -1
  24. ansible/galaxy/api.py +3 -4
  25. ansible/galaxy/collection/__init__.py +21 -10
  26. ansible/galaxy/collection/concrete_artifact_manager.py +2 -2
  27. ansible/galaxy/collection/galaxy_api_proxy.py +10 -16
  28. ansible/galaxy/collection/gpg.py +17 -23
  29. ansible/galaxy/data/COPYING +7 -0
  30. ansible/galaxy/data/apb/Dockerfile.j2 +1 -0
  31. ansible/galaxy/data/apb/Makefile.j2 +1 -0
  32. ansible/galaxy/data/apb/README.md +7 -3
  33. ansible/galaxy/data/apb/apb.yml.j2 +1 -0
  34. ansible/galaxy/data/apb/defaults/main.yml.j2 +1 -0
  35. ansible/galaxy/data/apb/handlers/main.yml.j2 +1 -0
  36. ansible/galaxy/data/apb/meta/main.yml.j2 +1 -0
  37. ansible/galaxy/data/apb/playbooks/deprovision.yml.j2 +1 -0
  38. ansible/galaxy/data/apb/playbooks/provision.yml.j2 +1 -0
  39. ansible/galaxy/data/apb/tasks/main.yml.j2 +1 -0
  40. ansible/galaxy/data/apb/tests/ansible.cfg +1 -0
  41. ansible/galaxy/data/apb/tests/inventory +1 -0
  42. ansible/galaxy/data/apb/tests/test.yml.j2 +1 -0
  43. ansible/galaxy/data/apb/vars/main.yml.j2 +1 -0
  44. ansible/galaxy/data/collections_galaxy_meta.yml +1 -0
  45. ansible/galaxy/data/container/defaults/main.yml.j2 +1 -0
  46. ansible/galaxy/data/container/handlers/main.yml.j2 +1 -0
  47. ansible/galaxy/data/container/meta/container.yml.j2 +1 -0
  48. ansible/galaxy/data/container/meta/main.yml.j2 +1 -0
  49. ansible/galaxy/data/container/tasks/main.yml.j2 +1 -0
  50. ansible/galaxy/data/container/tests/ansible.cfg +1 -0
  51. ansible/galaxy/data/container/tests/inventory +1 -0
  52. ansible/galaxy/data/container/tests/test.yml.j2 +1 -0
  53. ansible/galaxy/data/container/vars/main.yml.j2 +1 -0
  54. ansible/galaxy/data/default/collection/README.md.j2 +1 -0
  55. ansible/galaxy/data/default/collection/galaxy.yml.j2 +1 -0
  56. ansible/galaxy/data/default/collection/meta/runtime.yml +1 -0
  57. ansible/galaxy/data/default/collection/plugins/README.md.j2 +1 -0
  58. ansible/galaxy/data/default/role/defaults/main.yml.j2 +1 -0
  59. ansible/galaxy/data/default/role/handlers/main.yml.j2 +1 -0
  60. ansible/galaxy/data/default/role/meta/main.yml.j2 +1 -0
  61. ansible/galaxy/data/default/role/tasks/main.yml.j2 +1 -0
  62. ansible/galaxy/data/default/role/tests/inventory +1 -0
  63. ansible/galaxy/data/default/role/tests/test.yml.j2 +1 -0
  64. ansible/galaxy/data/default/role/vars/main.yml.j2 +1 -0
  65. ansible/galaxy/data/network/cliconf_plugins/example.py.j2 +1 -0
  66. ansible/galaxy/data/network/defaults/main.yml.j2 +1 -0
  67. ansible/galaxy/data/network/library/example_command.py.j2 +1 -0
  68. ansible/galaxy/data/network/library/example_config.py.j2 +1 -0
  69. ansible/galaxy/data/network/library/example_facts.py.j2 +1 -0
  70. ansible/galaxy/data/network/meta/main.yml.j2 +1 -0
  71. ansible/galaxy/data/network/module_utils/example.py.j2 +1 -0
  72. ansible/galaxy/data/network/netconf_plugins/example.py.j2 +1 -0
  73. ansible/galaxy/data/network/tasks/main.yml.j2 +1 -0
  74. ansible/galaxy/data/network/terminal_plugins/example.py.j2 +1 -0
  75. ansible/galaxy/data/network/tests/inventory +1 -0
  76. ansible/galaxy/data/network/tests/test.yml.j2 +1 -0
  77. ansible/galaxy/data/network/vars/main.yml.j2 +1 -0
  78. ansible/galaxy/dependency_resolution/providers.py +3 -3
  79. ansible/galaxy/role.py +1 -1
  80. ansible/galaxy/token.py +20 -8
  81. ansible/keyword_desc.yml +1 -1
  82. ansible/module_utils/_internal/__init__.py +0 -0
  83. ansible/module_utils/_internal/_concurrent/__init__.py +0 -0
  84. ansible/module_utils/_internal/_concurrent/_daemon_threading.py +28 -0
  85. ansible/module_utils/_internal/_concurrent/_futures.py +21 -0
  86. ansible/module_utils/ansible_release.py +2 -2
  87. ansible/module_utils/api.py +2 -2
  88. ansible/module_utils/basic.py +8 -8
  89. ansible/module_utils/common/collections.py +1 -1
  90. ansible/module_utils/common/file.py +0 -6
  91. ansible/module_utils/common/process.py +22 -9
  92. ansible/module_utils/common/text/converters.py +5 -8
  93. ansible/module_utils/common/text/formatters.py +20 -4
  94. ansible/module_utils/common/validation.py +33 -25
  95. ansible/module_utils/compat/paramiko.py +6 -1
  96. ansible/module_utils/compat/selinux.py +2 -2
  97. ansible/module_utils/connection.py +8 -24
  98. ansible/module_utils/csharp/Ansible.Become.cs +14 -25
  99. ansible/module_utils/csharp/Ansible.Process.cs +1 -1
  100. ansible/module_utils/distro/__init__.py +1 -1
  101. ansible/module_utils/distro/_distro.py +8 -4
  102. ansible/module_utils/facts/collector.py +2 -0
  103. ansible/module_utils/facts/default_collectors.py +3 -1
  104. ansible/module_utils/facts/hardware/aix.py +54 -52
  105. ansible/module_utils/facts/hardware/darwin.py +37 -34
  106. ansible/module_utils/facts/hardware/freebsd.py +55 -15
  107. ansible/module_utils/facts/hardware/hpux.py +3 -0
  108. ansible/module_utils/facts/hardware/linux.py +101 -57
  109. ansible/module_utils/facts/hardware/netbsd.py +3 -0
  110. ansible/module_utils/facts/hardware/openbsd.py +4 -1
  111. ansible/module_utils/facts/hardware/sunos.py +7 -1
  112. ansible/module_utils/facts/network/aix.py +16 -17
  113. ansible/module_utils/facts/network/fc_wwn.py +4 -1
  114. ansible/module_utils/facts/network/hpux.py +21 -4
  115. ansible/module_utils/facts/network/iscsi.py +7 -8
  116. ansible/module_utils/facts/network/linux.py +0 -2
  117. ansible/module_utils/facts/other/facter.py +9 -4
  118. ansible/module_utils/facts/other/ohai.py +5 -5
  119. ansible/module_utils/facts/packages.py +49 -7
  120. ansible/module_utils/facts/sysctl.py +33 -31
  121. ansible/module_utils/facts/system/distribution.py +1 -1
  122. ansible/module_utils/facts/system/local.py +12 -22
  123. ansible/module_utils/facts/system/service_mgr.py +3 -1
  124. ansible/module_utils/facts/system/systemd.py +47 -0
  125. ansible/module_utils/powershell/Ansible.ModuleUtils.AddType.psm1 +1 -1
  126. ansible/module_utils/powershell/Ansible.ModuleUtils.CamelConversion.psm1 +1 -1
  127. ansible/module_utils/splitter.py +1 -1
  128. ansible/modules/add_host.py +1 -1
  129. ansible/modules/apt.py +43 -32
  130. ansible/modules/apt_key.py +6 -6
  131. ansible/modules/apt_repository.py +23 -14
  132. ansible/modules/assemble.py +7 -2
  133. ansible/modules/assert.py +4 -4
  134. ansible/modules/blockinfile.py +3 -6
  135. ansible/modules/command.py +1 -1
  136. ansible/modules/copy.py +4 -4
  137. ansible/modules/cron.py +13 -10
  138. ansible/modules/deb822_repository.py +16 -17
  139. ansible/modules/debconf.py +9 -9
  140. ansible/modules/debug.py +1 -1
  141. ansible/modules/dnf.py +79 -164
  142. ansible/modules/dnf5.py +54 -29
  143. ansible/modules/dpkg_selections.py +2 -2
  144. ansible/modules/expect.py +2 -2
  145. ansible/modules/fetch.py +2 -2
  146. ansible/modules/file.py +5 -3
  147. ansible/modules/find.py +40 -12
  148. ansible/modules/gather_facts.py +4 -2
  149. ansible/modules/get_url.py +29 -24
  150. ansible/modules/git.py +35 -35
  151. ansible/modules/group.py +71 -1
  152. ansible/modules/hostname.py +2 -4
  153. ansible/modules/include_vars.py +5 -5
  154. ansible/modules/iptables.py +13 -16
  155. ansible/modules/known_hosts.py +16 -13
  156. ansible/modules/lineinfile.py +1 -4
  157. ansible/modules/meta.py +6 -1
  158. ansible/modules/mount_facts.py +651 -0
  159. ansible/modules/package_facts.py +63 -80
  160. ansible/modules/pause.py +4 -3
  161. ansible/modules/pip.py +14 -14
  162. ansible/modules/replace.py +1 -4
  163. ansible/modules/rpm_key.py +31 -11
  164. ansible/modules/service.py +8 -8
  165. ansible/modules/service_facts.py +20 -5
  166. ansible/modules/set_stats.py +1 -1
  167. ansible/modules/setup.py +3 -3
  168. ansible/modules/stat.py +3 -3
  169. ansible/modules/subversion.py +1 -1
  170. ansible/modules/systemd.py +16 -10
  171. ansible/modules/systemd_service.py +16 -10
  172. ansible/modules/sysvinit.py +4 -4
  173. ansible/modules/unarchive.py +35 -22
  174. ansible/modules/uri.py +24 -18
  175. ansible/modules/user.py +145 -12
  176. ansible/modules/validate_argument_spec.py +3 -3
  177. ansible/modules/wait_for_connection.py +2 -1
  178. ansible/modules/yum_repository.py +136 -179
  179. ansible/parsing/dataloader.py +2 -2
  180. ansible/parsing/mod_args.py +11 -10
  181. ansible/parsing/vault/__init__.py +8 -3
  182. ansible/parsing/yaml/constructor.py +10 -8
  183. ansible/parsing/yaml/objects.py +1 -1
  184. ansible/playbook/base.py +12 -23
  185. ansible/playbook/helpers.py +4 -0
  186. ansible/playbook/loop_control.py +8 -0
  187. ansible/playbook/play.py +4 -22
  188. ansible/playbook/play_context.py +0 -16
  189. ansible/playbook/playbook_include.py +2 -2
  190. ansible/playbook/role/__init__.py +2 -2
  191. ansible/plugins/__init__.py +2 -0
  192. ansible/plugins/action/__init__.py +7 -9
  193. ansible/plugins/action/dnf.py +7 -5
  194. ansible/plugins/action/package.py +5 -4
  195. ansible/plugins/action/reboot.py +2 -2
  196. ansible/plugins/become/__init__.py +1 -1
  197. ansible/plugins/callback/__init__.py +44 -3
  198. ansible/plugins/callback/default.py +1 -1
  199. ansible/plugins/cliconf/__init__.py +1 -1
  200. ansible/plugins/connection/paramiko_ssh.py +2 -80
  201. ansible/plugins/connection/psrp.py +33 -82
  202. ansible/plugins/connection/ssh.py +0 -8
  203. ansible/plugins/connection/winrm.py +46 -1
  204. ansible/plugins/doc_fragments/connection_pipelining.py +2 -2
  205. ansible/plugins/doc_fragments/constructed.py +10 -10
  206. ansible/plugins/doc_fragments/default_callback.py +8 -8
  207. ansible/plugins/doc_fragments/files.py +5 -5
  208. ansible/plugins/doc_fragments/inventory_cache.py +2 -2
  209. ansible/plugins/doc_fragments/result_format_callback.py +6 -6
  210. ansible/plugins/doc_fragments/return_common.py +1 -1
  211. ansible/plugins/doc_fragments/shell_common.py +2 -10
  212. ansible/plugins/doc_fragments/shell_windows.py +0 -9
  213. ansible/plugins/doc_fragments/url.py +2 -2
  214. ansible/plugins/doc_fragments/url_windows.py +4 -5
  215. ansible/plugins/doc_fragments/validate.py +1 -1
  216. ansible/plugins/filter/core.py +2 -0
  217. ansible/plugins/filter/human_to_bytes.yml +9 -0
  218. ansible/plugins/filter/password_hash.yml +1 -1
  219. ansible/plugins/filter/strftime.yml +1 -1
  220. ansible/plugins/filter/to_nice_json.yml +7 -3
  221. ansible/plugins/filter/to_uuid.yml +1 -1
  222. ansible/plugins/inventory/script.py +1 -1
  223. ansible/plugins/list.py +1 -1
  224. ansible/plugins/loader.py +0 -11
  225. ansible/plugins/lookup/config.py +1 -1
  226. ansible/plugins/lookup/csvfile.py +21 -9
  227. ansible/plugins/lookup/env.py +8 -9
  228. ansible/plugins/lookup/ini.py +10 -1
  229. ansible/plugins/lookup/random_choice.py +2 -2
  230. ansible/plugins/lookup/url.py +7 -2
  231. ansible/plugins/shell/__init__.py +15 -20
  232. ansible/plugins/shell/powershell.py +9 -6
  233. ansible/plugins/strategy/__init__.py +16 -7
  234. ansible/plugins/test/core.py +23 -1
  235. ansible/plugins/test/issubset.yml +1 -1
  236. ansible/plugins/test/subset.yml +1 -1
  237. ansible/plugins/test/timedout.yml +20 -0
  238. ansible/plugins/test/vault_encrypted.yml +6 -6
  239. ansible/plugins/test/vaulted_file.yml +19 -0
  240. ansible/release.py +2 -2
  241. ansible/template/__init__.py +3 -8
  242. ansible/utils/collection_loader/_collection_finder.py +23 -55
  243. ansible/utils/display.py +44 -31
  244. ansible/utils/jsonrpc.py +1 -1
  245. ansible/utils/listify.py +1 -5
  246. ansible/utils/path.py +3 -0
  247. ansible/utils/vars.py +18 -27
  248. ansible/vars/manager.py +7 -150
  249. ansible/vars/plugins.py +1 -1
  250. ansible_core-2.18.0.dist-info/Apache-License.txt +202 -0
  251. {ansible_core-2.17.6rc1.dist-info → ansible_core-2.18.0.dist-info}/METADATA +36 -23
  252. ansible_core-2.18.0.dist-info/MIT-license.txt +14 -0
  253. ansible_core-2.18.0.dist-info/PSF-license.txt +48 -0
  254. {ansible_core-2.17.6rc1.dist-info → ansible_core-2.18.0.dist-info}/RECORD +316 -311
  255. {ansible_core-2.17.6rc1.dist-info → ansible_core-2.18.0.dist-info}/entry_points.txt +1 -1
  256. ansible_core-2.18.0.dist-info/simplified_bsd.txt +8 -0
  257. ansible_test/_data/completion/docker.txt +7 -7
  258. ansible_test/_data/completion/remote.txt +5 -4
  259. ansible_test/_data/completion/windows.txt +4 -4
  260. ansible_test/_data/requirements/ansible-test.txt +1 -2
  261. ansible_test/_data/requirements/constraints.txt +1 -2
  262. ansible_test/_data/requirements/sanity.ansible-doc.txt +3 -3
  263. ansible_test/_data/requirements/sanity.changelog.in +1 -1
  264. ansible_test/_data/requirements/sanity.changelog.txt +4 -4
  265. ansible_test/_data/requirements/sanity.import.plugin.txt +2 -2
  266. ansible_test/_data/requirements/sanity.import.txt +1 -1
  267. ansible_test/_data/requirements/sanity.integration-aliases.txt +1 -1
  268. ansible_test/_data/requirements/sanity.pep8.txt +1 -1
  269. ansible_test/_data/requirements/sanity.pylint.txt +6 -8
  270. ansible_test/_data/requirements/sanity.runtime-metadata.txt +2 -2
  271. ansible_test/_data/requirements/sanity.validate-modules.txt +3 -3
  272. ansible_test/_data/requirements/sanity.yamllint.in +1 -0
  273. ansible_test/_data/requirements/sanity.yamllint.txt +1 -1
  274. ansible_test/_internal/ansible_util.py +8 -35
  275. ansible_test/_internal/ci/azp.py +1 -1
  276. ansible_test/_internal/classification/__init__.py +0 -2
  277. ansible_test/_internal/cli/parsers/key_value_parsers.py +3 -0
  278. ansible_test/_internal/commands/integration/cloud/hcloud.py +1 -1
  279. ansible_test/_internal/commands/integration/cloud/httptester.py +1 -1
  280. ansible_test/_internal/commands/integration/cloud/nios.py +1 -1
  281. ansible_test/_internal/commands/sanity/__init__.py +96 -19
  282. ansible_test/_internal/commands/sanity/pylint.py +20 -24
  283. ansible_test/_internal/completion.py +2 -0
  284. ansible_test/_internal/constants.py +0 -1
  285. ansible_test/_internal/coverage_util.py +1 -2
  286. ansible_test/_internal/docker_util.py +1 -1
  287. ansible_test/_internal/encoding.py +4 -4
  288. ansible_test/_internal/host_configs.py +10 -0
  289. ansible_test/_internal/host_profiles.py +9 -13
  290. ansible_test/_internal/pypi_proxy.py +1 -1
  291. ansible_test/_internal/python_requirements.py +5 -14
  292. ansible_test/_internal/timeout.py +1 -1
  293. ansible_test/_internal/util.py +40 -0
  294. ansible_test/_internal/util_common.py +5 -1
  295. ansible_test/_util/controller/sanity/code-smell/action-plugin-docs.json +3 -1
  296. ansible_test/_util/controller/sanity/code-smell/action-plugin-docs.py +6 -3
  297. ansible_test/_util/controller/sanity/code-smell/empty-init.json +0 -2
  298. ansible_test/_util/controller/sanity/pylint/config/ansible-test-target.cfg +5 -0
  299. ansible_test/_util/controller/sanity/pylint/config/ansible-test.cfg +5 -0
  300. ansible_test/_util/controller/sanity/pylint/config/code-smell.cfg +5 -0
  301. ansible_test/_util/controller/sanity/pylint/config/collection.cfg +6 -0
  302. ansible_test/_util/controller/sanity/pylint/config/default.cfg +6 -0
  303. ansible_test/_util/controller/sanity/pylint/plugins/deprecated.py +1 -19
  304. ansible_test/_util/controller/sanity/shellcheck/exclude.txt +1 -0
  305. ansible_test/_util/controller/sanity/validate-modules/validate_modules/main.py +67 -2
  306. ansible_test/_util/controller/sanity/validate-modules/validate_modules/schema.py +27 -5
  307. ansible_test/_util/target/cli/ansible_test_cli_stub.py +0 -0
  308. ansible_test/_util/target/common/constants.py +2 -2
  309. ansible_test/_util/target/injector/python.py +5 -0
  310. ansible_test/_util/target/pytest/plugins/ansible_pytest_coverage.py +6 -0
  311. ansible_test/_util/target/sanity/import/importer.py +1 -1
  312. ansible_test/_util/target/setup/bootstrap.sh +6 -17
  313. ansible_test/_util/target/setup/requirements.py +18 -24
  314. ansible_test/config/config.yml +1 -1
  315. ansible_core-2.17.6rc1.data/scripts/ansible-test +0 -44
  316. ansible_test/_data/requirements/sanity.mypy.in +0 -10
  317. ansible_test/_data/requirements/sanity.mypy.txt +0 -18
  318. ansible_test/_internal/commands/sanity/mypy.py +0 -274
  319. ansible_test/_util/controller/sanity/mypy/ansible-core.ini +0 -116
  320. ansible_test/_util/controller/sanity/mypy/ansible-test.ini +0 -27
  321. ansible_test/_util/controller/sanity/mypy/modules.ini +0 -92
  322. ansible_test/_util/controller/sanity/mypy/packaging.ini +0 -20
  323. {ansible_core-2.17.6rc1.dist-info → ansible_core-2.18.0.dist-info}/COPYING +0 -0
  324. {ansible_core-2.17.6rc1.dist-info → ansible_core-2.18.0.dist-info}/WHEEL +0 -0
  325. {ansible_core-2.17.6rc1.dist-info → ansible_core-2.18.0.dist-info}/top_level.txt +0 -0
@@ -34,7 +34,7 @@ options:
34
34
  choices: [ reloaded, restarted, started, stopped ]
35
35
  enabled:
36
36
  description:
37
- - Whether the unit should start on boot. B(At least one of state and enabled are required.)
37
+ - Whether the unit should start on boot. At least one of O(state) and O(enabled) are required.
38
38
  - If set, requires O(name).
39
39
  type: bool
40
40
  force:
@@ -49,8 +49,8 @@ options:
49
49
  type: bool
50
50
  daemon_reload:
51
51
  description:
52
- - Run daemon-reload before doing any other operations, to make sure systemd has read any changes.
53
- - When set to V(true), runs daemon-reload even if the module does not start or stop anything.
52
+ - Run C(daemon-reload) before doing any other operations, to make sure systemd has read any changes.
53
+ - When set to V(true), runs C(daemon-reload) even if the module does not start or stop anything.
54
54
  type: bool
55
55
  default: no
56
56
  aliases: [ daemon-reload ]
@@ -63,9 +63,9 @@ options:
63
63
  version_added: "2.8"
64
64
  scope:
65
65
  description:
66
- - Run systemctl within a given service manager scope, either as the default system scope V(system),
66
+ - Run C(systemctl) within a given service manager scope, either as the default system scope V(system),
67
67
  the current user's scope V(user), or the scope of all users V(global).
68
- - "For systemd to work with 'user', the executing user must have its own instance of dbus started and accessible (systemd requirement)."
68
+ - "For systemd to work with V(user), the executing user must have its own instance of dbus started and accessible (systemd requirement)."
69
69
  - "The user dbus process is normally started during normal login, but not during the run of Ansible tasks.
70
70
  Otherwise you will probably get a 'Failed to connect to bus: no such file or directory' error."
71
71
  - The user must have access, normally given via setting the C(XDG_RUNTIME_DIR) variable, see the example below.
@@ -95,7 +95,7 @@ notes:
95
95
  - Globs are not supported in name, in other words, C(postgres*.service).
96
96
  - The service names might vary by specific OS/distribution.
97
97
  - The order of execution when having multiple properties is to first enable/disable, then mask/unmask and then deal with the service state.
98
- It has been reported that systemctl can behave differently depending on the order of operations if you do the same manually.
98
+ It has been reported that C(systemctl) can behave differently depending on the order of operations if you do the same manually.
99
99
  requirements:
100
100
  - A system managed by systemd.
101
101
  '''
@@ -495,6 +495,8 @@ def main():
495
495
  if rc != 0:
496
496
  # some versions of system CAN mask/unmask non existing services, we only fail on missing if they don't
497
497
  fail_if_missing(module, found, unit, msg='host')
498
+ # here if service was not missing, but failed for other reasons
499
+ module.fail_json(msg=f"Failed to {action} the service ({unit}): {err.strip()}")
498
500
 
499
501
  # Enable/disable service startup at boot if requested
500
502
  if module.params['enabled'] is not None:
@@ -512,11 +514,15 @@ def main():
512
514
 
513
515
  # check systemctl result or if it is a init script
514
516
  if rc == 0:
515
- enabled = True
516
- # Check if the service is indirect or alias and if out contains exactly 1 line of string 'indirect'/ 'alias' it's disabled
517
- if out.splitlines() == ["indirect"] or out.splitlines() == ["alias"]:
517
+ # https://www.freedesktop.org/software/systemd/man/systemctl.html#is-enabled%20UNIT%E2%80%A6
518
+ if out.rstrip() in (
519
+ "enabled-runtime", # transiently enabled but we're trying to set a permanent enabled
520
+ "indirect", # We've been asked to enable this unit so do so despite possible reasons
521
+ # that systemctl may have for thinking it's enabled already.
522
+ "alias"): # Let systemd handle the alias as we can't be sure what's needed.
518
523
  enabled = False
519
-
524
+ else:
525
+ enabled = True
520
526
  elif rc == 1:
521
527
  # if not a user or global user service and both init script and unit file exist stdout should have enabled/disabled, otherwise use rc entries
522
528
  if module.params['scope'] == 'system' and \
@@ -34,7 +34,7 @@ options:
34
34
  choices: [ reloaded, restarted, started, stopped ]
35
35
  enabled:
36
36
  description:
37
- - Whether the unit should start on boot. B(At least one of state and enabled are required.)
37
+ - Whether the unit should start on boot. At least one of O(state) and O(enabled) are required.
38
38
  - If set, requires O(name).
39
39
  type: bool
40
40
  force:
@@ -49,8 +49,8 @@ options:
49
49
  type: bool
50
50
  daemon_reload:
51
51
  description:
52
- - Run daemon-reload before doing any other operations, to make sure systemd has read any changes.
53
- - When set to V(true), runs daemon-reload even if the module does not start or stop anything.
52
+ - Run C(daemon-reload) before doing any other operations, to make sure systemd has read any changes.
53
+ - When set to V(true), runs C(daemon-reload) even if the module does not start or stop anything.
54
54
  type: bool
55
55
  default: no
56
56
  aliases: [ daemon-reload ]
@@ -63,9 +63,9 @@ options:
63
63
  version_added: "2.8"
64
64
  scope:
65
65
  description:
66
- - Run systemctl within a given service manager scope, either as the default system scope V(system),
66
+ - Run C(systemctl) within a given service manager scope, either as the default system scope V(system),
67
67
  the current user's scope V(user), or the scope of all users V(global).
68
- - "For systemd to work with 'user', the executing user must have its own instance of dbus started and accessible (systemd requirement)."
68
+ - "For systemd to work with V(user), the executing user must have its own instance of dbus started and accessible (systemd requirement)."
69
69
  - "The user dbus process is normally started during normal login, but not during the run of Ansible tasks.
70
70
  Otherwise you will probably get a 'Failed to connect to bus: no such file or directory' error."
71
71
  - The user must have access, normally given via setting the C(XDG_RUNTIME_DIR) variable, see the example below.
@@ -95,7 +95,7 @@ notes:
95
95
  - Globs are not supported in name, in other words, C(postgres*.service).
96
96
  - The service names might vary by specific OS/distribution.
97
97
  - The order of execution when having multiple properties is to first enable/disable, then mask/unmask and then deal with the service state.
98
- It has been reported that systemctl can behave differently depending on the order of operations if you do the same manually.
98
+ It has been reported that C(systemctl) can behave differently depending on the order of operations if you do the same manually.
99
99
  requirements:
100
100
  - A system managed by systemd.
101
101
  '''
@@ -495,6 +495,8 @@ def main():
495
495
  if rc != 0:
496
496
  # some versions of system CAN mask/unmask non existing services, we only fail on missing if they don't
497
497
  fail_if_missing(module, found, unit, msg='host')
498
+ # here if service was not missing, but failed for other reasons
499
+ module.fail_json(msg=f"Failed to {action} the service ({unit}): {err.strip()}")
498
500
 
499
501
  # Enable/disable service startup at boot if requested
500
502
  if module.params['enabled'] is not None:
@@ -512,11 +514,15 @@ def main():
512
514
 
513
515
  # check systemctl result or if it is a init script
514
516
  if rc == 0:
515
- enabled = True
516
- # Check if the service is indirect or alias and if out contains exactly 1 line of string 'indirect'/ 'alias' it's disabled
517
- if out.splitlines() == ["indirect"] or out.splitlines() == ["alias"]:
517
+ # https://www.freedesktop.org/software/systemd/man/systemctl.html#is-enabled%20UNIT%E2%80%A6
518
+ if out.rstrip() in (
519
+ "enabled-runtime", # transiently enabled but we're trying to set a permanent enabled
520
+ "indirect", # We've been asked to enable this unit so do so despite possible reasons
521
+ # that systemctl may have for thinking it's enabled already.
522
+ "alias"): # Let systemd handle the alias as we can't be sure what's needed.
518
523
  enabled = False
519
-
524
+ else:
525
+ enabled = True
520
526
  elif rc == 1:
521
527
  # if not a user or global user service and both init script and unit file exist stdout should have enabled/disabled, otherwise use rc entries
522
528
  if module.params['scope'] == 'system' and \
@@ -31,7 +31,7 @@ options:
31
31
  enabled:
32
32
  type: bool
33
33
  description:
34
- - Whether the service should start on boot. B(At least one of state and enabled are required.)
34
+ - Whether the service should start on boot. At least one of O(state) and O(enabled) are required.
35
35
  sleep:
36
36
  default: 1
37
37
  description:
@@ -42,7 +42,7 @@ options:
42
42
  description:
43
43
  - A substring to look for as would be found in the output of the I(ps) command as a stand-in for a status result.
44
44
  - If the string is found, the service will be assumed to be running.
45
- - "This option is mainly for use with init scripts that don't support the 'status' option."
45
+ - "This option is mainly for use with init scripts that don't support the C(status) option."
46
46
  type: str
47
47
  runlevels:
48
48
  description:
@@ -74,7 +74,7 @@ attributes:
74
74
  platforms: posix
75
75
  notes:
76
76
  - One option other than name is required.
77
- - The service names might vary by specific OS/distribution
77
+ - The service names might vary by specific OS/distribution.
78
78
  requirements:
79
79
  - That the service managed has a corresponding init script.
80
80
  '''
@@ -203,7 +203,7 @@ def main():
203
203
  worked = is_started = get_ps(module, pattern)
204
204
  else:
205
205
  if location.get('service'):
206
- # standard tool that has been 'destandarized' by reimplementation in other OS/distros
206
+ # standard tool that has been 'destandardized' by reimplementation in other OS/distros
207
207
  cmd = '%s %s status' % (location['service'], name)
208
208
  elif script:
209
209
  # maybe script implements status (not LSB)
@@ -241,7 +241,6 @@ uid:
241
241
 
242
242
  import binascii
243
243
  import codecs
244
- import datetime
245
244
  import fnmatch
246
245
  import grp
247
246
  import os
@@ -260,15 +259,8 @@ from ansible.module_utils.common.process import get_bin_path
260
259
  from ansible.module_utils.common.locale import get_best_parsable_locale
261
260
  from ansible.module_utils.urls import fetch_file
262
261
 
263
- try: # python 3.3+
264
- from shlex import quote # type: ignore[attr-defined]
265
- except ImportError: # older python
266
- from pipes import quote
267
-
268
- try: # python 3.2+
269
- from zipfile import BadZipFile # type: ignore[attr-defined]
270
- except ImportError: # older python
271
- from zipfile import BadZipfile as BadZipFile
262
+ from shlex import quote
263
+ from zipfile import BadZipFile
272
264
 
273
265
  # String from tar that shows the tar contents are different from the
274
266
  # filesystem
@@ -283,6 +275,8 @@ ZIP_FILE_MODE_RE = re.compile(r'([r-][w-][SsTtx-]){3}')
283
275
  INVALID_OWNER_RE = re.compile(r': Invalid owner')
284
276
  INVALID_GROUP_RE = re.compile(r': Invalid group')
285
277
  SYMLINK_DIFF_RE = re.compile(r': Symlink differs$')
278
+ CONTENT_DIFF_RE = re.compile(r': Contents differ$')
279
+ SIZE_DIFF_RE = re.compile(r': Size differs$')
286
280
 
287
281
 
288
282
  def crc32(path, buffer_size):
@@ -411,6 +405,27 @@ class ZipArchive(object):
411
405
  archive.close()
412
406
  return self._files_in_archive
413
407
 
408
+ def _valid_time_stamp(self, timestamp_str):
409
+ """ Return a valid time object from the given time string """
410
+ DT_RE = re.compile(r'^(\d{4})(\d{2})(\d{2})\.(\d{2})(\d{2})(\d{2})$')
411
+ match = DT_RE.match(timestamp_str)
412
+ epoch_date_time = (1980, 1, 1, 0, 0, 0, 0, 0, 0)
413
+ if match:
414
+ try:
415
+ if int(match.groups()[0]) < 1980:
416
+ date_time = epoch_date_time
417
+ elif int(match.groups()[0]) > 2107:
418
+ date_time = (2107, 12, 31, 23, 59, 59, 0, 0, 0)
419
+ else:
420
+ date_time = (int(m) for m in match.groups() + (0, 0, 0))
421
+ except ValueError:
422
+ date_time = epoch_date_time
423
+ else:
424
+ # Assume epoch date
425
+ date_time = epoch_date_time
426
+
427
+ return time.mktime(time.struct_time(date_time))
428
+
414
429
  def is_unarchived(self):
415
430
  # BSD unzip doesn't support zipinfo listings with timestamp.
416
431
  if self.zipinfoflag:
@@ -609,8 +624,7 @@ class ZipArchive(object):
609
624
  # Note: this timestamp calculation has a rounding error
610
625
  # somewhere... unzip and this timestamp can be one second off
611
626
  # When that happens, we report a change and re-unzip the file
612
- dt_object = datetime.datetime(*(time.strptime(pcs[6], '%Y%m%d.%H%M%S')[0:6]))
613
- timestamp = time.mktime(dt_object.timetuple())
627
+ timestamp = self._valid_time_stamp(pcs[6])
614
628
 
615
629
  # Compare file timestamps
616
630
  if stat.S_ISREG(st.st_mode):
@@ -879,16 +893,15 @@ class TgzArchive(object):
879
893
  out += line + '\n'
880
894
  if not self.file_args['mode'] and MODE_DIFF_RE.search(line):
881
895
  out += line + '\n'
882
- if MOD_TIME_DIFF_RE.search(line):
883
- out += line + '\n'
884
- if MISSING_FILE_RE.search(line):
885
- out += line + '\n'
886
- if INVALID_OWNER_RE.search(line):
887
- out += line + '\n'
888
- if INVALID_GROUP_RE.search(line):
889
- out += line + '\n'
890
- if SYMLINK_DIFF_RE.search(line):
891
- out += line + '\n'
896
+ differ_regexes = [
897
+ MOD_TIME_DIFF_RE, MISSING_FILE_RE, INVALID_OWNER_RE,
898
+ INVALID_GROUP_RE, SYMLINK_DIFF_RE, CONTENT_DIFF_RE,
899
+ SIZE_DIFF_RE
900
+ ]
901
+ for regex in differ_regexes:
902
+ if regex.search(line):
903
+ out += line + '\n'
904
+
892
905
  if out:
893
906
  unarchived = False
894
907
  return dict(unarchived=unarchived, rc=rc, out=out, err=err, cmd=cmd)
ansible/modules/uri.py CHANGED
@@ -22,19 +22,19 @@ options:
22
22
  - 'When a list is provided, all ciphers are joined in order with V(:)'
23
23
  - See the L(OpenSSL Cipher List Format,https://www.openssl.org/docs/manmaster/man1/openssl-ciphers.html#CIPHER-LIST-FORMAT)
24
24
  for more details.
25
- - The available ciphers is dependent on the Python and OpenSSL/LibreSSL versions
25
+ - The available ciphers is dependent on the Python and OpenSSL/LibreSSL versions.
26
26
  type: list
27
27
  elements: str
28
28
  version_added: '2.14'
29
29
  decompress:
30
30
  description:
31
- - Whether to attempt to decompress gzip content-encoded responses
31
+ - Whether to attempt to decompress gzip content-encoded responses.
32
32
  type: bool
33
33
  default: true
34
34
  version_added: '2.14'
35
35
  url:
36
36
  description:
37
- - HTTP or HTTPS URL in the form (http|https)://host.domain[:port]/path
37
+ - HTTP or HTTPS URL in the form (http|https)://host.domain[:port]/path.
38
38
  type: str
39
39
  required: true
40
40
  dest:
@@ -58,17 +58,17 @@ options:
58
58
  to V(json) it will take an already formatted JSON string or convert a data structure
59
59
  into JSON.
60
60
  - If O(body_format) is set to V(form-urlencoded) it will convert a dictionary
61
- or list of tuples into an 'application/x-www-form-urlencoded' string. (Added in v2.7)
61
+ or list of tuples into an C(application/x-www-form-urlencoded) string. (Added in v2.7)
62
62
  - If O(body_format) is set to V(form-multipart) it will convert a dictionary
63
- into 'multipart/form-multipart' body. (Added in v2.10)
63
+ into C(multipart/form-multipart) body. (Added in v2.10)
64
64
  type: raw
65
65
  body_format:
66
66
  description:
67
67
  - The serialization format of the body. When set to V(json), V(form-multipart), or V(form-urlencoded), encodes
68
- the body argument, if needed, and automatically sets the Content-Type header accordingly.
68
+ the body argument, if needed, and automatically sets the C(Content-Type) header accordingly.
69
69
  - As of v2.3 it is possible to override the C(Content-Type) header, when
70
70
  set to V(json) or V(form-urlencoded) via the O(headers) option.
71
- - The 'Content-Type' header cannot be overridden when using V(form-multipart)
71
+ - The C(Content-Type) header cannot be overridden when using V(form-multipart).
72
72
  - V(form-urlencoded) was added in v2.7.
73
73
  - V(form-multipart) was added in v2.10.
74
74
  type: str
@@ -86,7 +86,7 @@ options:
86
86
  description:
87
87
  - Whether or not to return the body of the response as a "content" key in
88
88
  the dictionary result no matter it succeeded or failed.
89
- - Independently of this option, if the reported Content-type is "application/json", then the JSON is
89
+ - Independently of this option, if the reported C(Content-Type) is C(application/json), then the JSON is
90
90
  always loaded into a key called RV(ignore:json) in the dictionary results.
91
91
  type: bool
92
92
  default: no
@@ -108,15 +108,15 @@ options:
108
108
  follow_redirects:
109
109
  description:
110
110
  - Whether or not the URI module should follow redirects.
111
+ type: str
112
+ default: safe
111
113
  choices:
112
114
  all: Will follow all redirects.
113
115
  none: Will not follow any redirects.
114
116
  safe: Only redirects doing GET or HEAD requests will be followed.
115
117
  urllib2: Defer to urllib2 behavior (As of writing this follows HTTP redirects).
116
- 'no': (DEPRECATED, will be removed in the future version) alias of V(none).
117
- 'yes': (DEPRECATED, will be removed in the future version) alias of V(all).
118
- type: str
119
- default: safe
118
+ 'no': (DEPRECATED, removed in 2.22) alias of V(none).
119
+ 'yes': (DEPRECATED, removed in 2.22) alias of V(all).
120
120
  creates:
121
121
  description:
122
122
  - A filename, when it already exists, this step will not be run.
@@ -155,7 +155,7 @@ options:
155
155
  client_cert:
156
156
  description:
157
157
  - PEM formatted certificate chain file to be used for SSL client authentication.
158
- - This file can also include the key as well, and if the key is included, O(client_key) is not required
158
+ - This file can also include the key as well, and if the key is included, O(client_key) is not required.
159
159
  type: path
160
160
  version_added: '2.4'
161
161
  client_key:
@@ -166,7 +166,7 @@ options:
166
166
  version_added: '2.4'
167
167
  ca_path:
168
168
  description:
169
- - PEM formatted file that contains a CA certificate to be used for validation
169
+ - PEM formatted file that contains a CA certificate to be used for validation.
170
170
  type: path
171
171
  version_added: '2.11'
172
172
  src:
@@ -195,7 +195,7 @@ options:
195
195
  default: true
196
196
  unix_socket:
197
197
  description:
198
- - Path to Unix domain socket to use for connection
198
+ - Path to Unix domain socket to use for connection.
199
199
  type: path
200
200
  version_added: '2.8'
201
201
  http_agent:
@@ -225,9 +225,9 @@ options:
225
225
  version_added: '2.11'
226
226
  use_netrc:
227
227
  description:
228
- - Determining whether to use credentials from ``~/.netrc`` file
229
- - By default .netrc is used with Basic authentication headers
230
- - When set to False, .netrc credentials are ignored
228
+ - Determining whether to use credentials from C(~/.netrc) file.
229
+ - By default C(.netrc) is used with Basic authentication headers.
230
+ - When V(false), C(.netrc) credentials are ignored.
231
231
  type: bool
232
232
  default: true
233
233
  version_added: '2.14'
@@ -581,6 +581,12 @@ def uri(module, url, dest, body, body_format, method, headers, socket_timeout, c
581
581
  # if destination file already exist, only download if file newer
582
582
  kwargs['last_mod_time'] = utcfromtimestamp(os.path.getmtime(dest))
583
583
 
584
+ if module.params.get('follow_redirects') in ('no', 'yes'):
585
+ module.deprecate(
586
+ "Using 'yes' or 'no' for 'follow_redirects' parameter is deprecated.",
587
+ version='2.22'
588
+ )
589
+
584
590
  resp, info = fetch_url(module, url, data=data, headers=headers,
585
591
  method=method, timeout=socket_timeout, unix_socket=module.params['unix_socket'],
586
592
  ca_path=ca_path, unredirected_headers=unredirected_headers,