ansible-core 2.16.6__py3-none-any.whl → 2.17.0rc1__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 (596) hide show
  1. ansible/__init__.py +1 -3
  2. ansible/__main__.py +1 -0
  3. ansible/_vendor/__init__.py +1 -2
  4. ansible/cli/__init__.py +7 -8
  5. ansible/cli/adhoc.py +1 -2
  6. ansible/cli/arguments/__init__.py +1 -2
  7. ansible/cli/arguments/option_helpers.py +1 -2
  8. ansible/cli/config.py +1 -2
  9. ansible/cli/console.py +1 -2
  10. ansible/cli/doc.py +320 -198
  11. ansible/cli/galaxy.py +9 -3
  12. ansible/cli/inventory.py +4 -6
  13. ansible/cli/playbook.py +1 -2
  14. ansible/cli/pull.py +4 -5
  15. ansible/cli/scripts/ansible_connection_cli_stub.py +1 -4
  16. ansible/cli/vault.py +1 -2
  17. ansible/collections/list.py +1 -0
  18. ansible/compat/__init__.py +1 -4
  19. ansible/compat/importlib_resources.py +1 -2
  20. ansible/compat/{selectors/__init__.py → selectors.py} +12 -12
  21. ansible/config/ansible_builtin_runtime.yml +2 -0
  22. ansible/config/base.yml +154 -149
  23. ansible/config/manager.py +33 -25
  24. ansible/constants.py +1 -2
  25. ansible/context.py +1 -4
  26. ansible/errors/__init__.py +1 -3
  27. ansible/errors/yaml_strings.py +1 -3
  28. ansible/executor/__init__.py +1 -3
  29. ansible/executor/discovery/python_target.py +1 -2
  30. ansible/executor/interpreter_discovery.py +9 -8
  31. ansible/executor/module_common.py +1 -3
  32. ansible/executor/play_iterator.py +2 -4
  33. ansible/executor/playbook_executor.py +1 -3
  34. ansible/executor/powershell/module_manifest.py +2 -3
  35. ansible/executor/process/__init__.py +1 -3
  36. ansible/executor/process/worker.py +1 -3
  37. ansible/executor/stats.py +1 -3
  38. ansible/executor/task_executor.py +2 -3
  39. ansible/executor/task_queue_manager.py +1 -3
  40. ansible/executor/task_result.py +2 -3
  41. ansible/galaxy/__init__.py +1 -2
  42. ansible/galaxy/api.py +10 -2
  43. ansible/galaxy/collection/__init__.py +38 -24
  44. ansible/galaxy/collection/concrete_artifact_manager.py +1 -2
  45. ansible/galaxy/collection/galaxy_api_proxy.py +1 -2
  46. ansible/galaxy/collection/gpg.py +4 -2
  47. ansible/galaxy/data/apb/meta/main.yml.j2 +0 -15
  48. ansible/galaxy/data/container/meta/main.yml.j2 +0 -18
  49. ansible/galaxy/data/default/role/meta/main.yml.j2 +0 -18
  50. ansible/galaxy/data/network/cliconf_plugins/example.py.j2 +1 -2
  51. ansible/galaxy/data/network/library/example_command.py.j2 +1 -2
  52. ansible/galaxy/data/network/library/example_config.py.j2 +1 -2
  53. ansible/galaxy/data/network/library/example_facts.py.j2 +1 -2
  54. ansible/galaxy/data/network/meta/main.yml.j2 +0 -15
  55. ansible/galaxy/data/network/module_utils/example.py.j2 +1 -2
  56. ansible/galaxy/data/network/netconf_plugins/example.py.j2 +1 -2
  57. ansible/galaxy/data/network/terminal_plugins/example.py.j2 +1 -2
  58. ansible/galaxy/dependency_resolution/__init__.py +1 -2
  59. ansible/galaxy/dependency_resolution/dataclasses.py +5 -6
  60. ansible/galaxy/dependency_resolution/errors.py +1 -2
  61. ansible/galaxy/dependency_resolution/providers.py +3 -4
  62. ansible/galaxy/dependency_resolution/reporters.py +2 -3
  63. ansible/galaxy/dependency_resolution/resolvers.py +1 -2
  64. ansible/galaxy/dependency_resolution/versioning.py +1 -2
  65. ansible/galaxy/role.py +12 -15
  66. ansible/galaxy/token.py +1 -2
  67. ansible/galaxy/user_agent.py +1 -2
  68. ansible/inventory/data.py +1 -2
  69. ansible/inventory/group.py +1 -2
  70. ansible/inventory/helpers.py +1 -2
  71. ansible/inventory/host.py +1 -3
  72. ansible/inventory/manager.py +1 -2
  73. ansible/module_utils/_text.py +1 -2
  74. ansible/module_utils/ansible_release.py +3 -5
  75. ansible/module_utils/api.py +1 -2
  76. ansible/module_utils/basic.py +113 -158
  77. ansible/module_utils/common/_collections_compat.py +1 -2
  78. ansible/module_utils/common/_utils.py +1 -3
  79. ansible/module_utils/common/arg_spec.py +1 -2
  80. ansible/module_utils/common/collections.py +1 -2
  81. ansible/module_utils/common/dict_transformations.py +1 -2
  82. ansible/module_utils/common/file.py +10 -5
  83. ansible/module_utils/common/json.py +1 -3
  84. ansible/module_utils/common/locale.py +1 -2
  85. ansible/module_utils/common/network.py +2 -3
  86. ansible/module_utils/common/parameters.py +9 -9
  87. ansible/module_utils/common/process.py +12 -5
  88. ansible/module_utils/common/respawn.py +2 -3
  89. ansible/module_utils/common/sys_info.py +1 -2
  90. ansible/module_utils/common/text/converters.py +1 -2
  91. ansible/module_utils/common/text/formatters.py +1 -2
  92. ansible/module_utils/common/validation.py +5 -6
  93. ansible/module_utils/common/warnings.py +1 -2
  94. ansible/module_utils/common/yaml.py +1 -2
  95. ansible/module_utils/compat/datetime.py +1 -3
  96. ansible/module_utils/compat/importlib.py +21 -13
  97. ansible/module_utils/compat/paramiko.py +1 -2
  98. ansible/module_utils/compat/selectors.py +10 -34
  99. ansible/module_utils/compat/selinux.py +1 -2
  100. ansible/module_utils/compat/typing.py +1 -2
  101. ansible/module_utils/compat/version.py +1 -2
  102. ansible/module_utils/connection.py +1 -2
  103. ansible/module_utils/csharp/Ansible.Basic.cs +20 -3
  104. ansible/module_utils/distro/__init__.py +3 -4
  105. ansible/module_utils/distro/_distro.py +230 -234
  106. ansible/module_utils/errors.py +1 -2
  107. ansible/module_utils/facts/__init__.py +1 -2
  108. ansible/module_utils/facts/ansible_collector.py +1 -2
  109. ansible/module_utils/facts/collector.py +1 -2
  110. ansible/module_utils/facts/compat.py +1 -2
  111. ansible/module_utils/facts/default_collectors.py +1 -2
  112. ansible/module_utils/facts/hardware/aix.py +1 -2
  113. ansible/module_utils/facts/hardware/base.py +1 -2
  114. ansible/module_utils/facts/hardware/darwin.py +1 -2
  115. ansible/module_utils/facts/hardware/dragonfly.py +1 -2
  116. ansible/module_utils/facts/hardware/freebsd.py +1 -2
  117. ansible/module_utils/facts/hardware/hpux.py +1 -2
  118. ansible/module_utils/facts/hardware/hurd.py +1 -2
  119. ansible/module_utils/facts/hardware/linux.py +8 -6
  120. ansible/module_utils/facts/hardware/netbsd.py +1 -2
  121. ansible/module_utils/facts/hardware/openbsd.py +1 -2
  122. ansible/module_utils/facts/hardware/sunos.py +2 -3
  123. ansible/module_utils/facts/namespace.py +1 -2
  124. ansible/module_utils/facts/network/aix.py +1 -2
  125. ansible/module_utils/facts/network/base.py +1 -2
  126. ansible/module_utils/facts/network/darwin.py +1 -2
  127. ansible/module_utils/facts/network/dragonfly.py +1 -2
  128. ansible/module_utils/facts/network/fc_wwn.py +1 -2
  129. ansible/module_utils/facts/network/freebsd.py +1 -2
  130. ansible/module_utils/facts/network/generic_bsd.py +1 -2
  131. ansible/module_utils/facts/network/hpux.py +1 -2
  132. ansible/module_utils/facts/network/hurd.py +1 -2
  133. ansible/module_utils/facts/network/iscsi.py +1 -2
  134. ansible/module_utils/facts/network/linux.py +1 -2
  135. ansible/module_utils/facts/network/netbsd.py +1 -2
  136. ansible/module_utils/facts/network/nvme.py +1 -2
  137. ansible/module_utils/facts/network/openbsd.py +1 -2
  138. ansible/module_utils/facts/network/sunos.py +1 -2
  139. ansible/module_utils/facts/other/facter.py +1 -2
  140. ansible/module_utils/facts/other/ohai.py +1 -2
  141. ansible/module_utils/facts/packages.py +1 -2
  142. ansible/module_utils/facts/sysctl.py +1 -2
  143. ansible/module_utils/facts/system/apparmor.py +1 -2
  144. ansible/module_utils/facts/system/caps.py +1 -2
  145. ansible/module_utils/facts/system/chroot.py +1 -2
  146. ansible/module_utils/facts/system/cmdline.py +1 -2
  147. ansible/module_utils/facts/system/date_time.py +1 -2
  148. ansible/module_utils/facts/system/distribution.py +4 -5
  149. ansible/module_utils/facts/system/dns.py +1 -2
  150. ansible/module_utils/facts/system/env.py +1 -2
  151. ansible/module_utils/facts/system/fips.py +1 -2
  152. ansible/module_utils/facts/system/loadavg.py +1 -2
  153. ansible/module_utils/facts/system/local.py +1 -2
  154. ansible/module_utils/facts/system/lsb.py +1 -2
  155. ansible/module_utils/facts/system/pkg_mgr.py +7 -30
  156. ansible/module_utils/facts/system/platform.py +1 -2
  157. ansible/module_utils/facts/system/python.py +1 -2
  158. ansible/module_utils/facts/system/selinux.py +1 -2
  159. ansible/module_utils/facts/system/service_mgr.py +1 -2
  160. ansible/module_utils/facts/system/ssh_pub_keys.py +1 -2
  161. ansible/module_utils/facts/system/user.py +1 -2
  162. ansible/module_utils/facts/timeout.py +1 -2
  163. ansible/module_utils/facts/utils.py +1 -2
  164. ansible/module_utils/facts/virtual/base.py +1 -2
  165. ansible/module_utils/facts/virtual/dragonfly.py +1 -2
  166. ansible/module_utils/facts/virtual/freebsd.py +1 -2
  167. ansible/module_utils/facts/virtual/hpux.py +1 -2
  168. ansible/module_utils/facts/virtual/linux.py +1 -2
  169. ansible/module_utils/facts/virtual/netbsd.py +1 -2
  170. ansible/module_utils/facts/virtual/openbsd.py +1 -2
  171. ansible/module_utils/facts/virtual/sunos.py +1 -2
  172. ansible/module_utils/facts/virtual/sysctl.py +1 -2
  173. ansible/module_utils/json_utils.py +1 -2
  174. ansible/module_utils/parsing/convert_bool.py +1 -2
  175. ansible/module_utils/powershell/Ansible.ModuleUtils.Legacy.psm1 +5 -2
  176. ansible/module_utils/powershell/Ansible.ModuleUtils.WebRequest.psm1 +1 -1
  177. ansible/module_utils/pycompat24.py +24 -4
  178. ansible/module_utils/service.py +31 -5
  179. ansible/module_utils/six/__init__.py +1 -1
  180. ansible/module_utils/splitter.py +1 -2
  181. ansible/module_utils/urls.py +335 -1052
  182. ansible/module_utils/yumdnf.py +13 -35
  183. ansible/modules/add_host.py +1 -2
  184. ansible/modules/apt.py +38 -22
  185. ansible/modules/apt_key.py +1 -2
  186. ansible/modules/apt_repository.py +18 -10
  187. ansible/modules/assemble.py +1 -2
  188. ansible/modules/assert.py +8 -4
  189. ansible/modules/async_status.py +17 -14
  190. ansible/modules/async_wrapper.py +11 -9
  191. ansible/modules/blockinfile.py +2 -3
  192. ansible/modules/command.py +1 -2
  193. ansible/modules/copy.py +4 -76
  194. ansible/modules/cron.py +3 -3
  195. ansible/modules/deb822_repository.py +5 -5
  196. ansible/modules/debconf.py +19 -8
  197. ansible/modules/debug.py +1 -2
  198. ansible/modules/dnf.py +59 -186
  199. ansible/modules/dnf5.py +57 -43
  200. ansible/modules/dpkg_selections.py +1 -2
  201. ansible/modules/expect.py +23 -15
  202. ansible/modules/fail.py +1 -2
  203. ansible/modules/fetch.py +1 -2
  204. ansible/modules/file.py +4 -3
  205. ansible/modules/find.py +18 -5
  206. ansible/modules/gather_facts.py +1 -2
  207. ansible/modules/get_url.py +2 -3
  208. ansible/modules/getent.py +2 -3
  209. ansible/modules/git.py +28 -17
  210. ansible/modules/group.py +1 -2
  211. ansible/modules/group_by.py +1 -2
  212. ansible/modules/hostname.py +2 -19
  213. ansible/modules/import_playbook.py +1 -2
  214. ansible/modules/import_role.py +9 -2
  215. ansible/modules/import_tasks.py +1 -2
  216. ansible/modules/include_role.py +1 -2
  217. ansible/modules/include_tasks.py +1 -2
  218. ansible/modules/include_vars.py +1 -2
  219. ansible/modules/iptables.py +38 -21
  220. ansible/modules/known_hosts.py +15 -8
  221. ansible/modules/lineinfile.py +1 -6
  222. ansible/modules/meta.py +3 -2
  223. ansible/modules/package.py +6 -5
  224. ansible/modules/package_facts.py +1 -2
  225. ansible/modules/pause.py +2 -3
  226. ansible/modules/ping.py +1 -2
  227. ansible/modules/pip.py +40 -20
  228. ansible/modules/raw.py +1 -2
  229. ansible/modules/reboot.py +1 -2
  230. ansible/modules/replace.py +7 -5
  231. ansible/modules/rpm_key.py +1 -2
  232. ansible/modules/script.py +1 -2
  233. ansible/modules/service.py +3 -21
  234. ansible/modules/service_facts.py +3 -12
  235. ansible/modules/set_fact.py +1 -2
  236. ansible/modules/set_stats.py +1 -2
  237. ansible/modules/setup.py +1 -2
  238. ansible/modules/shell.py +1 -2
  239. ansible/modules/slurp.py +1 -2
  240. ansible/modules/stat.py +1 -2
  241. ansible/modules/subversion.py +2 -3
  242. ansible/modules/systemd.py +12 -9
  243. ansible/modules/systemd_service.py +12 -9
  244. ansible/modules/sysvinit.py +7 -2
  245. ansible/modules/tempfile.py +7 -2
  246. ansible/modules/template.py +2 -3
  247. ansible/modules/unarchive.py +13 -3
  248. ansible/modules/uri.py +5 -8
  249. ansible/modules/user.py +11 -10
  250. ansible/modules/validate_argument_spec.py +15 -16
  251. ansible/modules/wait_for.py +1 -2
  252. ansible/modules/wait_for_connection.py +1 -2
  253. ansible/modules/yum_repository.py +2 -3
  254. ansible/parsing/__init__.py +1 -3
  255. ansible/parsing/ajson.py +1 -3
  256. ansible/parsing/dataloader.py +23 -12
  257. ansible/parsing/mod_args.py +14 -8
  258. ansible/parsing/plugin_docs.py +1 -2
  259. ansible/parsing/quoting.py +1 -3
  260. ansible/parsing/splitter.py +1 -3
  261. ansible/parsing/utils/__init__.py +1 -3
  262. ansible/parsing/utils/addresses.py +1 -3
  263. ansible/parsing/utils/jsonify.py +1 -3
  264. ansible/parsing/utils/yaml.py +1 -3
  265. ansible/parsing/vault/__init__.py +6 -8
  266. ansible/parsing/yaml/__init__.py +1 -3
  267. ansible/parsing/yaml/constructor.py +1 -3
  268. ansible/parsing/yaml/dumper.py +1 -3
  269. ansible/parsing/yaml/loader.py +1 -3
  270. ansible/parsing/yaml/objects.py +1 -3
  271. ansible/playbook/__init__.py +1 -3
  272. ansible/playbook/attribute.py +1 -3
  273. ansible/playbook/base.py +2 -3
  274. ansible/playbook/block.py +1 -3
  275. ansible/playbook/collectionsearch.py +1 -2
  276. ansible/playbook/conditional.py +1 -3
  277. ansible/playbook/delegatable.py +1 -0
  278. ansible/playbook/handler.py +2 -4
  279. ansible/playbook/handler_task_include.py +1 -3
  280. ansible/playbook/helpers.py +1 -4
  281. ansible/playbook/included_file.py +4 -4
  282. ansible/playbook/loop_control.py +1 -3
  283. ansible/playbook/notifiable.py +1 -0
  284. ansible/playbook/play.py +1 -3
  285. ansible/playbook/play_context.py +1 -3
  286. ansible/playbook/playbook_include.py +1 -3
  287. ansible/playbook/role/__init__.py +1 -3
  288. ansible/playbook/role/definition.py +1 -3
  289. ansible/playbook/role/include.py +1 -3
  290. ansible/playbook/role/metadata.py +1 -3
  291. ansible/playbook/role/requirement.py +1 -3
  292. ansible/playbook/role_include.py +2 -10
  293. ansible/playbook/taggable.py +1 -3
  294. ansible/playbook/task.py +2 -4
  295. ansible/playbook/task_include.py +1 -3
  296. ansible/plugins/__init__.py +4 -5
  297. ansible/plugins/action/__init__.py +20 -14
  298. ansible/plugins/action/add_host.py +2 -4
  299. ansible/plugins/action/assemble.py +2 -3
  300. ansible/plugins/action/assert.py +1 -2
  301. ansible/plugins/action/async_status.py +1 -2
  302. ansible/plugins/action/command.py +1 -2
  303. ansible/plugins/action/copy.py +12 -9
  304. ansible/plugins/action/debug.py +1 -2
  305. ansible/plugins/action/dnf.py +4 -4
  306. ansible/plugins/action/fail.py +1 -2
  307. ansible/plugins/action/fetch.py +2 -3
  308. ansible/plugins/action/gather_facts.py +3 -4
  309. ansible/plugins/action/group_by.py +1 -2
  310. ansible/plugins/action/include_vars.py +1 -2
  311. ansible/plugins/action/normal.py +1 -2
  312. ansible/plugins/action/package.py +36 -21
  313. ansible/plugins/action/pause.py +1 -2
  314. ansible/plugins/action/raw.py +2 -3
  315. ansible/plugins/action/reboot.py +30 -15
  316. ansible/plugins/action/script.py +3 -4
  317. ansible/plugins/action/service.py +1 -2
  318. ansible/plugins/action/set_fact.py +1 -2
  319. ansible/plugins/action/set_stats.py +1 -2
  320. ansible/plugins/action/shell.py +1 -2
  321. ansible/plugins/action/template.py +1 -2
  322. ansible/plugins/action/unarchive.py +1 -2
  323. ansible/plugins/action/uri.py +2 -3
  324. ansible/plugins/action/validate_argument_spec.py +1 -2
  325. ansible/plugins/action/wait_for_connection.py +2 -3
  326. ansible/plugins/become/__init__.py +1 -2
  327. ansible/plugins/become/runas.py +1 -2
  328. ansible/plugins/become/su.py +1 -2
  329. ansible/plugins/become/sudo.py +1 -2
  330. ansible/plugins/cache/__init__.py +3 -3
  331. ansible/plugins/cache/base.py +1 -2
  332. ansible/plugins/cache/jsonfile.py +1 -3
  333. ansible/plugins/cache/memory.py +1 -2
  334. ansible/plugins/callback/__init__.py +2 -4
  335. ansible/plugins/callback/default.py +2 -3
  336. ansible/plugins/callback/junit.py +1 -2
  337. ansible/plugins/callback/minimal.py +1 -3
  338. ansible/plugins/callback/oneline.py +1 -3
  339. ansible/plugins/callback/tree.py +1 -2
  340. ansible/plugins/cliconf/__init__.py +1 -2
  341. ansible/plugins/connection/__init__.py +4 -5
  342. ansible/plugins/connection/local.py +3 -4
  343. ansible/plugins/connection/paramiko_ssh.py +1 -2
  344. ansible/plugins/connection/psrp.py +1 -2
  345. ansible/plugins/connection/ssh.py +18 -54
  346. ansible/plugins/connection/winrm.py +3 -4
  347. ansible/plugins/doc_fragments/action_common_attributes.py +2 -3
  348. ansible/plugins/doc_fragments/action_core.py +3 -4
  349. ansible/plugins/doc_fragments/backup.py +1 -2
  350. ansible/plugins/doc_fragments/connection_pipelining.py +1 -2
  351. ansible/plugins/doc_fragments/constructed.py +1 -2
  352. ansible/plugins/doc_fragments/decrypt.py +2 -3
  353. ansible/plugins/doc_fragments/default_callback.py +1 -2
  354. ansible/plugins/doc_fragments/files.py +1 -2
  355. ansible/plugins/doc_fragments/inventory_cache.py +1 -2
  356. ansible/plugins/doc_fragments/result_format_callback.py +1 -2
  357. ansible/plugins/doc_fragments/return_common.py +1 -2
  358. ansible/plugins/doc_fragments/shell_common.py +1 -2
  359. ansible/plugins/doc_fragments/shell_windows.py +1 -2
  360. ansible/plugins/doc_fragments/template_common.py +1 -2
  361. ansible/plugins/doc_fragments/url.py +1 -2
  362. ansible/plugins/doc_fragments/url_windows.py +1 -2
  363. ansible/plugins/doc_fragments/validate.py +1 -2
  364. ansible/plugins/doc_fragments/vars_plugin_staging.py +1 -2
  365. ansible/plugins/filter/__init__.py +1 -2
  366. ansible/plugins/filter/b64decode.yml +8 -8
  367. ansible/plugins/filter/b64encode.yml +4 -4
  368. ansible/plugins/filter/comment.yml +1 -1
  369. ansible/plugins/filter/core.py +11 -9
  370. ansible/plugins/filter/encryption.py +1 -3
  371. ansible/plugins/filter/extract.yml +1 -1
  372. ansible/plugins/filter/from_yaml_all.yml +1 -1
  373. ansible/plugins/filter/human_readable.yml +3 -3
  374. ansible/plugins/filter/human_to_bytes.yml +2 -2
  375. ansible/plugins/filter/mandatory.yml +1 -1
  376. ansible/plugins/filter/mathstuff.py +2 -2
  377. ansible/plugins/filter/password_hash.yml +3 -2
  378. ansible/plugins/filter/regex_replace.yml +15 -0
  379. ansible/plugins/filter/regex_search.yml +12 -0
  380. ansible/plugins/filter/strftime.yml +2 -9
  381. ansible/plugins/filter/to_datetime.yml +17 -2
  382. ansible/plugins/filter/to_nice_json.yml +4 -0
  383. ansible/plugins/filter/union.yml +1 -1
  384. ansible/plugins/filter/urls.py +1 -2
  385. ansible/plugins/filter/urlsplit.py +1 -2
  386. ansible/plugins/filter/zip.yml +2 -2
  387. ansible/plugins/filter/zip_longest.yml +1 -1
  388. ansible/plugins/httpapi/__init__.py +1 -2
  389. ansible/plugins/inventory/__init__.py +2 -4
  390. ansible/plugins/inventory/advanced_host_list.py +1 -2
  391. ansible/plugins/inventory/auto.py +2 -3
  392. ansible/plugins/inventory/constructed.py +3 -2
  393. ansible/plugins/inventory/generator.py +1 -2
  394. ansible/plugins/inventory/host_list.py +1 -2
  395. ansible/plugins/inventory/ini.py +1 -2
  396. ansible/plugins/inventory/script.py +122 -3
  397. ansible/plugins/inventory/toml.py +1 -2
  398. ansible/plugins/inventory/yaml.py +3 -4
  399. ansible/plugins/list.py +2 -3
  400. ansible/plugins/loader.py +10 -11
  401. ansible/plugins/lookup/__init__.py +1 -3
  402. ansible/plugins/lookup/config.py +19 -15
  403. ansible/plugins/lookup/csvfile.py +16 -7
  404. ansible/plugins/lookup/dict.py +2 -3
  405. ansible/plugins/lookup/env.py +4 -4
  406. ansible/plugins/lookup/file.py +1 -2
  407. ansible/plugins/lookup/fileglob.py +1 -2
  408. ansible/plugins/lookup/first_found.py +8 -7
  409. ansible/plugins/lookup/indexed_items.py +1 -2
  410. ansible/plugins/lookup/ini.py +6 -3
  411. ansible/plugins/lookup/inventory_hostnames.py +1 -2
  412. ansible/plugins/lookup/items.py +1 -2
  413. ansible/plugins/lookup/lines.py +1 -2
  414. ansible/plugins/lookup/list.py +1 -3
  415. ansible/plugins/lookup/nested.py +1 -2
  416. ansible/plugins/lookup/password.py +16 -14
  417. ansible/plugins/lookup/pipe.py +1 -2
  418. ansible/plugins/lookup/random_choice.py +1 -2
  419. ansible/plugins/lookup/sequence.py +21 -52
  420. ansible/plugins/lookup/subelements.py +1 -2
  421. ansible/plugins/lookup/template.py +1 -2
  422. ansible/plugins/lookup/together.py +1 -2
  423. ansible/plugins/lookup/unvault.py +1 -2
  424. ansible/plugins/lookup/url.py +9 -3
  425. ansible/plugins/lookup/varnames.py +1 -2
  426. ansible/plugins/lookup/vars.py +1 -2
  427. ansible/plugins/netconf/__init__.py +1 -2
  428. ansible/plugins/shell/__init__.py +3 -4
  429. ansible/plugins/shell/cmd.py +1 -2
  430. ansible/plugins/shell/powershell.py +1 -2
  431. ansible/plugins/shell/sh.py +1 -2
  432. ansible/plugins/strategy/__init__.py +33 -21
  433. ansible/plugins/strategy/debug.py +1 -2
  434. ansible/plugins/strategy/free.py +17 -7
  435. ansible/plugins/strategy/host_pinned.py +1 -3
  436. ansible/plugins/strategy/linear.py +22 -22
  437. ansible/plugins/terminal/__init__.py +2 -3
  438. ansible/plugins/test/__init__.py +1 -2
  439. ansible/plugins/test/change.yml +1 -1
  440. ansible/plugins/test/changed.yml +1 -1
  441. ansible/plugins/test/contains.yml +1 -1
  442. ansible/plugins/test/core.py +2 -4
  443. ansible/plugins/test/exists.yml +1 -1
  444. ansible/plugins/test/failed.yml +1 -1
  445. ansible/plugins/test/failure.yml +1 -1
  446. ansible/plugins/test/files.py +1 -3
  447. ansible/plugins/test/finished.yml +3 -3
  448. ansible/plugins/test/issuperset.yml +1 -1
  449. ansible/plugins/test/match.yml +1 -1
  450. ansible/plugins/test/mathstuff.py +1 -2
  451. ansible/plugins/test/reachable.yml +1 -1
  452. ansible/plugins/test/regex.yml +1 -1
  453. ansible/plugins/test/search.yml +1 -1
  454. ansible/plugins/test/skip.yml +1 -1
  455. ansible/plugins/test/skipped.yml +1 -1
  456. ansible/plugins/test/started.yml +1 -1
  457. ansible/plugins/test/succeeded.yml +1 -1
  458. ansible/plugins/test/success.yml +1 -1
  459. ansible/plugins/test/successful.yml +1 -1
  460. ansible/plugins/test/superset.yml +1 -1
  461. ansible/plugins/test/unreachable.yml +1 -1
  462. ansible/plugins/test/uri.py +1 -3
  463. ansible/plugins/vars/__init__.py +1 -2
  464. ansible/plugins/vars/host_group_vars.py +2 -3
  465. ansible/release.py +3 -5
  466. ansible/template/__init__.py +24 -37
  467. ansible/template/native_helpers.py +1 -3
  468. ansible/template/template.py +1 -3
  469. ansible/template/vars.py +1 -0
  470. ansible/utils/__init__.py +1 -3
  471. ansible/utils/cmd_functions.py +1 -2
  472. ansible/utils/collection_loader/__init__.py +1 -2
  473. ansible/utils/collection_loader/_collection_config.py +1 -2
  474. ansible/utils/collection_loader/_collection_finder.py +1 -2
  475. ansible/utils/collection_loader/_collection_meta.py +1 -2
  476. ansible/utils/color.py +1 -2
  477. ansible/utils/context_objects.py +1 -4
  478. ansible/utils/display.py +88 -30
  479. ansible/utils/encrypt.py +4 -105
  480. ansible/utils/fqcn.py +1 -2
  481. ansible/utils/galaxy.py +1 -3
  482. ansible/utils/hashing.py +1 -3
  483. ansible/utils/helpers.py +1 -3
  484. ansible/utils/jsonrpc.py +1 -2
  485. ansible/utils/listify.py +1 -3
  486. ansible/utils/lock.py +1 -3
  487. ansible/utils/multiprocessing.py +1 -3
  488. ansible/utils/native_jinja.py +1 -3
  489. ansible/utils/path.py +1 -2
  490. ansible/utils/plugin_docs.py +7 -6
  491. ansible/utils/py3compat.py +17 -55
  492. ansible/utils/sentinel.py +1 -3
  493. ansible/utils/shlex.py +1 -3
  494. ansible/utils/singleton.py +1 -3
  495. ansible/utils/ssh_functions.py +1 -3
  496. ansible/utils/unicode.py +1 -3
  497. ansible/utils/unsafe_proxy.py +1 -2
  498. ansible/utils/vars.py +6 -8
  499. ansible/utils/version.py +1 -3
  500. ansible/vars/clean.py +1 -3
  501. ansible/vars/fact_cache.py +1 -2
  502. ansible/vars/hostvars.py +3 -7
  503. ansible/vars/manager.py +24 -6
  504. ansible/vars/reserved.py +1 -3
  505. {ansible_core-2.16.6.data → ansible_core-2.17.0rc1.data}/scripts/ansible-test +1 -2
  506. {ansible_core-2.16.6.dist-info → ansible_core-2.17.0rc1.dist-info}/METADATA +3 -3
  507. ansible_core-2.17.0rc1.dist-info/RECORD +987 -0
  508. ansible_test/__init__.py +1 -2
  509. ansible_test/_data/completion/docker.txt +7 -9
  510. ansible_test/_data/completion/remote.txt +6 -7
  511. ansible_test/_data/requirements/ansible-test.txt +0 -2
  512. ansible_test/_data/requirements/constraints.txt +1 -6
  513. ansible_test/_data/requirements/sanity.ansible-doc.txt +3 -3
  514. ansible_test/_data/requirements/sanity.changelog.txt +3 -3
  515. ansible_test/_data/requirements/sanity.import.plugin.txt +2 -2
  516. ansible_test/_data/requirements/sanity.mypy.txt +12 -12
  517. ansible_test/_data/requirements/sanity.pep8.txt +1 -1
  518. ansible_test/_data/requirements/sanity.pylint.txt +7 -7
  519. ansible_test/_data/requirements/sanity.runtime-metadata.txt +1 -1
  520. ansible_test/_data/requirements/sanity.validate-modules.txt +3 -3
  521. ansible_test/_data/requirements/sanity.yamllint.txt +2 -2
  522. ansible_test/_internal/bootstrap.py +2 -2
  523. ansible_test/_internal/classification/__init__.py +0 -5
  524. ansible_test/_internal/commands/integration/cloud/cs.py +1 -1
  525. ansible_test/_internal/commands/integration/cloud/nios.py +1 -1
  526. ansible_test/_internal/commands/sanity/__init__.py +1 -27
  527. ansible_test/_internal/commands/sanity/import.py +0 -18
  528. ansible_test/_internal/commands/sanity/mypy.py +7 -10
  529. ansible_test/_internal/commands/units/__init__.py +1 -1
  530. ansible_test/_internal/config.py +0 -1
  531. ansible_test/_internal/content_config.py +0 -5
  532. ansible_test/_internal/coverage_util.py +0 -1
  533. ansible_test/_internal/docker_util.py +1 -1
  534. ansible_test/_internal/host_profiles.py +5 -4
  535. ansible_test/_internal/python_requirements.py +1 -119
  536. ansible_test/_internal/ssh.py +1 -0
  537. ansible_test/_internal/util.py +1 -1
  538. ansible_test/_internal/util_common.py +1 -1
  539. ansible_test/_internal/venv.py +10 -108
  540. ansible_test/_util/__init__.py +1 -2
  541. ansible_test/_util/controller/sanity/mypy/ansible-core.ini +0 -6
  542. ansible_test/_util/controller/sanity/mypy/modules.ini +0 -6
  543. ansible_test/_util/controller/sanity/pylint/config/ansible-test-target.cfg +0 -1
  544. ansible_test/_util/controller/sanity/pylint/config/ansible-test.cfg +0 -1
  545. ansible_test/_util/controller/sanity/pylint/config/code-smell.cfg +0 -1
  546. ansible_test/_util/controller/sanity/pylint/config/collection.cfg +0 -1
  547. ansible_test/_util/controller/sanity/pylint/config/default.cfg +0 -1
  548. ansible_test/_util/controller/sanity/pylint/plugins/deprecated.py +1 -2
  549. ansible_test/_util/controller/sanity/shellcheck/exclude.txt +0 -1
  550. ansible_test/_util/controller/sanity/validate-modules/validate_modules/main.py +31 -59
  551. ansible_test/_util/controller/sanity/validate-modules/validate_modules/module_args.py +0 -7
  552. ansible_test/_util/controller/sanity/validate-modules/validate_modules/schema.py +10 -2
  553. ansible_test/_util/controller/sanity/validate-modules/validate_modules/utils.py +1 -1
  554. ansible_test/_util/controller/sanity/yamllint/yamllinter.py +16 -4
  555. ansible_test/_util/target/__init__.py +1 -2
  556. ansible_test/_util/target/cli/ansible_test_cli_stub.py +1 -2
  557. ansible_test/_util/target/common/constants.py +1 -4
  558. ansible_test/_util/target/injector/python.py +4 -19
  559. ansible_test/_util/target/pytest/plugins/ansible_forked.py +2 -9
  560. ansible_test/_util/target/pytest/plugins/ansible_pytest_collections.py +1 -5
  561. ansible_test/_util/target/pytest/plugins/ansible_pytest_coverage.py +1 -2
  562. ansible_test/_util/target/sanity/compile/compile.py +3 -12
  563. ansible_test/_util/target/sanity/import/importer.py +1 -12
  564. ansible_test/_util/target/setup/bootstrap.sh +49 -105
  565. ansible_test/_util/target/setup/probe_cgroups.py +1 -2
  566. ansible_test/_util/target/setup/quiet_pip.py +1 -16
  567. ansible_test/_util/target/setup/requirements.py +9 -2
  568. ansible_test/_util/target/tools/virtualenvcheck.py +1 -2
  569. ansible_test/_util/target/tools/yamlcheck.py +1 -2
  570. ansible/module_utils/common/_json_compat.py +0 -16
  571. ansible/module_utils/compat/_selectors2.py +0 -655
  572. ansible/modules/yum.py +0 -1821
  573. ansible/plugins/action/yum.py +0 -111
  574. ansible_core-2.16.6.dist-info/RECORD +0 -1009
  575. ansible_test/_util/controller/sanity/code-smell/future-import-boilerplate.json +0 -7
  576. ansible_test/_util/controller/sanity/code-smell/future-import-boilerplate.py +0 -46
  577. ansible_test/_util/controller/sanity/code-smell/metaclass-boilerplate.json +0 -7
  578. ansible_test/_util/controller/sanity/code-smell/metaclass-boilerplate.py +0 -44
  579. ansible_test/_util/controller/sanity/code-smell/no-basestring.json +0 -7
  580. ansible_test/_util/controller/sanity/code-smell/no-basestring.py +0 -21
  581. ansible_test/_util/controller/sanity/code-smell/no-dict-iteritems.json +0 -7
  582. ansible_test/_util/controller/sanity/code-smell/no-dict-iteritems.py +0 -21
  583. ansible_test/_util/controller/sanity/code-smell/no-dict-iterkeys.json +0 -7
  584. ansible_test/_util/controller/sanity/code-smell/no-dict-iterkeys.py +0 -21
  585. ansible_test/_util/controller/sanity/code-smell/no-dict-itervalues.json +0 -7
  586. ansible_test/_util/controller/sanity/code-smell/no-dict-itervalues.py +0 -21
  587. ansible_test/_util/controller/sanity/code-smell/no-main-display.json +0 -10
  588. ansible_test/_util/controller/sanity/code-smell/no-main-display.py +0 -21
  589. ansible_test/_util/controller/sanity/code-smell/no-unicode-literals.json +0 -7
  590. ansible_test/_util/controller/sanity/code-smell/no-unicode-literals.py +0 -21
  591. ansible_test/_util/controller/tools/sslcheck.py +0 -22
  592. ansible_test/_util/target/common/__init__.py +0 -2
  593. {ansible_core-2.16.6.dist-info → ansible_core-2.17.0rc1.dist-info}/COPYING +0 -0
  594. {ansible_core-2.16.6.dist-info → ansible_core-2.17.0rc1.dist-info}/WHEEL +0 -0
  595. {ansible_core-2.16.6.dist-info → ansible_core-2.17.0rc1.dist-info}/entry_points.txt +0 -0
  596. {ansible_core-2.16.6.dist-info → ansible_core-2.17.0rc1.dist-info}/top_level.txt +0 -0
@@ -4,8 +4,7 @@
4
4
  # Copyright: (c) 2017, Sébastien DA ROCHA <sebastien@da-rocha.net>
5
5
  # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
6
6
 
7
- from __future__ import absolute_import, division, print_function
8
- __metaclass__ = type
7
+ from __future__ import annotations
9
8
 
10
9
 
11
10
  DOCUMENTATION = r'''
@@ -38,7 +37,7 @@ notes:
38
37
  options:
39
38
  table:
40
39
  description:
41
- - This option specifies the packet matching table which the command should operate on.
40
+ - This option specifies the packet matching table on which the command should operate.
42
41
  - If the kernel is configured with automatic module loading, an attempt will be made
43
42
  to load the appropriate module for that table if it is not already there.
44
43
  type: str
@@ -134,9 +133,9 @@ options:
134
133
  description:
135
134
  - Specifies a match to use, that is, an extension module that tests for
136
135
  a specific property.
137
- - The set of matches make up the condition under which a target is invoked.
136
+ - The set of matches makes up the condition under which a target is invoked.
138
137
  - Matches are evaluated first to last if specified as an array and work in short-circuit
139
- fashion, i.e. if one extension yields false, evaluation will stop.
138
+ fashion, i.e. if one extension yields false, the evaluation will stop.
140
139
  type: list
141
140
  elements: str
142
141
  default: []
@@ -144,7 +143,7 @@ options:
144
143
  description:
145
144
  - This specifies the target of the rule; i.e., what to do if the packet matches it.
146
145
  - The target can be a user-defined chain (other than the one
147
- this rule is in), one of the special builtin targets which decide the
146
+ this rule is in), one of the special builtin targets that decide the
148
147
  fate of the packet immediately, or an extension (see EXTENSIONS
149
148
  below).
150
149
  - If this option is omitted in a rule (and the goto parameter
@@ -153,13 +152,13 @@ options:
153
152
  type: str
154
153
  gateway:
155
154
  description:
156
- - This specifies the IP address of host to send the cloned packets.
155
+ - This specifies the IP address of the host to send the cloned packets.
157
156
  - This option is only valid when O(jump) is set to V(TEE).
158
157
  type: str
159
158
  version_added: "2.8"
160
159
  log_prefix:
161
160
  description:
162
- - Specifies a log text for the rule. Only make sense with a LOG jump.
161
+ - Specifies a log text for the rule. Only makes sense with a LOG jump.
163
162
  type: str
164
163
  version_added: "2.5"
165
164
  log_level:
@@ -172,7 +171,7 @@ options:
172
171
  choices: [ '0', '1', '2', '3', '4', '5', '6', '7', 'emerg', 'alert', 'crit', 'error', 'warning', 'notice', 'info', 'debug' ]
173
172
  goto:
174
173
  description:
175
- - This specifies that the processing should continue in a user specified chain.
174
+ - This specifies that the processing should continue in a user-specified chain.
176
175
  - Unlike the jump argument return will not continue processing in
177
176
  this chain but instead in the chain that called us via jump.
178
177
  type: str
@@ -200,7 +199,7 @@ options:
200
199
  of fragmented packets.
201
200
  - Since there is no way to tell the source or destination ports of such
202
201
  a packet (or ICMP type), such a packet will not match any rules which specify them.
203
- - When the "!" argument precedes fragment argument, the rule will only match head fragments,
202
+ - When the "!" argument precedes the fragment argument, the rule will only match head fragments,
204
203
  or unfragmented packets.
205
204
  type: str
206
205
  set_counters:
@@ -266,6 +265,7 @@ options:
266
265
  description:
267
266
  - This allows specifying a DSCP mark to be added to packets.
268
267
  It takes either an integer or hex value.
268
+ - If the parameter is set, O(jump) is set to V(DSCP).
269
269
  - Mutually exclusive with O(set_dscp_mark_class).
270
270
  type: str
271
271
  version_added: "2.1"
@@ -273,6 +273,7 @@ options:
273
273
  description:
274
274
  - This allows specifying a predefined DiffServ class which will be
275
275
  translated to the corresponding DSCP mark.
276
+ - If the parameter is set, O(jump) is set to V(DSCP).
276
277
  - Mutually exclusive with O(set_dscp_mark).
277
278
  type: str
278
279
  version_added: "2.1"
@@ -289,7 +290,7 @@ options:
289
290
  default: []
290
291
  src_range:
291
292
  description:
292
- - Specifies the source IP range to match in the iprange module.
293
+ - Specifies the source IP range to match the iprange module.
293
294
  type: str
294
295
  version_added: "2.8"
295
296
  dst_range:
@@ -299,8 +300,8 @@ options:
299
300
  version_added: "2.8"
300
301
  match_set:
301
302
  description:
302
- - Specifies a set name which can be defined by ipset.
303
- - Must be used together with the match_set_flags parameter.
303
+ - Specifies a set name that can be defined by ipset.
304
+ - Must be used together with the O(match_set_flags) parameter.
304
305
  - When the V(!) argument is prepended then it inverts the rule.
305
306
  - Uses the iptables set extension.
306
307
  type: str
@@ -308,10 +309,11 @@ options:
308
309
  match_set_flags:
309
310
  description:
310
311
  - Specifies the necessary flags for the match_set parameter.
311
- - Must be used together with the match_set parameter.
312
+ - Must be used together with the O(match_set) parameter.
312
313
  - Uses the iptables set extension.
314
+ - Choices V(dst,dst) and V(src,src) added in version 2.17.
313
315
  type: str
314
- choices: [ "src", "dst", "src,dst", "dst,src" ]
316
+ choices: [ "src", "dst", "src,dst", "dst,src", "dst,dst", "src,src" ]
315
317
  version_added: "2.11"
316
318
  limit:
317
319
  description:
@@ -327,14 +329,14 @@ options:
327
329
  version_added: "2.1"
328
330
  uid_owner:
329
331
  description:
330
- - Specifies the UID or username to use in match by owner rule.
332
+ - Specifies the UID or username to use in the match by owner rule.
331
333
  - From Ansible 2.6 when the C(!) argument is prepended then the it inverts
332
334
  the rule to apply instead to all users except that one specified.
333
335
  type: str
334
336
  version_added: "2.1"
335
337
  gid_owner:
336
338
  description:
337
- - Specifies the GID or group to use in match by owner rule.
339
+ - Specifies the GID or group to use in the match by owner rule.
338
340
  type: str
339
341
  version_added: "2.9"
340
342
  reject_with:
@@ -364,7 +366,7 @@ options:
364
366
  - Only built-in chains can have policies.
365
367
  - This parameter requires the O(chain) parameter.
366
368
  - If you specify this parameter, all other parameters will be ignored.
367
- - This parameter is used to set default policy for the given O(chain).
369
+ - This parameter is used to set the default policy for the given O(chain).
368
370
  Do not confuse this with O(jump) parameter.
369
371
  type: str
370
372
  choices: [ ACCEPT, DROP, QUEUE, RETURN ]
@@ -386,9 +388,9 @@ options:
386
388
  numeric:
387
389
  description:
388
390
  - This parameter controls the running of the list -action of iptables, which is used internally by the module
389
- - Does not affect the actual functionality. Use this if iptables hangs when creating chain or altering policy
391
+ - Does not affect the actual functionality. Use this if iptables hang when creating a chain or altering policy
390
392
  - If V(true), then iptables skips the DNS-lookup of the IP addresses in a chain when it uses the list -action
391
- - Listing is used internally for example when setting a policy or creting of a chain
393
+ - Listing is used internally for example when setting a policy or creating a chain
392
394
  type: bool
393
395
  default: false
394
396
  version_added: "2.15"
@@ -636,11 +638,16 @@ def construct_rule(params):
636
638
  append_param(rule, params['destination_port'], '--destination-port', False)
637
639
  append_param(rule, params['to_ports'], '--to-ports', False)
638
640
  append_param(rule, params['set_dscp_mark'], '--set-dscp', False)
641
+ if params.get('set_dscp_mark') and params.get('jump').lower() != 'dscp':
642
+ append_jump(rule, params['set_dscp_mark'], 'DSCP')
643
+
639
644
  append_param(
640
645
  rule,
641
646
  params['set_dscp_mark_class'],
642
647
  '--set-dscp-class',
643
648
  False)
649
+ if params.get('set_dscp_mark_class') and params.get('jump').lower() != 'dscp':
650
+ append_jump(rule, params['set_dscp_mark_class'], 'DSCP')
644
651
  append_match_flag(rule, params['syn'], '--syn', True)
645
652
  if 'conntrack' in params['match']:
646
653
  append_csv(rule, params['ctstate'], '--ctstate')
@@ -674,6 +681,9 @@ def construct_rule(params):
674
681
  append_param(rule, params['gid_owner'], '--gid-owner', False)
675
682
  if params['jump'] is None:
676
683
  append_jump(rule, params['reject_with'], 'REJECT')
684
+ append_jump(rule, params['set_dscp_mark_class'], 'DSCP')
685
+ append_jump(rule, params['set_dscp_mark'], 'DSCP')
686
+
677
687
  append_param(rule, params['reject_with'], '--reject-with', False)
678
688
  append_param(
679
689
  rule,
@@ -811,7 +821,10 @@ def main():
811
821
  src_range=dict(type='str'),
812
822
  dst_range=dict(type='str'),
813
823
  match_set=dict(type='str'),
814
- match_set_flags=dict(type='str', choices=['src', 'dst', 'src,dst', 'dst,src']),
824
+ match_set_flags=dict(
825
+ type='str',
826
+ choices=['src', 'dst', 'src,dst', 'dst,src', 'src,src', 'dst,dst']
827
+ ),
815
828
  limit=dict(type='str'),
816
829
  limit_burst=dict(type='str'),
817
830
  uid_owner=dict(type='str'),
@@ -828,6 +841,10 @@ def main():
828
841
  ['set_dscp_mark', 'set_dscp_mark_class'],
829
842
  ['flush', 'policy'],
830
843
  ),
844
+ required_by=dict(
845
+ set_dscp_mark=('jump',),
846
+ set_dscp_mark_class=('jump',),
847
+ ),
831
848
  required_if=[
832
849
  ['jump', 'TEE', ['gateway']],
833
850
  ['jump', 'tee', ['gateway']],
@@ -2,8 +2,7 @@
2
2
  # Copyright: (c) 2014, Matthew Vernon <mcv21@cam.ac.uk>
3
3
  # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
4
4
 
5
- from __future__ import absolute_import, division, print_function
6
- __metaclass__ = type
5
+ from __future__ import annotations
7
6
 
8
7
 
9
8
  DOCUMENTATION = r'''
@@ -274,12 +273,20 @@ def search_for_host_key(module, host, key, path, sshkeygen):
274
273
  module.fail_json(msg="failed to parse output of ssh-keygen for line number: '%s'" % l)
275
274
  else:
276
275
  found_key = normalize_known_hosts_key(l)
277
- if new_key['host'][:3] == '|1|' and found_key['host'][:3] == '|1|': # do not change host hash if already hashed
278
- new_key['host'] = found_key['host']
279
- if new_key == found_key: # found a match
280
- return True, False, found_line # found exactly the same key, don't replace
281
- elif new_key['type'] == found_key['type']: # found a different key for the same key type
282
- return True, True, found_line
276
+
277
+ if 'options' in found_key and found_key['options'][:15] == '@cert-authority':
278
+ if new_key == found_key: # found a match
279
+ return True, False, found_line # found exactly the same key, don't replace
280
+ elif 'options' in found_key and found_key['options'][:7] == '@revoke':
281
+ if new_key == found_key: # found a match
282
+ return True, False, found_line # found exactly the same key, don't replace
283
+ else:
284
+ if new_key['host'][:3] == '|1|' and found_key['host'][:3] == '|1|': # do not change host hash if already hashed
285
+ new_key['host'] = found_key['host']
286
+ if new_key == found_key: # found a match
287
+ return True, False, found_line # found exactly the same key, don't replace
288
+ elif new_key['type'] == found_key['type']: # found a different key for the same key type
289
+ return True, True, found_line
283
290
 
284
291
  # No match found, return found and replace, but no line
285
292
  return True, True, None
@@ -5,8 +5,7 @@
5
5
  # Copyright: (c) 2017, Ansible Project
6
6
  # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
7
7
 
8
- from __future__ import absolute_import, division, print_function
9
- __metaclass__ = type
8
+ from __future__ import annotations
10
9
 
11
10
 
12
11
  DOCUMENTATION = r'''
@@ -127,10 +126,6 @@ options:
127
126
  type: bool
128
127
  default: no
129
128
  version_added: "2.5"
130
- others:
131
- description:
132
- - All arguments accepted by the M(ansible.builtin.file) module also work here.
133
- type: str
134
129
  extends_documentation_fragment:
135
130
  - action_common_attributes
136
131
  - action_common_attributes.files
ansible/modules/meta.py CHANGED
@@ -3,8 +3,7 @@
3
3
  # Copyright: (c) 2016, Ansible, a Red Hat company
4
4
  # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5
5
 
6
- from __future__ import absolute_import, division, print_function
7
- __metaclass__ = type
6
+ from __future__ import annotations
8
7
 
9
8
 
10
9
  DOCUMENTATION = r'''
@@ -63,6 +62,8 @@ attributes:
63
62
  connection:
64
63
  details: Most options in this action do not use a connection, except V(reset_connection) which still does not connect to the remote
65
64
  support: partial
65
+ until:
66
+ support: none
66
67
  notes:
67
68
  - V(clear_facts) will remove the persistent facts from M(ansible.builtin.set_fact) using O(ansible.builtin.set_fact#module:cacheable=True),
68
69
  but not the current host variable it creates for the current run.
@@ -4,8 +4,7 @@
4
4
  #
5
5
  # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
6
6
 
7
- from __future__ import absolute_import, division, print_function
8
- __metaclass__ = type
7
+ from __future__ import annotations
9
8
 
10
9
 
11
10
  DOCUMENTATION = '''
@@ -16,7 +15,7 @@ author:
16
15
  - Ansible Core Team
17
16
  short_description: Generic OS package manager
18
17
  description:
19
- - This modules manages packages on a target without specifying a package manager module (like M(ansible.builtin.yum), M(ansible.builtin.apt), ...).
18
+ - This modules manages packages on a target without specifying a package manager module (like M(ansible.builtin.dnf), M(ansible.builtin.apt), ...).
20
19
  It is convenient to use in an heterogeneous environment of machines without having to create a specific task for
21
20
  each package manager. M(ansible.builtin.package) calls behind the module for the package manager used by the operating system
22
21
  discovered by the module M(ansible.builtin.setup). If M(ansible.builtin.setup) was not yet run, M(ansible.builtin.package) will run it.
@@ -29,7 +28,8 @@ options:
29
28
  description:
30
29
  - Package name, or package specifier with version.
31
30
  - Syntax varies with package manager. For example V(name-1.0) or V(name=1.0).
32
- - Package names also vary with package manager; this module will not "translate" them per distro. For example V(libyaml-dev), V(libyaml-devel).
31
+ - Package names also vary with package manager; this module will not "translate" them per distribution. For example V(libyaml-dev), V(libyaml-devel).
32
+ - To operate on several packages this can accept a comma separated string of packages or a list of packages, depending on the underlying package manager.
33
33
  required: true
34
34
  state:
35
35
  description:
@@ -38,8 +38,9 @@ options:
38
38
  required: true
39
39
  use:
40
40
  description:
41
- - The required package manager module to use (V(yum), V(apt), and so on). The default V(auto) will use existing facts or try to autodetect it.
41
+ - The required package manager module to use (V(dnf), V(apt), and so on). The default V(auto) will use existing facts or try to auto-detect it.
42
42
  - You should only use this field if the automatic selection is not working for some reason.
43
+ - Since version 2.17 you can use the C(ansible_package_use) variable to override the automatic detection, but this option still takes precedence.
43
44
  default: auto
44
45
  requirements:
45
46
  - Whatever is required for the package plugins specific for each system.
@@ -3,8 +3,7 @@
3
3
 
4
4
  # most of it copied from AWX's scan_packages module
5
5
 
6
- from __future__ import absolute_import, division, print_function
7
- __metaclass__ = type
6
+ from __future__ import annotations
8
7
 
9
8
 
10
9
  DOCUMENTATION = '''
ansible/modules/pause.py CHANGED
@@ -1,8 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
 
4
- from __future__ import absolute_import, division, print_function
5
- __metaclass__ = type
4
+ from __future__ import annotations
6
5
 
7
6
 
8
7
  DOCUMENTATION = '''
@@ -15,7 +14,7 @@ description:
15
14
  - To pause/wait/sleep per host, use the M(ansible.builtin.wait_for) module.
16
15
  - You can use C(ctrl+c) if you wish to advance a pause earlier than it is set to expire or if you need to abort a playbook run entirely.
17
16
  To continue early press C(ctrl+c) and then C(c). To abort a playbook press C(ctrl+c) and then C(a).
18
- - Prompting for a set amount of time is not supported. Pausing playbook execution is interruptable but does not return user input.
17
+ - Prompting for a set amount of time is not supported. Pausing playbook execution is interruptible but does not return user input.
19
18
  - The pause module integrates into async/parallelized playbooks without any special considerations (see Rolling Updates).
20
19
  When using pauses with the C(serial) playbook parameter (as in rolling updates) you are only prompted once for the current group of hosts.
21
20
  - This module is also supported for Windows targets.
ansible/modules/ping.py CHANGED
@@ -4,8 +4,7 @@
4
4
  # (c) 2016, Toshio Kuratomi <tkuratomi@ansible.com>
5
5
  # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
6
6
 
7
- from __future__ import absolute_import, division, print_function
8
- __metaclass__ = type
7
+ from __future__ import annotations
9
8
 
10
9
 
11
10
  DOCUMENTATION = '''
ansible/modules/pip.py CHANGED
@@ -3,8 +3,7 @@
3
3
  # Copyright: (c) 2012, Matt Wright <matt@nobien.net>
4
4
  # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5
5
 
6
- from __future__ import absolute_import, division, print_function
7
- __metaclass__ = type
6
+ from __future__ import annotations
8
7
 
9
8
 
10
9
  DOCUMENTATION = '''
@@ -111,6 +110,13 @@ options:
111
110
  to specify desired umask mode as an octal string, (e.g., "0022").
112
111
  type: str
113
112
  version_added: "2.1"
113
+ break_system_packages:
114
+ description:
115
+ - Allow pip to modify an externally-managed Python installation as defined by PEP 668.
116
+ - This is typically required when installing packages outside a virtual environment on modern systems.
117
+ type: bool
118
+ default: false
119
+ version_added: "2.17"
114
120
  extends_documentation_fragment:
115
121
  - action_common_attributes
116
122
  attributes:
@@ -122,7 +128,7 @@ attributes:
122
128
  platforms: posix
123
129
  notes:
124
130
  - Python installations marked externally-managed (as defined by PEP668) cannot be updated by pip versions >= 23.0.1 without the use of
125
- a virtual environment or setting the environment variable ``PIP_BREAK_SYSTEM_PACKAGES=1``.
131
+ a virtual environment or setting the O(break_system_packages) option.
126
132
  - The virtualenv (U(http://www.virtualenv.org/)) must be
127
133
  installed on the remote host if the virtualenv parameter is specified and
128
134
  the virtualenv needs to be created.
@@ -236,6 +242,26 @@ EXAMPLES = '''
236
242
  name: bottle
237
243
  umask: "0022"
238
244
  become: True
245
+
246
+ - name: Run a module inside a virtual environment
247
+ block:
248
+ - name: Ensure the virtual environment exists
249
+ pip:
250
+ name: psutil
251
+ virtualenv: "{{ venv_dir }}"
252
+ # On Debian-based systems the correct python*-venv package must be installed to use the `venv` module.
253
+ virtualenv_command: "{{ ansible_python_interpreter }} -m venv"
254
+
255
+ - name: Run a module inside the virtual environment
256
+ wait_for:
257
+ port: 22
258
+ vars:
259
+ # Alternatively, use a block to affect multiple tasks, or use set_fact to affect the remainder of the playbook.
260
+ ansible_python_interpreter: "{{ venv_python }}"
261
+
262
+ vars:
263
+ venv_dir: /tmp/pick-a-better-venv-path
264
+ venv_python: "{{ venv_dir }}/bin/python"
239
265
  '''
240
266
 
241
267
  RETURN = '''
@@ -298,7 +324,6 @@ except Exception:
298
324
  from ansible.module_utils.common.text.converters import to_native
299
325
  from ansible.module_utils.basic import AnsibleModule, is_executable, missing_required_lib
300
326
  from ansible.module_utils.common.locale import get_best_parsable_locale
301
- from ansible.module_utils.six import PY3
302
327
 
303
328
 
304
329
  #: Python one-liners to be run at the command line that will determine the
@@ -425,15 +450,7 @@ def _is_present(module, req, installed_pkgs, pkg_command):
425
450
 
426
451
 
427
452
  def _get_pip(module, env=None, executable=None):
428
- # Older pip only installed under the "/usr/bin/pip" name. Many Linux
429
- # distros install it there.
430
- # By default, we try to use pip required for the current python
431
- # interpreter, so people can use pip to install modules dependencies
432
- candidate_pip_basenames = ('pip2', 'pip')
433
- if PY3:
434
- # pip under python3 installs the "/usr/bin/pip3" name
435
- candidate_pip_basenames = ('pip3',)
436
-
453
+ candidate_pip_basenames = ('pip3',)
437
454
  pip = None
438
455
  if executable is not None:
439
456
  if os.path.isabs(executable):
@@ -574,13 +591,10 @@ def setup_virtualenv(module, env, chdir, out, err):
574
591
  if not _is_venv_command(module.params['virtualenv_command']):
575
592
  if virtualenv_python:
576
593
  cmd.append('-p%s' % virtualenv_python)
577
- elif PY3:
578
- # Ubuntu currently has a patch making virtualenv always
579
- # try to use python2. Since Ubuntu16 works without
580
- # python2 installed, this is a problem. This code mimics
581
- # the upstream behaviour of using the python which invoked
582
- # virtualenv to determine which python is used inside of
583
- # the virtualenv (when none are specified).
594
+ else:
595
+ # This code mimics the upstream behaviour of using the python
596
+ # which invoked virtualenv to determine which python is used
597
+ # inside of the virtualenv (when none are specified).
584
598
  cmd.append('-p%s' % sys.executable)
585
599
 
586
600
  # if venv or pyvenv are used and virtualenv_python is defined, then
@@ -686,6 +700,7 @@ def main():
686
700
  chdir=dict(type='path'),
687
701
  executable=dict(type='path'),
688
702
  umask=dict(type='str'),
703
+ break_system_packages=dict(type='bool', default=False),
689
704
  ),
690
705
  required_one_of=[['name', 'requirements']],
691
706
  mutually_exclusive=[['name', 'requirements'], ['executable', 'virtualenv']],
@@ -790,6 +805,11 @@ def main():
790
805
  if extra_args:
791
806
  cmd.extend(shlex.split(extra_args))
792
807
 
808
+ if module.params['break_system_packages']:
809
+ # Using an env var instead of the `--break-system-packages` option, to avoid failing under pip 23.0.0 and earlier.
810
+ # See: https://github.com/pypa/pip/pull/11780
811
+ os.environ['PIP_BREAK_SYSTEM_PACKAGES'] = '1'
812
+
793
813
  if name:
794
814
  cmd.extend(to_native(p) for p in packages)
795
815
  elif requirements:
ansible/modules/raw.py CHANGED
@@ -3,8 +3,7 @@
3
3
  # Copyright: (c) 2012, Ansible Project
4
4
  # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5
5
 
6
- from __future__ import absolute_import, division, print_function
7
- __metaclass__ = type
6
+ from __future__ import annotations
8
7
 
9
8
 
10
9
  DOCUMENTATION = r'''
ansible/modules/reboot.py CHANGED
@@ -2,8 +2,7 @@
2
2
  # Copyright: (c) 2018, Ansible Project
3
3
  # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
4
4
 
5
- from __future__ import (absolute_import, division, print_function)
6
- __metaclass__ = type
5
+ from __future__ import annotations
7
6
 
8
7
 
9
8
  DOCUMENTATION = r'''
@@ -4,8 +4,7 @@
4
4
  # Copyright: (c) 2017, Ansible Project
5
5
  # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
6
6
 
7
- from __future__ import absolute_import, division, print_function
8
- __metaclass__ = type
7
+ from __future__ import annotations
9
8
 
10
9
 
11
10
  DOCUMENTATION = r'''
@@ -75,6 +74,7 @@ options:
75
74
  - Uses Python regular expressions; see
76
75
  U(https://docs.python.org/3/library/re.html).
77
76
  - Uses DOTALL, which means the V(.) special character I(can match newlines).
77
+ - Does not use MULTILINE, so V(^) and V($) will only match the beginning and end of the file.
78
78
  type: str
79
79
  version_added: "2.4"
80
80
  before:
@@ -84,6 +84,7 @@ options:
84
84
  - Uses Python regular expressions; see
85
85
  U(https://docs.python.org/3/library/re.html).
86
86
  - Uses DOTALL, which means the V(.) special character I(can match newlines).
87
+ - Does not use MULTILINE, so V(^) and V($) will only match the beginning and end of the file.
87
88
  type: str
88
89
  version_added: "2.4"
89
90
  backup:
@@ -125,7 +126,7 @@ EXAMPLES = r'''
125
126
  regexp: '^(.+)$'
126
127
  replace: '# \1'
127
128
 
128
- - name: Replace before the expression till the begin of the file (requires Ansible >= 2.4)
129
+ - name: Replace before the expression from the beginning of the file (requires Ansible >= 2.4)
129
130
  ansible.builtin.replace:
130
131
  path: /etc/apache2/sites-available/default.conf
131
132
  before: '# live site config'
@@ -134,11 +135,12 @@ EXAMPLES = r'''
134
135
 
135
136
  # Prior to Ansible 2.7.10, using before and after in combination did the opposite of what was intended.
136
137
  # see https://github.com/ansible/ansible/issues/31354 for details.
138
+ # Note (?m) which turns on MULTILINE mode so ^ matches any line's beginning
137
139
  - name: Replace between the expressions (requires Ansible >= 2.4)
138
140
  ansible.builtin.replace:
139
141
  path: /etc/hosts
140
- after: '<VirtualHost [*]>'
141
- before: '</VirtualHost>'
142
+ after: '(?m)^<VirtualHost [*]>'
143
+ before: '(?m)^</VirtualHost>'
142
144
  regexp: '^(.+)$'
143
145
  replace: '# \1'
144
146
 
@@ -5,8 +5,7 @@
5
5
 
6
6
  # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
7
7
 
8
- from __future__ import absolute_import, division, print_function
9
- __metaclass__ = type
8
+ from __future__ import annotations
10
9
 
11
10
 
12
11
  DOCUMENTATION = '''
ansible/modules/script.py CHANGED
@@ -1,8 +1,7 @@
1
1
  # Copyright: (c) 2012, Ansible Project
2
2
  # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
 
4
- from __future__ import absolute_import, division, print_function
5
- __metaclass__ = type
4
+ from __future__ import annotations
6
5
 
7
6
 
8
7
  DOCUMENTATION = r'''
@@ -3,8 +3,7 @@
3
3
  # Copyright: (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
4
4
  # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5
5
 
6
- from __future__ import absolute_import, division, print_function
7
- __metaclass__ = type
6
+ from __future__ import annotations
8
7
 
9
8
 
10
9
  DOCUMENTATION = r'''
@@ -180,7 +179,7 @@ from ansible.module_utils.common.text.converters import to_bytes, to_text
180
179
  from ansible.module_utils.basic import AnsibleModule
181
180
  from ansible.module_utils.common.locale import get_best_parsable_locale
182
181
  from ansible.module_utils.common.sys_info import get_platform_subclass
183
- from ansible.module_utils.service import fail_if_missing
182
+ from ansible.module_utils.service import fail_if_missing, is_systemd_managed
184
183
  from ansible.module_utils.six import PY2, b
185
184
 
186
185
 
@@ -485,24 +484,7 @@ class LinuxService(Service):
485
484
 
486
485
  # tools must be installed
487
486
  if location.get('systemctl', False):
488
-
489
- # this should show if systemd is the boot init system
490
- # these mirror systemd's own sd_boot test http://www.freedesktop.org/software/systemd/man/sd_booted.html
491
- for canary in ["/run/systemd/system/", "/dev/.run/systemd/", "/dev/.systemd/"]:
492
- if os.path.exists(canary):
493
- return True
494
-
495
- # If all else fails, check if init is the systemd command, using comm as cmdline could be symlink
496
- try:
497
- f = open('/proc/1/comm', 'r')
498
- except IOError:
499
- # If comm doesn't exist, old kernel, no systemd
500
- return False
501
-
502
- for line in f:
503
- if 'systemd' in line:
504
- return True
505
-
487
+ return is_systemd_managed(self.module)
506
488
  return False
507
489
 
508
490
  # Locate a tool to enable/disable a service
@@ -3,8 +3,7 @@
3
3
  # originally copied from AWX's scan_services module to bring this functionality
4
4
  # into Core
5
5
 
6
- from __future__ import absolute_import, division, print_function
7
- __metaclass__ = type
6
+ from __future__ import annotations
8
7
 
9
8
 
10
9
  DOCUMENTATION = r'''
@@ -95,6 +94,7 @@ import platform
95
94
  import re
96
95
  from ansible.module_utils.basic import AnsibleModule
97
96
  from ansible.module_utils.common.locale import get_best_parsable_locale
97
+ from ansible.module_utils.service import is_systemd_managed
98
98
 
99
99
 
100
100
  class BaseService(object):
@@ -245,16 +245,7 @@ class SystemctlScanService(BaseService):
245
245
  BAD_STATES = frozenset(['not-found', 'masked', 'failed'])
246
246
 
247
247
  def systemd_enabled(self):
248
- # Check if init is the systemd command, using comm as cmdline could be symlink
249
- try:
250
- f = open('/proc/1/comm', 'r')
251
- except IOError:
252
- # If comm doesn't exist, old kernel, no systemd
253
- return False
254
- for line in f:
255
- if 'systemd' in line:
256
- return True
257
- return False
248
+ return is_systemd_managed(self.module)
258
249
 
259
250
  def _list_from_units(self, systemctl_path, services):
260
251