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
ansible/modules/group.py CHANGED
@@ -37,7 +37,7 @@ options:
37
37
  force:
38
38
  description:
39
39
  - Whether to delete a group even if it is the primary group of a user.
40
- - Only applicable on platforms which implement a --force flag on the group deletion command.
40
+ - Only applicable on platforms which implement a C(--force) flag on the group deletion command.
41
41
  type: bool
42
42
  default: false
43
43
  version_added: "2.15"
@@ -62,6 +62,22 @@ options:
62
62
  type: bool
63
63
  default: no
64
64
  version_added: "2.8"
65
+ gid_min:
66
+ description:
67
+ - Sets the GID_MIN value for group creation.
68
+ - Overwrites /etc/login.defs default value.
69
+ - Currently supported on Linux. Does nothing when used with other platforms.
70
+ - Requires O(local) is omitted or V(False).
71
+ type: int
72
+ version_added: "2.18"
73
+ gid_max:
74
+ description:
75
+ - Sets the GID_MAX value for group creation.
76
+ - Overwrites /etc/login.defs default value.
77
+ - Currently supported on Linux. Does nothing when used with other platforms.
78
+ - Requires O(local) is omitted or V(False).
79
+ type: int
80
+ version_added: "2.18"
65
81
  extends_documentation_fragment: action_common_attributes
66
82
  attributes:
67
83
  check_mode:
@@ -151,6 +167,14 @@ class Group(object):
151
167
  self.system = module.params['system']
152
168
  self.local = module.params['local']
153
169
  self.non_unique = module.params['non_unique']
170
+ self.gid_min = module.params['gid_min']
171
+ self.gid_max = module.params['gid_max']
172
+
173
+ if self.local:
174
+ if self.gid_min is not None:
175
+ module.fail_json(msg="'gid_min' can not be used with 'local'")
176
+ if self.gid_max is not None:
177
+ module.fail_json(msg="'gid_max' can not be used with 'local'")
154
178
 
155
179
  def execute_command(self, cmd):
156
180
  return self.module.run_command(cmd)
@@ -184,6 +208,12 @@ class Group(object):
184
208
  cmd.append('-o')
185
209
  elif key == 'system' and kwargs[key] is True:
186
210
  cmd.append('-r')
211
+ if self.gid_min is not None:
212
+ cmd.append('-K')
213
+ cmd.append('GID_MIN=' + str(self.gid_min))
214
+ if self.gid_max is not None:
215
+ cmd.append('-K')
216
+ cmd.append('GID_MAX=' + str(self.gid_max))
187
217
  cmd.append(self.name)
188
218
  return self.execute_command(cmd)
189
219
 
@@ -292,6 +322,12 @@ class SunOS(Group):
292
322
  cmd.append(str(kwargs[key]))
293
323
  if self.non_unique:
294
324
  cmd.append('-o')
325
+ if self.gid_min is not None:
326
+ cmd.append('-K')
327
+ cmd.append('GID_MIN=' + str(self.gid_min))
328
+ if self.gid_max is not None:
329
+ cmd.append('-K')
330
+ cmd.append('GID_MAX=' + str(self.gid_max))
295
331
  cmd.append(self.name)
296
332
  return self.execute_command(cmd)
297
333
 
@@ -323,6 +359,12 @@ class AIX(Group):
323
359
  cmd.append('id=' + str(kwargs[key]))
324
360
  elif key == 'system' and kwargs[key] is True:
325
361
  cmd.append('-a')
362
+ if self.gid_min is not None:
363
+ cmd.append('-K')
364
+ cmd.append('GID_MIN=' + str(self.gid_min))
365
+ if self.gid_max is not None:
366
+ cmd.append('-K')
367
+ cmd.append('GID_MAX=' + str(self.gid_max))
326
368
  cmd.append(self.name)
327
369
  return self.execute_command(cmd)
328
370
 
@@ -368,6 +410,12 @@ class FreeBsdGroup(Group):
368
410
  cmd.append(str(self.gid))
369
411
  if self.non_unique:
370
412
  cmd.append('-o')
413
+ if self.gid_min is not None:
414
+ cmd.append('-K')
415
+ cmd.append('GID_MIN=' + str(self.gid_min))
416
+ if self.gid_max is not None:
417
+ cmd.append('-K')
418
+ cmd.append('GID_MAX=' + str(self.gid_max))
371
419
  return self.execute_command(cmd)
372
420
 
373
421
  def group_mod(self, **kwargs):
@@ -492,6 +540,12 @@ class OpenBsdGroup(Group):
492
540
  cmd.append(str(self.gid))
493
541
  if self.non_unique:
494
542
  cmd.append('-o')
543
+ if self.gid_min is not None:
544
+ cmd.append('-K')
545
+ cmd.append('GID_MIN=' + str(self.gid_min))
546
+ if self.gid_max is not None:
547
+ cmd.append('-K')
548
+ cmd.append('GID_MAX=' + str(self.gid_max))
495
549
  cmd.append(self.name)
496
550
  return self.execute_command(cmd)
497
551
 
@@ -538,6 +592,12 @@ class NetBsdGroup(Group):
538
592
  cmd.append(str(self.gid))
539
593
  if self.non_unique:
540
594
  cmd.append('-o')
595
+ if self.gid_min is not None:
596
+ cmd.append('-K')
597
+ cmd.append('GID_MIN=' + str(self.gid_min))
598
+ if self.gid_max is not None:
599
+ cmd.append('-K')
600
+ cmd.append('GID_MAX=' + str(self.gid_max))
541
601
  cmd.append(self.name)
542
602
  return self.execute_command(cmd)
543
603
 
@@ -578,6 +638,14 @@ class BusyBoxGroup(Group):
578
638
  if self.system:
579
639
  cmd.append('-S')
580
640
 
641
+ if self.gid_min is not None:
642
+ cmd.append('-K')
643
+ cmd.append('GID_MIN=' + str(self.gid_min))
644
+
645
+ if self.gid_max is not None:
646
+ cmd.append('-K')
647
+ cmd.append('GID_MAX=' + str(self.gid_max))
648
+
581
649
  cmd.append(self.name)
582
650
 
583
651
  return self.execute_command(cmd)
@@ -626,6 +694,8 @@ def main():
626
694
  system=dict(type='bool', default=False),
627
695
  local=dict(type='bool', default=False),
628
696
  non_unique=dict(type='bool', default=False),
697
+ gid_min=dict(type='int'),
698
+ gid_max=dict(type='int'),
629
699
  ),
630
700
  supports_check_mode=True,
631
701
  required_if=[
@@ -36,7 +36,7 @@ options:
36
36
  description:
37
37
  - Which strategy to use to update the hostname.
38
38
  - If not set we try to autodetect, but this can be problematic, particularly with containers as they can present misleading information.
39
- - Note that 'systemd' should be specified for RHEL/EL/CentOS 7+. Older distributions should use 'redhat'.
39
+ - Note that V(systemd) should be specified for RHEL/EL/CentOS 7+. Older distributions should use V(redhat).
40
40
  choices: ['alpine', 'debian', 'freebsd', 'generic', 'macos', 'macosx', 'darwin', 'openbsd', 'openrc', 'redhat', 'sles', 'solaris', 'systemd']
41
41
  type: str
42
42
  version_added: '2.9'
@@ -516,7 +516,7 @@ class DarwinStrategy(BaseStrategy):
516
516
  However, macOS also has LocalHostName and ComputerName settings.
517
517
  LocalHostName controls the Bonjour/ZeroConf name, used by services
518
518
  like AirDrop. This class implements a method, _scrub_hostname(), that mimics
519
- the transformations macOS makes on hostnames when enterened in the Sharing
519
+ the transformations macOS makes on hostnames when entered in the Sharing
520
520
  preference pane. It replaces spaces with dashes and removes all special
521
521
  characters.
522
522
 
@@ -886,8 +886,6 @@ def main():
886
886
 
887
887
  if name != current_hostname:
888
888
  name_before = current_hostname
889
- elif name != permanent_hostname:
890
- name_before = permanent_hostname
891
889
  else:
892
890
  name_before = permanent_hostname
893
891
 
@@ -21,20 +21,20 @@ options:
21
21
  file:
22
22
  description:
23
23
  - The file name from which variables should be loaded.
24
- - If the path is relative, it will look for the file in vars/ subdirectory of a role or relative to playbook.
24
+ - If the path is relative, it will look for the file in C(vars/) subdirectory of a role or relative to playbook.
25
25
  type: path
26
26
  version_added: "2.2"
27
27
  dir:
28
28
  description:
29
29
  - The directory name from which the variables should be loaded.
30
- - If the path is relative and the task is inside a role, it will look inside the role's vars/ subdirectory.
30
+ - If the path is relative and the task is inside a role, it will look inside the role's C(vars/) subdirectory.
31
31
  - If the path is relative and not inside a role, it will be parsed relative to the playbook.
32
32
  type: path
33
33
  version_added: "2.2"
34
34
  name:
35
35
  description:
36
36
  - The name of a variable into which assign the included vars.
37
- - If omitted (null) they will be made top level vars.
37
+ - If omitted (V(null)) they will be made top level vars.
38
38
  type: str
39
39
  version_added: "2.2"
40
40
  depth:
@@ -81,8 +81,8 @@ options:
81
81
  version_added: "2.12"
82
82
  free-form:
83
83
  description:
84
- - This module allows you to specify the 'file' option directly without any other options.
85
- - There is no 'free-form' option, this is just an indicator, see example below.
84
+ - This module allows you to specify the O(file) option directly without any other options.
85
+ - There is no O(ignore:free-form) option, this is just an indicator, see example below.
86
86
  extends_documentation_fragment:
87
87
  - action_common_attributes
88
88
  - action_common_attributes.conn
@@ -39,7 +39,7 @@ options:
39
39
  description:
40
40
  - This option specifies the packet matching table on which the command should operate.
41
41
  - If the kernel is configured with automatic module loading, an attempt will be made
42
- to load the appropriate module for that table if it is not already there.
42
+ to load the appropriate module for that table if it is not already there.
43
43
  type: str
44
44
  choices: [ filter, nat, mangle, raw, security ]
45
45
  default: filter
@@ -135,7 +135,7 @@ options:
135
135
  a specific property.
136
136
  - The set of matches makes up the condition under which a target is invoked.
137
137
  - Matches are evaluated first to last if specified as an array and work in short-circuit
138
- fashion, i.e. if one extension yields false, the evaluation will stop.
138
+ fashion, in other words if one extension yields false, the evaluation will stop.
139
139
  type: list
140
140
  elements: str
141
141
  default: []
@@ -153,7 +153,7 @@ options:
153
153
  gateway:
154
154
  description:
155
155
  - This specifies the IP address of the host to send the cloned packets.
156
- - This option is only valid when O(jump) is set to V(TEE).
156
+ - This option is only valid when O(jump=TEE).
157
157
  type: str
158
158
  version_added: "2.8"
159
159
  log_prefix:
@@ -165,7 +165,7 @@ options:
165
165
  description:
166
166
  - Logging level according to the syslogd-defined priorities.
167
167
  - The value can be strings or numbers from 1-8.
168
- - This parameter is only applicable if O(jump) is set to V(LOG).
168
+ - This parameter is only applicable if O(jump=LOG).
169
169
  type: str
170
170
  version_added: "2.8"
171
171
  choices: [ '0', '1', '2', '3', '4', '5', '6', '7', 'emerg', 'alert', 'crit', 'error', 'warning', 'notice', 'info', 'debug' ]
@@ -242,13 +242,13 @@ options:
242
242
  type: str
243
243
  to_destination:
244
244
  description:
245
- - This specifies a destination address to use with C(DNAT).
245
+ - This specifies a destination address to use with O(ctstate=DNAT).
246
246
  - Without this, the destination address is never altered.
247
247
  type: str
248
248
  version_added: "2.1"
249
249
  to_source:
250
250
  description:
251
- - This specifies a source address to use with C(SNAT).
251
+ - This specifies a source address to use with O(ctstate=SNAT).
252
252
  - Without this, the source address is never altered.
253
253
  type: str
254
254
  version_added: "2.2"
@@ -342,14 +342,14 @@ options:
342
342
  reject_with:
343
343
  description:
344
344
  - 'Specifies the error packet type to return while rejecting. It implies
345
- "jump: REJECT".'
345
+ C(jump=REJECT).'
346
346
  type: str
347
347
  version_added: "2.1"
348
348
  icmp_type:
349
349
  description:
350
350
  - This allows specification of the ICMP type, which can be a numeric
351
351
  ICMP type, type/code pair, or one of the ICMP type names shown by the
352
- command 'iptables -p icmp -h'
352
+ command C(iptables -p icmp -h).
353
353
  type: str
354
354
  version_added: "2.2"
355
355
  flush:
@@ -387,10 +387,10 @@ options:
387
387
  version_added: "2.13"
388
388
  numeric:
389
389
  description:
390
- - This parameter controls the running of the list -action of iptables, which is used internally by the module
391
- - Does not affect the actual functionality. Use this if iptables hang when creating a chain or altering policy
392
- - If V(true), then iptables skips the DNS-lookup of the IP addresses in a chain when it uses the list -action
393
- - Listing is used internally for example when setting a policy or creating a chain
390
+ - This parameter controls the running of the list -action of iptables, which is used internally by the module.
391
+ - Does not affect the actual functionality. Use this if iptables hang when creating a chain or altering policy.
392
+ - If V(true), then iptables skips the DNS-lookup of the IP addresses in a chain when it uses the list -action.
393
+ - Listing is used internally for example when setting a policy or creating a chain.
394
394
  type: bool
395
395
  default: false
396
396
  version_added: "2.15"
@@ -848,6 +848,7 @@ def main():
848
848
  required_if=[
849
849
  ['jump', 'TEE', ['gateway']],
850
850
  ['jump', 'tee', ['gateway']],
851
+ ['flush', False, ['chain']],
851
852
  ]
852
853
  )
853
854
  args = dict(
@@ -865,10 +866,6 @@ def main():
865
866
  ip_version = module.params['ip_version']
866
867
  iptables_path = module.get_bin_path(BINS[ip_version], True)
867
868
 
868
- # Check if chain option is required
869
- if args['flush'] is False and args['chain'] is None:
870
- module.fail_json(msg="Either chain or flush parameter must be specified.")
871
-
872
869
  if module.params.get('log_prefix', None) or module.params.get('log_level', None):
873
870
  if module.params['jump'] is None:
874
871
  module.params['jump'] = 'LOG'
@@ -10,7 +10,7 @@ DOCUMENTATION = r'''
10
10
  module: known_hosts
11
11
  short_description: Add or remove a host from the C(known_hosts) file
12
12
  description:
13
- - The M(ansible.builtin.known_hosts) module lets you add or remove a host keys from the C(known_hosts) file.
13
+ - The M(ansible.builtin.known_hosts) module lets you add or remove host keys from the C(known_hosts) file.
14
14
  - Starting at Ansible 2.2, multiple entries per host are allowed, but only one for each key type supported by ssh.
15
15
  This is useful if you're going to want to use the M(ansible.builtin.git) module over ssh, for example.
16
16
  - If you have a very large number of host keys to manage, you will find the M(ansible.builtin.template) module more useful.
@@ -19,7 +19,7 @@ options:
19
19
  name:
20
20
  aliases: [ 'host' ]
21
21
  description:
22
- - The host to add or remove (must match a host specified in key). It will be converted to lowercase so that ssh-keygen can find it.
22
+ - The host to add or remove (must match a host specified in key). It will be converted to lowercase so that C(ssh-keygen) can find it.
23
23
  - Must match with <hostname> or <ip> present in key attribute.
24
24
  - For custom SSH port, O(name) needs to specify port as well. See example section.
25
25
  type: str
@@ -49,8 +49,8 @@ options:
49
49
  version_added: "2.3"
50
50
  state:
51
51
  description:
52
- - V(present) to add the host key.
53
- - V(absent) to remove it.
52
+ - V(present) to add host keys.
53
+ - V(absent) to remove host keys.
54
54
  choices: [ "absent", "present" ]
55
55
  default: "present"
56
56
  type: str
@@ -101,6 +101,7 @@ EXAMPLES = r'''
101
101
  # state = absent|present (default: present)
102
102
 
103
103
  import base64
104
+ import copy
104
105
  import errno
105
106
  import hashlib
106
107
  import hmac
@@ -118,6 +119,7 @@ def enforce_state(module, params):
118
119
  Add or remove key.
119
120
  """
120
121
 
122
+ results = dict(changed=False)
121
123
  host = params["name"].lower()
122
124
  key = params.get("key", None)
123
125
  path = params.get("path")
@@ -140,13 +142,12 @@ def enforce_state(module, params):
140
142
 
141
143
  found, replace_or_add, found_line = search_for_host_key(module, host, key, path, sshkeygen)
142
144
 
143
- params['diff'] = compute_diff(path, found_line, replace_or_add, state, key)
145
+ results['diff'] = compute_diff(path, found_line, replace_or_add, state, key)
144
146
 
145
147
  # check if we are trying to remove a non matching key,
146
148
  # in that case return with no change to the host
147
149
  if state == 'absent' and not found_line and key:
148
- params['changed'] = False
149
- return params
150
+ return results
150
151
 
151
152
  # We will change state if found==True & state!="present"
152
153
  # or found==False & state=="present"
@@ -154,15 +155,15 @@ def enforce_state(module, params):
154
155
  # Alternatively, if replace is true (i.e. key present, and we must change
155
156
  # it)
156
157
  if module.check_mode:
157
- module.exit_json(changed=replace_or_add or (state == "present") != found,
158
- diff=params['diff'])
158
+ results['changed'] = replace_or_add or (state == "present") != found
159
+ module.exit_json(**results)
159
160
 
160
161
  # Now do the work.
161
162
 
162
163
  # Only remove whole host if found and no key provided
163
164
  if found and not key and state == "absent":
164
165
  module.run_command([sshkeygen, '-R', host, '-f', path], check_rc=True)
165
- params['changed'] = True
166
+ results['changed'] = True
166
167
 
167
168
  # Next, add a new (or replacing) entry
168
169
  if replace_or_add or found != (state == "present"):
@@ -188,9 +189,9 @@ def enforce_state(module, params):
188
189
  else:
189
190
  module.atomic_move(outf.name, path)
190
191
 
191
- params['changed'] = True
192
+ results['changed'] = True
192
193
 
193
- return params
194
+ return results
194
195
 
195
196
 
196
197
  def sanity_check(module, host, key, sshkeygen):
@@ -364,7 +365,9 @@ def main():
364
365
  supports_check_mode=True
365
366
  )
366
367
 
367
- results = enforce_state(module, module.params)
368
+ # TODO: deprecate returning everything that was passed in
369
+ results = copy.copy(module.params)
370
+ results.update(enforce_state(module, module.params))
368
371
  module.exit_json(**results)
369
372
 
370
373
 
@@ -87,13 +87,11 @@ options:
87
87
  - If specified, the line will be inserted after the last match of specified regular expression.
88
88
  - If the first match is required, use(firstmatch=yes).
89
89
  - A special value is available; V(EOF) for inserting the line at the end of the file.
90
- - If specified regular expression has no matches, EOF will be used instead.
90
+ - If specified regular expression has no matches or no value is passed, V(EOF) will be used instead.
91
91
  - If O(insertbefore) is set, default value V(EOF) will be ignored.
92
92
  - If regular expressions are passed to both O(regexp) and O(insertafter), O(insertafter) is only honored if no match for O(regexp) is found.
93
93
  - May not be used with O(backrefs) or O(insertbefore).
94
94
  type: str
95
- choices: [ EOF, '*regex*' ]
96
- default: EOF
97
95
  insertbefore:
98
96
  description:
99
97
  - Used with O(state=present).
@@ -104,7 +102,6 @@ options:
104
102
  - If regular expressions are passed to both O(regexp) and O(insertbefore), O(insertbefore) is only honored if no match for O(regexp) is found.
105
103
  - May not be used with O(backrefs) or O(insertafter).
106
104
  type: str
107
- choices: [ BOF, '*regex*' ]
108
105
  version_added: "1.1"
109
106
  create:
110
107
  description:
ansible/modules/meta.py CHANGED
@@ -33,7 +33,12 @@ options:
33
33
  - V(end_host) (added in Ansible 2.8) is a per-host variation of V(end_play). Causes the play to end for the current host without failing it.
34
34
  - V(end_batch) (added in Ansible 2.12) causes the current batch (see C(serial)) to end without failing the host(s).
35
35
  Note that with C(serial=0) or undefined this behaves the same as V(end_play).
36
- choices: [ clear_facts, clear_host_errors, end_host, end_play, flush_handlers, noop, refresh_inventory, reset_connection, end_batch ]
36
+ - V(end_role) (added in Ansible 2.18) causes the currently executing role to end without failing the host(s).
37
+ Effectively all tasks from within a role after V(end_role) is executed are ignored. Since handlers live in a global,
38
+ play scope, all handlers added via the role are unaffected and are still executed if notified. It is an error
39
+ to call V(end_role) from outside of a role or from a handler. Note that V(end_role) does not have an effect to
40
+ the parent roles or roles that depend (via dependencies in meta/main.yml) on a role executing V(end_role).
41
+ choices: [ clear_facts, clear_host_errors, end_host, end_play, flush_handlers, noop, refresh_inventory, reset_connection, end_batch, end_role ]
37
42
  required: true
38
43
  extends_documentation_fragment:
39
44
  - action_common_attributes