Compare commits

...

126 Commits

Author SHA1 Message Date
9ea56ff292 New release v2.10.6 2021-02-17 16:10:38 -06:00
510ef832ae Update Ansible release version to v2.10.6rc1.post0. 2021-02-08 23:06:02 -06:00
244fdf324c New release v2.10.6rc1 2021-02-08 19:01:35 -06:00
aedc7301f6 [stable-2.10] Temporary fix for cryptography issues. (#73530). (#73533)
(cherry picked from commit 1a2da990a4)

Co-authored-by: Matt Clay <mclay@redhat.com>
2021-02-08 17:21:15 -06:00
5411090f51 Bump antsibull-changelog version for changelog sanity test.
(cherry picked from commit 82cdd7e735)
2021-02-08 09:04:07 -08:00
f9572a377d [stable-2.10] pause - adjust warning when run in background (#73182) (#73231)
When the pause module is run in the background and seconds parameter is provided,
do not warn.

* Add tests
* Fix existing tests
  The test wasn't failing when it should have.
(cherry picked from commit 0e6c334115)

Co-authored-by: Sam Doran <sdoran@redhat.com>
2021-02-07 17:57:31 -06:00
bca57ec65a bugfix: use to_text(stdout) in psrp.Connection.put_file method (#73491) - 2.10 (#73496)
(cherry picked from commit f271d02a9f)

Co-authored-by: jakegatsby <39974194+jakegatsby@users.noreply.github.com>
2021-02-07 17:56:59 -06:00
e75570ba83 [stable-2.10] Fix YAML error message when error is at the end of the file (#73241) (#73296)
If a YAML file fails to load due to a syntax error in a file, or there is an error in the last line of a
file, PyYAML reports the last line number of the file as the index where the error occurred.

When reading the file lines, we use that index to the get the relevant line.  If the index value is out
of range, the relevant line is lost for error reporting.

Subtract one from the index value to avoid the IndexError in this specific scenario. It is possible
to still get an IndexError, which will be handled as it is currently.

* Update existing tests and add new tests
(cherry picked from commit e8d4b62b41)

Co-authored-by: Sam Doran <sdoran@redhat.com>
2021-02-07 17:56:17 -06:00
3ef061bdc4 Use a pty for local connections (#73023) (#73281)
Fixes #38696

Co-authored-by: James Cammarata <jimi@sngx.net>
(cherry picked from commit 30d93995dd)
2021-02-07 17:53:10 -06:00
63ead90ab9 Always mention the name of the deprecated plugin in routing deprecation messages (#73059) (#73237)
(cherry picked from commit df9cf368c0)
2021-02-07 17:52:29 -06:00
70fb5ae36a [stable-2.10] facts - properly report virtualization facts for Linux guests on bhyve (#73204). (#73233)
(cherry picked from commit df451636e7)

Co-authored-by: Sam Doran <sdoran@redhat.com>
2021-02-07 17:50:49 -06:00
9478b59da5 fix inventory source parse error handling (#73160) (#73276)
fixes #51025

added test cases

(cherry picked from commit 1e27d4052a)
2021-02-07 17:29:07 -06:00
2c8c02c816 Local vars should have highest precedence in AnsibleJ2Vars (#72830) (#73370)
Ability to add local variables into AnsibleJ2Vars was added in
18a9eff11f to fix #6653. Local variables
are added using ``AnsibleJ2Vars.add_locals()`` method when creating a
new context - typically when including/importing a template with
context. For that use case local template variables created using
``set`` should override variables from higher contexts - either from the
play or any parent template, or both; Jinja behaves the same way.

Also removes AnsibleJ2Vars.extras instance variable which is not used.

Also adds missing test for #6653.

Fixes #72262
Fixes #72615

ci_complete

(cherry picked from commit a2af8432f3)
2021-02-07 01:30:47 -06:00
e41d1f0a3f no_log mask suboption fallback values and defaults CVE-2021-20228 (#73487) (#73494)
(cherry picked from commit 0cdc410dce)
2021-02-07 01:11:27 -06:00
67a018b815 fix typo (#73479)
(cherry picked from commit f72dec16ea)
2021-02-07 01:09:28 -06:00
015ec3eda8 git: verify, only use --raw when we need it (#70900) (#73473)
Change:
- Allow older git to verify tags again
- Enable verification tests everywhere, even if most of them only work
  on newer git. Some of them work on older git and they test the --raw
  parameter.

Test Plan:
- Re-enabled subset of git tests

Tickets:
- Fixes #64469

Signed-off-by: Rick Elrod <rick@elrod.me>
2021-02-07 01:08:04 -06:00
6df8a9ec53 Fix warning for nonexistent inventory cache (#72840) (#73443)
* Fix inventory cache warning by checking if the key exists before loading it

(cherry picked from commit 840bdc1e10)
2021-02-07 01:05:20 -06:00
148240099a ensure unsafe writes fallback (#70722) (#73144)
* Ensure we actually fallback to unsafe_writes when set to true

 add integration test
 add fix for get_url not passing the parameter from args

(cherry picked from commit 932ba36160)

* Added clog missing for issue 70722 (#73175)

(cherry picked from commit d6670da1d7)
2021-02-07 01:03:43 -06:00
e9c6b382ea [stable-2.10] import_playbook - change additional params to deprecation (#72987) (#73015)
I incorrectly recommended this be set as a warning when it should have been a deprecation.

* Fix deprecation sanity test to not required a collection name when not inside a collection
(cherry picked from commit 8e022ef00a)

Co-authored-by: Sam Doooran <sdoran@redhat.com>
2021-02-07 00:52:15 -06:00
3eafe0f255 [setup_rpm_repo test] Ensure rpm-build is present (#73516) (#73518)
Change:
- Other targets might remove rpm-build as they clean up after
  themselves. Ensure that it's present in setup_rpm_repo because
  rpmfluff needs it.

Test Plan:
- Local experimentation with yum_repository and mysql_db (the latter of
  which depends on a handler which was removing rpm-build) on
  stable-2.9.

Signed-off-by: Rick Elrod <rick@elrod.me>
(cherry picked from commit aca5b0e43b)
2021-02-05 15:37:46 -06:00
457dcf1313 [stable-2.10] Make yum_repository test more reliable (#73467)
* Improve setup_rpm_repo

- add handlers to remove repos
- add variable to control whethere or not repos are created

* Use local repo for all distros
* Change repo creation script to module.
(cherry picked from commit 997b2d2a19)

Co-authored-by: Sam Doran <sdoran@redhat.com>
2021-02-03 23:01:07 -08:00
985a395cd9 validate_modules: fails with .id attribute not found (#73322)
* validate_modules: fails with .id attribute not found

This patch addresses a problem in the `found_try_except_import` test.

This module tries to identify lines like:

`HAS_FOO = True`

In this case, the target (`HAS_FOO`) is of type `ast.Name` and has a
`id` attribute which provide the name.

In my case, I've a line that set a module attribute`. In this case, the
target (`module.var`) has the type `ast.Attribute` and no `id`
attribute. The code trigger an `AttributeError` exception.

This patch ensures we compare a `ast.Name`.

* Update test/lib/ansible_test/_data/sanity/validate-modules/validate_modules/main.py

(cherry picked from commit 7cf80f50d1)
2021-02-03 09:07:14 -08:00
6cde1cdf35 Documentation: fix formatting (#73186) 2021-02-03 10:18:41 -06:00
dcec0ec806 Make sure to mention collection version for version_added as well. (#73270) (#73280)
(cherry picked from commit 73aa571305)
2021-02-03 09:20:30 -06:00
d7b562b393 add new glossary terms for 2.10 (#71813) (#73293)
* add new terms for 2.10
Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com>

(cherry picked from commit 4aedd1b987)

Co-authored-by: Sandra McCann <samccann@redhat.com>
2021-02-03 09:19:46 -06:00
d5acbfd6e3 Remove 'type: complex' from the example, and mention that it should be avoided. (#73171) (#73222)
(cherry picked from commit 270385f949)
2021-02-03 09:18:06 -06:00
4488b91699 Fix versionadded syntax @ galaxy user guide (#73350)
(cherry picked from commit 6abeabaff1)
2021-02-02 11:17:13 -06:00
25962888ac Mention that C(...) should be used for inline code. (#73312) (#73374)
(cherry picked from commit 76604397cb)
2021-02-02 11:16:03 -06:00
a3175e9979 Revert "[ansible-test] Bump CentOS 6 image (yum repos) (#73446) (#73447)" (#73450)
This reverts commit e4f8d528b9.
2021-02-01 22:02:55 -06:00
e4f8d528b9 [ansible-test] Bump CentOS 6 image (yum repos) (#73446) (#73447)
Change:
- Bump centos6 image version to one which includes multiple fallbacks
  for vault.centos.org content.

Signed-off-by: Rick Elrod <rick@elrod.me>
2021-02-01 18:37:24 -06:00
356aae0e23 [2.10] Add Ubuntu 20.04 to CI and ansible-test (#69161) (#73365)
Change:
- Add Ubuntu 20.04 to CI now that venv is default instead of virtualenv in ansible-test.

Test Plan:
- CI

Tickets:
- Fixes #69203

Signed-off-by: Rick Elrod <rick@elrod.me>
2021-01-26 13:01:31 -06:00
c47ec375fa [stable-2.10] Use a versioned pip bootstrapper in ansible-test. (#73359)
(cherry picked from commit fc590aeb21)

Co-authored-by: Matt Clay <matt@mystile.com>
2021-01-25 15:37:30 -06:00
1f90c11782 [stable-2.10] Handle get-pip.py breaking change on Python 2.7.
(cherry picked from commit 484e4af4d0)

Co-authored-by: Matt Clay <matt@mystile.com>
2021-01-23 12:36:28 -08:00
e5b6d2aaae Update Ansible release version to v2.10.5.post0. 2021-01-18 18:19:05 -06:00
890601dcef New release v2.10.5 2021-01-18 14:34:40 -06:00
a8ebe99c98 Revert "update the docs requirements versions (#73108) (#73251)"
This reverts commit ee46fe2910.
2021-01-15 14:38:05 -08:00
0803063424 Revert "update rstcheck and sphinx versions in contraints (#73176) (#73249)"
This reverts commit 2a91ba71b2.
2021-01-15 14:34:58 -08:00
ee46fe2910 update the docs requirements versions (#73108) (#73251)
(cherry picked from commit 0936623901)
2021-01-15 12:45:17 -06:00
2a91ba71b2 update rstcheck and sphinx versions in contraints (#73176) (#73249)
* and fix test error

(cherry picked from commit 88763c7347)
2021-01-15 12:44:36 -06:00
0b77ffb980 Update Ansible release version to v2.10.5rc1.post0. 2021-01-11 21:28:30 -06:00
422b9c09ee New release v2.10.5rc1 2021-01-11 17:33:09 -06:00
08ba838a8e [2.10] Pass the top level dictionaries to combine_vars (#72979) (#73146)
combine_vars uses dict.update() to replace keys

(cherry picked from commit 5e03e322de)

* Add tests for merging and replacing vars from inventory sources (#73181)

(cherry picked from commit 9de2da8a7e)
2021-01-11 17:20:48 -06:00
abc6658ac2 [stable-2.10] Add macOS 11 to CI (#72622) (#73180)
* [stable-2.10] Add macOS 11 to CI (#72622)

* Fix connection_paramiko_ssh test for macOS 11
* Update Azure Pipelines config
* Add changelog
(cherry picked from commit a7e834071c)

Co-authored-by: Sam Doran <sdoran@redhat.com>

* Prefer venv for tests

* Update pip integration test to use venv on py3.

(cherry picked from commit 456e9b7a33)

Co-authored-by: Matt Clay <matt@mystile.com>
2021-01-11 16:45:58 -06:00
b4b1bf9932 [stable-2.10] user - properly handle password and password lock when used together (#73016) (#73177)
Do the right thing on Linux when password lock and a password hash are provided by writing
out the password hash prepended by the appropriate lock string rather than using -U and -L.
This is the correct way to set and lock the account in one command.

On BSD, run separate commands as appropriate since locking and setting the password cannot
be done in a single action.

FreeBSD requires running several commands to get the account in the desired state. As a result,
the rc, output, and error from all commands need to be combined and evaluated so an accurate
and complete summary can be given at the end of module execution.

* Improve integration tests to cover this scenario.
* Break up user integration tests into smaller files
* Properly lock account when creating a new account and password is supplied

* Simplify rc collection in FreeBSD class
  Since the _handle_lock() method was added, the rc would be set to None, which could make
  task change reporting incorrect. My first attempt to solve this used a set and was a bit too
  complicated. Simplify it my comparing the rc from _handle_lock() and the current value of rc.

* Improve the Linux password hash and locking behavior
  If password lock and hash are provided, set the hash and lock the account by using a password
  hash since -L cannot be used with -p.

* Ensure -U and -L are not combined with -p since they are mutually exclusive to usermod.

* Clarify password_lock behavior..
(cherry picked from commit 264e08f21a)

Co-authored-by: Sam Doran <sdoran@redhat.com>
2021-01-11 13:11:26 -06:00
6ba066fc9e [stable-2.10] Fix async interpreter parsing (#72636) (#72923)
Fixes #70690
(cherry picked from commit 83764ad)
2021-01-11 01:02:33 -06:00
b22d97b2c1 [stable-2.10] Fix string/bytestring comparsion in m_u.basic (#70439) (#73129)
Change:
- module_utils.basic.is_special_selinux_path() used a string ==
  bytestring comparison which returned False and made Ansible think that
  certain filesystems aren't, in fact, special-cased, when they should
  be. Ensure both sides of the == are bytestrings.

Test Plan:
- Added `copy` integration tests for this case.

Tickets:
- Fixes #70244

Signed-off-by: Rick Elrod <rick@elrod.me>.
(cherry picked from commit 688cd8657b)
2021-01-11 00:55:15 -06:00
1cd09b1ebc [stable-2.10] systemd - do not overwrite unit name when searching (#72985) (#73013)
PR #72702 introduced a bug that changed the unit name when splitting it up for the purpose
of searching for the unit. This only happens on unit file templates on systems that have a 5.8
or newer kernel and a version of systemd that does not contain a bugfix that causes systmed
to fail to parse dbus.

* Use facts rather than a manual probe to determine if systmed is present
* Remove unnecessary block
* Use vars files instead of set_fact
* Add tests for using a templated unit file
* Update changelog fragment
* Use template to get correct path to sleep binary
(cherry picked from commit 48803604cd)

Co-authored-by: Sam Doooran <sdoran@redhat.com>
2021-01-11 00:47:00 -06:00
cf21e699d4 Update ansible-test pylint Python support. (#72997)
* Rename pylint plugin and add tests. (#70225)
* Update ansible-test pylint Python support. (#72972)
* Add integration tests for sanity test failures.
(cherry picked from commit fa48678a08)

* Python 3.8 is now officially supported.
* Python 3.9 is now skipped with a warning.
(cherry picked from commit 37d09f2488)

* Allow key None to prevent errors with import test.
(cherry picked from commit dbc2c996ab)

Backport of https://github.com/ansible/ansible/pull/73003

Co-authored-by: Felix Fontein <felix@fontein.de>
2021-01-11 00:46:21 -06:00
31ef9dffa1 [stable-2.10] Remove exit code from traps in tests (#72968)
Having the trap exit with a specific code will override
the exit code that caused the trap to run, which could
mask errors
(cherry picked from commit 5157a92139)

Co-authored-by: Sam Doran <sdoran@redhat.com>
2021-01-11 00:42:18 -06:00
c5248f756c Collection list site packages (#70173) (#72940)
* ansible-galaxy collection list and verify now utilize collections in site-packages.

This is a short term fix for #70147.  The long term fix needs to handle
install (but that discussion is also bound up in how upgrade is going to
work and where things can get installed so it's deferred for 2.11.)

* Add test for ansible-galaxy collection list with site-packages

Co-authored-by: David Moreau Simard <moi@dmsimard.com>
Co-authored-by: Jordan Borean <jborean93@gmail.com>
(cherry picked from commit e7dee73774)

Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
2021-01-11 00:41:56 -06:00
511ffdeff7 [stable-2.10] Fix reset_connection paramiko, winrm, psrp (#72688) (#72925)
* Ensure we only reset the connection when one has been previously established. Fixes #65812

* Ensure psrp doesn't trace

* winrm too

* Indentation fix
(cherry picked from commit a3b6485)

Co-authored-by: Matt Martz <matt@sivel.net>
2021-01-11 00:36:05 -06:00
82b75282fc Fix task get_name to always prepend the role name (#72511) (#72919)
* Fix 'role_name : tast_name' notation if task contains role name

* Add tests for notifying handler names which contain the role name

Co-authored-by: Thomas Wouters <thomaswouters@gmail.com>
(cherry picked from commit 0ed7bfc694)
2021-01-11 00:28:57 -06:00
a5df30e2bf Use _wrap_native_text only for builtin STRING_TYPE_FILTERS (#71801) (#72915)
(cherry picked from commit 252685092c)
2021-01-11 00:22:01 -06:00
7006b62ff4 Documentation: fix modules doc formatting (#72851) 2021-01-10 23:25:48 -06:00
7c44c24456 modules: fix documentation formatting (#72737) (#72850)
(cherry picked from commit ebd8c101fd)
2021-01-10 23:25:13 -06:00
c4adf62220 Docsite: update "Migrating Ansible content to a different collection" info (#72710) (#72849)
* add a reminder about ignore-*.txt entries, fix formatting, add symlink removal note
* Update docs/docsite/rst/dev_guide/developing_collections.rst

Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: David Moreau Simard <moi@dmsimard.com>
Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com>
(cherry picked from commit 0a7fcd135c)
2021-01-10 23:24:49 -06:00
9601d3ef20 Docsite: update complex_data_manipulation and playbooks_advanced_syntax rst files to use FQCNs (#72848) 2021-01-10 23:24:04 -06:00
2f3e9a38b6 Backport/2.10/73079 (#73165)
* Update apt.py, add an example that references the suggested workaround in #25414
(cherry picked from commit 1e1b8e7aca)
(cherry picked from commit 180bbfed6a)

* Added changelog fragment
2021-01-08 16:38:44 -06:00
4452d98662 Support venv in ansible-test virtualenv scripts (#73163)
* ansible-test - prefer venv over virtualenv on Python 3 (#73000)

Also pin virtualenv to 16.7.10 for older Mac OS X systems. This was the version being installed
anway with the previous constraint (<20).

On systems with Python 3, now prefer venv over virtualenv. Test to see if venv is functional since
some systems have a non-functional venv installation (such as Debian).

(cherry picked from commit 850a77f639)

* Make the new ansible-test venv behavior opt-in

Co-authored-by: Sam Doooran <sdoran@redhat.com>
2021-01-08 16:31:17 -06:00
17566d7a17 Documentation: fix modules doc formatting (#73037) 2021-01-08 13:19:05 -06:00
3df8811ace Remove inaccurate Vault documentation (#72938) (#72978)
This is not functionality that exists.
(cherry picked from commit 8450858651)
2021-01-08 13:04:51 -06:00
ee97763a3a [stable-2.10] Update azure pipelines container
(cherry picked from commit 0eb1e22cd9)

Co-authored-by: Sam Doran <sdoran@redhat.com>
2021-01-08 09:15:47 -08:00
4d231a86b7 Rewrite Docker scenario guide (#73069) (#73135)
(cherry picked from commit c9f28c1735)
2021-01-07 15:45:37 -06:00
2246e1a0fb [2.10] galaxy: Update example for git+file (#73115)
Use correct syntax for installation of role from local git repository. Fixes: #72217

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
(cherry picked from commit 776274143f)
2021-01-07 14:12:56 -06:00
dc8d0c4d62 Add link to all module and plugin indexes (#72743) (#73099)
* Add link to all module and plugin indexes, use glob setting for toctree.
* Adjust .gitignore
* Fix docs make clean: now that there's a static file in rst/collections, we have to be more
explicit about how we clean the generated files out of that directory.

Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
(cherry picked from commit b514200126)
2021-01-07 14:10:52 -06:00
6b935947c1 left a stray </div> by mistake (#73132) (#73133)
Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com>
(cherry picked from commit 1d8760779c)
2021-01-06 11:35:34 -06:00
26e207d344 remove doc survey banner (#73119) (#73125)
(cherry picked from commit 0a3c5d9dcc)

Co-authored-by: Sandra McCann <samccann@redhat.com>
2021-01-05 16:25:12 -06:00
db41f2e384 [stable-2.10] Constrain pexpect and ptyprocess (#73109)
The recent update of ptyprocess to 0.7.0 is incompatible with Python 2.6 and
is causing test failures.

* Add setup_pexpect role to expect test
(cherry picked from commit 003a9e890d)

Co-authored-by: Sam Doooran <sdoran@redhat.com>
2021-01-04 13:54:36 -08:00
8f71aead87 [stable-2.10] Update Azure Pipelines scripts and config. (#72986)
* Increase fetch depth to reduce the frequency of full test runs for out-of-date PRs.
* Update scripts to match those which will be used in collections.
(cherry picked from commit 3274e02fd8)

Co-authored-by: Matt Clay <mclay@redhat.com>
2020-12-15 17:05:13 -08:00
02e3e679a2 Update Ansible release version to v2.10.4.post0. 2020-12-14 20:26:43 -06:00
436d8a13b4 New release v2.10.4 2020-12-14 14:44:44 -06:00
12b33c79ee [stable-2.10] Fix cryptography constraints in ansible-test. (#72914) (#72922)
(cherry picked from commit 36ab3d1189)

Co-authored-by: Matt Clay <mclay@redhat.com>
2020-12-09 14:41:15 -06:00
7461f873ef add docs survey banner (#72907) (#72909)
* add docs survey banner, with date

(cherry picked from commit 6098793315)
2020-12-08 15:46:36 -06:00
c72d53218a Update Ansible release version to v2.10.4rc1.post0. 2020-12-08 09:22:14 -06:00
dc7faeaf6e New release v2.10.4rc1 2020-12-07 19:05:36 -06:00
1f55a3d15a avoid fatal exception on invalid collection name (#72296) (#72570)
* avoid fatal exception on invalid collection name used in ansible-doc filter

(cherry picked from commit 4f0e2fff95)
2020-12-07 18:37:01 -06:00
847a2c87e5 Fix AIX networks facts when nestat is either missing or has incorrect permissions (#72516) (#72713)
* Added check for none on netstat_path variable

* Added changelog

(cherry picked from commit e879f12fb9)
2020-12-07 18:31:29 -06:00
d852fa4135 remove redundant remote_user for local setting (#72507)
* remove redundant remote_user for local setting

  local action plugin already does and this also should fix
  fork/thread issue by removing use of pwd library

  fixes #59642

(cherry picked from commit 488b9d6c35)

* ensure local exposes correct user (#72543)

* ensure local exposes correct user

  avoid corner case in which delegation relied on
  playcontext fallback which was removed

  fixes #72541

(cherry picked from commit aa4d53ccdf)
2020-12-07 18:30:58 -06:00
ab417f373a [stable-2.10] pause - do not hang if run in the background (#72065) (#72605)
* Consolidate logic for determining whether or not session is interactive
  into a single function, is_interactive()
* Increase test coverage

I wasn't able to find a good way of simulating running a backgrounded test with CI since the
whole test is essentially run not in a TTY, which is similar enough to cause the new is_interactive()
function to always return false.
(cherry picked from commit 4b8cb6582b)

Co-authored-by: Sam Doran <sdoran@redhat.com>
2020-12-07 18:08:56 -06:00
c67d7225e9 ansible-galaxy - source deps from all servers and not just parent - 2.10 (#72684)
* Added integration tests for this scenario

(cherry picked from commit fb092a82a1)

* Slight tweak to galaxy source selection (#72685)

(cherry picked from commit 18e5628b19)
2020-12-07 18:08:23 -06:00
71ef981191 Backport/2.10/72390 (#72690)
* Return error if cwd directory does not exist (#72390)

* Return warning or error if cwd directory does not exist, in AnsibleModule.run_command()

(cherry picked from commit 5654de6fce)

* added flag in run_command signature to control behaviour when cwd does not exist
2020-12-07 18:07:29 -06:00
7f1ee07634 [stable-2.10] iptables: Reorder comment postition (#71496) (#72548)
(cherry picked from commit c1da427a5e)

Co-authored-by: Amin Vakil <info@aminvakil.com>
2020-12-07 17:34:32 -06:00
2a6b411a80 [stable-2.10] ansible-test - skip installing PowerShell sanity test reqs if they are already installed (#72423) (#72424)
(cherry picked from commit 809d5fc398)

Co-authored-by: Jordan Borean <jborean93@gmail.com>
2020-12-07 17:33:52 -06:00
4e34aa0c19 [stable-2.10] wait_for - ignore psutil related errors (#72401) (#72406)
When enumerating connections with psutil, catch and ignore errors to avoid returning a stack trace.

Co-authored-by:  Matt Martz <matt@sivel.net>
(cherry picked from commit fb09fd2a23)
2020-12-07 17:33:34 -06:00
c422bc64dc [stable-2.10] blockinfile - properly insert block when no trailing new line exists (#72350) (#72360)
(cherry picked from commit c51438312a)

Co-authored-by: Sam Doran <sdoran@redhat.com>
2020-12-07 17:32:56 -06:00
19bffccd36 [stable-2.10] systemd - fix issue with capbpf and newer kernel (#72337) (#72347)
* [stable-2.10] systemd - fix issue with capbpf and newer kernel (#72337)

A bug existed in systemd 245 that did not properly handle unknown kernel
capabilities gracefully. This resulted in incomplete output when querying
for the service status. It is possible to get service status by other means.
This PR works around this issue by getting service status using other commands
in the event of a failure due to this bug.
(cherry picked from commit db84e2c989)

Co-authored-by: Sam Doran <sdoran@redhat.com>

* [stable-2.10] systemd - use list-unit-files rather than list-units (#72363)

list-unit-files will return all files on the system. list-units omits those
that are disabled.

Co-authored-by: Ken Dreyer <ktdreyer@ktdreyer.com>
(cherry picked from commit d6115887fa)

* systemd - account for templated unit files when searching for service (#72702)

Related to issue #71528 and PR #72337

Co-authored-by: Martin Polden <mpolden@mpolden.no>
(cherry picked from commit a788ea0132)
2020-12-07 17:03:12 -06:00
2ff5bf0f21 Fix processing of add_file_common_args=True when argument_spec is not specified as kwarg. (#72334) (#72361)
(cherry picked from commit 233e7beb5b)
2020-12-07 17:01:33 -06:00
42da480721 ansible-doc: export has_action when --json is used (#72359) (#72414)
* ansible-doc: export has_action when --json is used.
* Remove docuri and now_data, which were not used resp. ignored in format_plugin_doc and the functions it calls anyway.
* Add function _combine_plugin_doc.

(cherry picked from commit 4fb336cef1)
2020-12-07 16:59:33 -06:00
27f547b4d3 [2.10] Fix missing ansible.builtin FQCNs in hardcoded action names (#72457)
* Fix missing ansible.builtin FQCNs in hardcoded action names (#71824)

* Make sure hard-coded action names also check for FQCN.
* Use _add_internal_fqcn() to avoid hardcoded lists and typoes.

(cherry picked from commit da60525610)

* Replace some more FQCNs.

(cherry picked from commit 72302dd611)
2020-12-07 16:59:12 -06:00
07cdb709ae Adjust action groups to moved modules (#72428) (#72496)
* Support docker and k8s action groups for moved modules in community.docker and community.kubevirt.

* Also support k8s action group for community.okd.

* Also add kubernetes.core.

* Fix changelog fragment.

* Remove community.okd.

* Revert "Remove community.okd."

This reverts commit 812b5aa6e2.

(cherry picked from commit c7a4b39633)
2020-12-07 16:58:42 -06:00
ba25a1cdf1 [stable-2.10] AnsibleModule.set_mode_if_different: handle symlink is in a sticky directory (#45198) (#72863)
* file: add symlink is in a sticky directory tests
* file: handle symlink in a sticky directory

Co-Authored-By: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>

* Add changelog and fix unit test
The builtins import was removed since it was unused, but it is now needed.
(cherry picked from commit b464d18fd1)

Co-authored-by: Pilou <pierre-louis.bonicoli@libregerbil.fr>
2020-12-07 16:52:40 -06:00
6dc2e9c2f4 [2.10] The implicit default for type=bool options is not 'false', but 'none' (#72864)
* The implicit default for type=bool options is not 'false', but 'none' (#72699)

* Fix modules, resp. add ignore.txt entries.

(cherry picked from commit 5226ac5778)

* Add ignore.txt entries and fix deprecated option that was already removed in 2.11.
2020-12-07 16:51:35 -06:00
a15550c0c8 ansible-test sanity: fix UnicodeDecodeError for --python 2.7 --docker (#72623) (#72865)
* Store target paths as unicode.

* Add changelog fragment.

(cherry picked from commit f94ba68d8f)
2020-12-07 16:48:19 -06:00
138a5bd2d6 [2.10] Improve deprecations (#72871)
* Improve deprecations (#72697)

* Remove space before comma in '... bla , use ...'

* 'why' is inserted in the middle of a sentence, between two commas.

* Make deprecations from base.yml show source ansible-core.

* Add changelog fragment.

* Improve some more 'why's.

* Add PR URL to fragment.

(cherry picked from commit f569d80fde)

* 2.10 is ansible-base, not ansible-core
2020-12-07 16:47:38 -06:00
856a932ca0 [stable-2.10] Remove shippable.yml.
(cherry picked from commit 711064a073)

Co-authored-by: Matt Clay <matt@mystile.com>
2020-12-07 14:44:44 -08:00
7e2faa25d7 Improve ansible-test classifications for collections (#72353)
(cherry picked from commit 64a809d2b6)
2020-12-03 17:27:29 -08:00
dbdacbd48c [stable-2.10] Use AZP config for integration-aliases test.
No changelog entry since this test is limited to the ansible/ansible repo.

Backport of https://github.com/ansible/ansible/pull/72842
2020-12-03 16:17:21 -08:00
7813b1248b [stable-2.10] Fix Azure Pipelines change detection. (#72824)
(cherry picked from commit 08842cd6bb)

Co-authored-by: Matt Clay <mclay@redhat.com>
2020-12-03 10:10:08 -08:00
eb4f30cd03 [stable-2.10] Fix CI schedule. 2020-12-02 20:49:13 -08:00
2d5f549a98 update PyPI badge to use ansible-base (#72814) 2020-12-02 18:26:58 -08:00
a1288def89 update build badge for AZP (#72807) (#72810)
(cherry picked from commit d567a553a9)
2020-12-02 17:27:43 -08:00
99d5afaad0 [stable-2.10] Azure Pipelines configuration. 2020-12-02 14:57:34 -08:00
0d7ab375eb [centos6] update container for EOL (#72795)
Change:
- Reference:
  https://lists.centos.org/pipermail/centos-devel/2020-December/056208.html
- Bump centos6 container to 1.25.0

Test Plan:
- ci_complete

Signed-off-by: Rick Elrod <rick@elrod.me>
2020-12-02 16:04:38 -06:00
7802ca2b06 Add RHEL 7.9 (#72558) - 2.10 (#72568)
* Add RHEL 7.9 - ci_complete (#72558)

(cherry picked from commit d451433e5d)

* Added changelog for RHEL 7.9 (#72572)

(cherry picked from commit bdd0c48837)
2020-12-01 12:51:15 -08:00
6322630360 [stable-2.10] ansible-test - add cryptography constraint for cffi (#72761)
The recently released version of cffi fails to install on systems with an older version of gcc. In
our case, this in the CentOS 6 test image. There is a fix but it has not yet been released.

https://foss.heptapod.net/pypy/cffi/-/issues/480
(cherry picked from commit 1db9588279)

Co-authored-by: Sam Doran <sdoran@redhat.com>
2020-12-01 09:49:17 -08:00
3297c221f1 Test pip fix (#72764)
(cherry picked from commit 2eb9795543)
2020-12-01 10:36:48 -06:00
633396c71b Update playbooks_filters_ipaddr.rst (#72705) (#72755)
Fix the order of the arguments for ansible.netcommon.reduce_on_network. Pass the network as the argument and the list of IP addresses as the filter input.

(cherry picked from commit 454ac6420e)

Co-authored-by: Pablo Martinez <pablo@docecosas.com>
2020-11-30 15:25:22 -06:00
8bdda8792d Remove incorrect changelog (#72682)
* also remove offending code
2020-11-30 10:02:26 -06:00
581337a6d5 [stable-2.10] Fix super annoying Python 2.6 multiprocessing.Queue stack trace in CI (#72604) (#72608)
* Fix super annoying Python 2.6 multiprocessing.Queue stack trace in CI

A bug exists in Python 2.6 that sometimes raises an exception during interpreter shutdown. We
encounter this frequently in our CI since we run tests on CentOS 6 as the control node, which
has Python 2.6.6 with this bug.

This PR adds a very minor sleep only on Python 2.6 which gets around this issue. I did lot of testing
using a standalon script I found that easily duplicated the issue to find the minimum sleep value
needed to avoid this issue.

CPython issue: https://bugs.python.org/issue4106
Fix in CPython: https://hg.python.org/cpython/rev/d316315a8781

* Use correct attribute
(cherry picked from commit bbef250c2b)

Co-authored-by: Sam Doran <sdoran@redhat.com>
2020-11-20 13:10:11 -06:00
ed78b479ec Improve argument spec documentation (#72335) (#72486)
* Link to argument spec documentation from 'Creating a module'.

* Use items instead of sub-headings.

* Update deprecation information.

* Document conditional requirements.

* Document supports_check_mode and add_file_common_args.

* Add deprecation examples.

* Re-add word.

* Improve title.

* Fix RST formatting, add conditional dependency section starter.

(cherry picked from commit 01d207a3e3)
2020-11-13 15:17:31 -06:00
913aebb140 Docsite: update user_guide/playbooks_module_defaults (#72051) (#72493)
* Docsite: update user_guide/playbooks_module_defaults, add name: lines and use FQCN consistently
(cherry picked from commit dbe43e071e)
2020-11-13 14:51:37 -06:00
fc4411adcd Improve config.rst formatting (#72354) (#72487)
* Indent Jinja2 directives.

* Show version_added and deprecations for ini settings and environment variables.

* Make default conditional, add choices. Copied from #55474.

* Add Ansible variables. Copied from #55474.

* Turn ini keys and environment variables into lists. Copied from #55474.

* Improve formatting. Copied from #55474.

(cherry picked from commit 569d937df8)
2020-11-13 14:31:32 -06:00
cfa8075537 [stable-2.10] Add coverage exporting to ansible-test
A new `--export` option for `ansible-test coverage combine` allows multi-step aggregation of code coverage for CI pipelines.
(cherry picked from commit fa2be89cd4)

Co-authored-by: Matt Clay <matt@mystile.com>
2020-11-09 23:29:39 -08:00
8f767f7180 [stable-2.10] Fix container discovery for the acme test plugin.
(cherry picked from commit f022dedd0a)

Co-authored-by: Matt Clay <matt@mystile.com>
2020-11-09 15:30:07 -08:00
5bd0df7621 [ansible-test] use newer container images (#72126) (#72550)
Change:
- Bump default, ansible-base, distro containers
- We do NOT add fedora33 yet, because it doesn't work right on Shippable
  due to an old kernel. This will be added post-AZP.

Test Plan:
- CI

Signed-off-by: Rick Elrod <rick@elrod.me>
(cherry picked from commit e7bf0696ef)
2020-11-09 14:23:48 -06:00
81ce0f8fc4 Remove sanity ignores 2020-11-06 11:47:09 -06:00
1f5afcd072 Various intentional tests (#72485)
* Add tests for argspec choices type=list

* Add explicit interpreter discovery tests to validate modules returning ansible_facts still set interp

* Add explicit tests for missing_required_lib

* Add explicit tests for recursive_diff

* ci_complete ci_coverage

* Update data to cover more code/tests

* ci_complete ci_coverage

* Add argspec tests for aliases, and no_log

* Forgotten file

* ci_complete ci_coverage

* Add argspec tests for type int

* ci_complete ci_coverage

* Remove incidental_k8s

* ci_complete ci_coverage

* fix missing newline

* Remove incidental_sts_assume_role

* ci_complete ci_coverage

(cherry picked from commit c8590c7482)
2020-11-06 11:47:09 -06:00
65470f48bd Remove incidental tower integration tests (#72461)
* Add explicit test for dict repr in argspec

* Add explicit test for undefined repr

* ci_complete ci_coverage

* Skip old jinja2

* ci_complete ci_coverage

* Remove incidental_tower_receive

* ci_complete ci_coverage

* Remove incidental_tower_credential_type

* ci_complete ci_coverage

* Remove ignore entries

* ci_complete ci_coverage

(cherry picked from commit 880087748c)
2020-11-06 11:47:09 -06:00
e555358c32 Remove incidental vmware tests (#72420)
* Add explicit tests for ansible.module_utils.common.network.is_mac

* Test missing ANSIBLE_CONFIG

* Add explicit inventory script tests

* Add explicit tests for _consume_options

* Adjust perms, remove extra file

* ci_complete ci_coverage

* remove incidental_inventory_vmware_vm_inventory

* ci_complete ci_coverage

* Remove incidental_script_inventory_vmware_inventory

* ci_complete ci_coverage

* Remove incidental_vmware_guest

* ci_complete ci_coverage

* Remove incidental_vmware_host_hyperthreading and incidental_vmware_prepare_tests

* ci_complete ci_coverage

* newline and comment about what the test is doing

* ci_complete ci_coverage

(cherry picked from commit ccc63abc8e)
2020-11-06 11:47:09 -06:00
5b5870886b Remove incidental_cs_role_permission (#72380)
* Add explicit argspec tests for choices

* ci_complete ci_coverage

* Remove incidental_cs_role_permission

* ci_complete ci_coverage

* ci_complete ci_coverage

(cherry picked from commit 6543c7bc5d)
2020-11-06 11:47:09 -06:00
73991233fb Remove incidental_zabbix_host (#72142)
* Add explicit apt tests for fnmatch and update_cache

* Add explicit apt_key tests for fetching key directly from url

* ci_complete ci_coverage

* Remove repo only by repo

* ci_complete ci_coverage

* Add apt cache update after apt_repository to show that the cache doesn't update

* ci_complete ci_coverage

* Add systemd tests for enabling and disabling a service

* ci_complete ci_coverage

* Remove incidental_zabbix_host

* ci_complete ci_coverage

(cherry picked from commit 2f8dbf673e)
2020-11-06 11:47:09 -06:00
dca64d3c74 Remove incidental_aws_codebuild (#72140)
* Remove incidental_aws_codebuild

* ci_complete ci_coverage

(cherry picked from commit cf0cd4b50b)
2020-11-06 11:47:09 -06:00
ce47796db9 Add info on how to contribute to **community**-maintained collections as well. (#72494) (#72512)
(cherry picked from commit da1c1e8bb8)
2020-11-06 11:42:18 -06:00
8c5910efe7 [stable-2.10] [dnf] Some fixes around filtering (#72483) (#72500)
* [stable-2.10] [dnf] Some fixes around filtering (#72483)

Change:
- Docs: Add note that security/bugfix apply to dependencies too, like
  the dnf command.

- dnf: security/bugfix only makes sense for updates, so limit the
  package query sack to available updates.

- tests: Limit tests to our known-good test packages, so that RHEL
  packages marked security/bugfix without similarly marked dependencies
  don't fail our tests.

Test Plan:
- Tested with `dnf upgrade-minimal --bugfix` and reproduced the same
  error currently seen in CI, showing that we are consistent with what
  dnf does.

Tickets:
- Likely fixes #72316

Signed-off-by: Rick Elrod <rick@elrod.me>
(cherry picked from commit d8c637da37)

Co-authored-by: Rick Elrod <rick@elrod.me>

* Add changelog (#72502)

(cherry picked from commit b33d7e2e29)

Co-authored-by: Rick Elrod <rick@elrod.me>
2020-11-06 08:56:18 -06:00
31ab3d8a64 clarify upstream release status of 2.10 (#72269) (#72489)
* clarify upstream release status of 2.10

(cherry picked from commit d76f85208d)
2020-11-05 14:34:53 -06:00
10871f3246 Update Ansible release version to v2.10.3.post0. 2020-11-02 19:04:58 -06:00
597 changed files with 8301 additions and 24765 deletions

View File

@ -0,0 +1,256 @@
trigger:
batch: true
branches:
include:
- devel
- stable-*
pr:
autoCancel: true
branches:
include:
- devel
- stable-*
schedules:
- cron: 0 7 * * *
displayName: Nightly
always: true
branches:
include:
- devel
- stable-*
variables:
- name: checkoutPath
value: ansible
- name: coverageBranches
value: devel
- name: pipelinesCoverage
value: coverage
- name: entryPoint
value: test/utils/shippable/shippable.sh
- name: fetchDepth
value: 500
resources:
containers:
- container: default
image: quay.io/ansible/azure-pipelines-test-container:1.7.1
pool: Standard
stages:
- stage: Sanity
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
nameFormat: Test {0}
testFormat: sanity/{0}
targets:
- test: 1
- test: 2
- test: 3
- test: 4
- test: 5
- stage: Units
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
nameFormat: Python {0}
testFormat: units/{0}
targets:
- test: 2.6
- test: 2.7
- test: 3.5
- test: 3.6
- test: 3.7
- test: 3.8
- test: 3.9
- stage: Windows
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
nameFormat: Server {0}
testFormat: windows/{0}/1
targets:
- test: 2012
- test: 2012-R2
- test: 2016
- test: 2019
- stage: Remote
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
targets:
- name: macOS 11.1
test: macos/11.1
- name: RHEL 7.9
test: rhel/7.9
- name: RHEL 8.2
test: rhel/8.2
- name: FreeBSD 11.1
test: freebsd/11.1
- name: FreeBSD 12.1
test: freebsd/12.1
groups:
- 1
- 2
- 3
- 4
- 5
- stage: Docker
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
testFormat: linux/{0}
targets:
- name: CentOS 6
test: centos6
- name: CentOS 7
test: centos7
- name: CentOS 8
test: centos8
- name: Fedora 31
test: fedora31
- name: Fedora 32
test: fedora32
- name: openSUSE 15 py2
test: opensuse15py2
- name: openSUSE 15 py3
test: opensuse15
- name: Ubuntu 16.04
test: ubuntu1604
- name: Ubuntu 18.04
test: ubuntu1804
- name: Ubuntu 20.04
test: ubuntu2004
groups:
- 1
- 2
- 3
- 4
- 5
- stage: Fallaxy
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
nameFormat: Python {0}
testFormat: fallaxy/{0}/1
targets:
- test: 2.7
- test: 3.6
- stage: Generic
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
nameFormat: Python {0}
testFormat: generic/{0}/1
targets:
- test: 2.7
- test: 3.6
- stage: Incidental_Remote
displayName: Incidental Remote
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
testFormat: i/{0}
targets:
- name: OS X 10.11
test: osx/10.11
- name: RHEL 7.9
test: rhel/7.9
- name: RHEL 8.2
test: rhel/8.2
- name: FreeBSD 11.1
test: freebsd/11.1
- name: FreeBSD 12.1
test: freebsd/12.1
- stage: Incidental_Docker
displayName: Incidental Docker
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
testFormat: i/linux/{0}
targets:
- name: CentOS 6
test: centos6
- name: CentOS 7
test: centos7
- name: CentOS 8
test: centos8
- name: Fedora 31
test: fedora31
- name: Fedora 32
test: fedora32
- name: openSUSE 15 py2
test: opensuse15py2
- name: openSUSE 15 py3
test: opensuse15
- name: Ubuntu 16.04
test: ubuntu1604
- name: Ubuntu 18.04
test: ubuntu1804
- name: Ubuntu 20.04
test: ubuntu2004
- stage: Incidental_Windows
displayName: Incidental Windows
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
nameFormat: Server {0}
testFormat: i/windows/{0}
targets:
- test: 2012
- test: 2012-R2
- test: 2016
- test: 2019
- stage: Incidental
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
testFormat: i/{0}/1
targets:
- name: IOS Python
test: ios/csr1000v/
- name: VyOS Python 2.7
test: vyos/1.1.8/2.7
- name: VyOS Python 3.6
test: vyos/1.1.8/3.6
- name: AWS Python 2.7
test: aws/2.7
- name: AWS Python 3.6
test: aws/3.6
- name: Azure Python 2.7
test: azure/2.7
- name: Azure Python 3.6
test: azure/3.6
- name: Cloud Python
test: cloud/
- stage: Summary
condition: succeededOrFailed()
dependsOn:
- Sanity
- Units
- Windows
- Remote
- Docker
- Fallaxy
- Generic
- Incidental_Remote
- Incidental_Docker
- Incidental_Windows
- Incidental
jobs:
- template: templates/coverage.yml

View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
# Aggregate code coverage results for later processing.
set -o pipefail -eu
agent_temp_directory="$1"
PATH="${PWD}/bin:${PATH}"
mkdir "${agent_temp_directory}/coverage/"
options=(--venv --venv-system-site-packages --color -v)
ansible-test coverage combine --export "${agent_temp_directory}/coverage/" "${options[@]}"
if ansible-test coverage analyze targets generate --help >/dev/null 2>&1; then
# Only analyze coverage if the installed version of ansible-test supports it.
# Doing so allows this script to work unmodified for multiple Ansible versions.
ansible-test coverage analyze targets generate "${agent_temp_directory}/coverage/coverage-analyze-targets.json" "${options[@]}"
fi

View File

@ -0,0 +1,60 @@
#!/usr/bin/env python
"""
Combine coverage data from multiple jobs, keeping the data only from the most recent attempt from each job.
Coverage artifacts must be named using the format: "Coverage $(System.JobAttempt) {StableUniqueNameForEachJob}"
The recommended coverage artifact name format is: Coverage $(System.JobAttempt) $(System.StageDisplayName) $(System.JobDisplayName)
Keep in mind that Azure Pipelines does not enforce unique job display names (only names).
It is up to pipeline authors to avoid name collisions when deviating from the recommended format.
"""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re
import shutil
import sys
def main():
"""Main program entry point."""
source_directory = sys.argv[1]
if '/ansible_collections/' in os.getcwd():
output_path = "tests/output"
else:
output_path = "test/results"
destination_directory = os.path.join(output_path, 'coverage')
if not os.path.exists(destination_directory):
os.makedirs(destination_directory)
jobs = {}
count = 0
for name in os.listdir(source_directory):
match = re.search('^Coverage (?P<attempt>[0-9]+) (?P<label>.+)$', name)
label = match.group('label')
attempt = int(match.group('attempt'))
jobs[label] = max(attempt, jobs.get(label, 0))
for label, attempt in jobs.items():
name = 'Coverage {attempt} {label}'.format(label=label, attempt=attempt)
source = os.path.join(source_directory, name)
source_files = os.listdir(source)
for source_file in source_files:
source_path = os.path.join(source, source_file)
destination_path = os.path.join(destination_directory, source_file + '.' + label)
print('"%s" -> "%s"' % (source_path, destination_path))
shutil.copyfile(source_path, destination_path)
count += 1
print('Coverage file count: %d' % count)
print('##vso[task.setVariable variable=coverageFileCount]%d' % count)
print('##vso[task.setVariable variable=outputPath]%s' % output_path)
if __name__ == '__main__':
main()

View File

@ -0,0 +1,24 @@
#!/usr/bin/env bash
# Check the test results and set variables for use in later steps.
set -o pipefail -eu
if [[ "$PWD" =~ /ansible_collections/ ]]; then
output_path="tests/output"
else
output_path="test/results"
fi
echo "##vso[task.setVariable variable=outputPath]${output_path}"
if compgen -G "${output_path}"'/junit/*.xml' > /dev/null; then
echo "##vso[task.setVariable variable=haveTestResults]true"
fi
if compgen -G "${output_path}"'/bot/ansible-test-*' > /dev/null; then
echo "##vso[task.setVariable variable=haveBotResults]true"
fi
if compgen -G "${output_path}"'/coverage/*' > /dev/null; then
echo "##vso[task.setVariable variable=haveCoverageData]true"
fi

View File

@ -0,0 +1,27 @@
#!/usr/bin/env bash
# Upload code coverage reports to codecov.io.
# Multiple coverage files from multiple languages are accepted and aggregated after upload.
# Python coverage, as well as PowerShell and Python stubs can all be uploaded.
set -o pipefail -eu
output_path="$1"
curl --silent --show-error https://codecov.io/bash > codecov.sh
for file in "${output_path}"/reports/coverage*.xml; do
name="${file}"
name="${name##*/}" # remove path
name="${name##coverage=}" # remove 'coverage=' prefix if present
name="${name%.xml}" # remove '.xml' suffix
bash codecov.sh \
-f "${file}" \
-n "${name}" \
-X coveragepy \
-X gcov \
-X fix \
-X search \
-X xcode \
|| echo "Failed to upload code coverage report to codecov.io: ${file}"
done

View File

@ -0,0 +1,15 @@
#!/usr/bin/env bash
# Generate code coverage reports for uploading to Azure Pipelines and codecov.io.
set -o pipefail -eu
PATH="${PWD}/bin:${PATH}"
if ! ansible-test --help >/dev/null 2>&1; then
# Install the devel version of ansible-test for generating code coverage reports.
# This is only used by Ansible Collections, which are typically tested against multiple Ansible versions (in separate jobs).
# Since a version of ansible-test is required that can work the output from multiple older releases, the devel version is used.
pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check
fi
ansible-test coverage xml --stub --venv --venv-system-site-packages --color -v

View File

@ -0,0 +1,34 @@
#!/usr/bin/env bash
# Configure the test environment and run the tests.
set -o pipefail -eu
entry_point="$1"
test="$2"
read -r -a coverage_branches <<< "$3" # space separated list of branches to run code coverage on for scheduled builds
export COMMIT_MESSAGE
export COMPLETE
export COVERAGE
export IS_PULL_REQUEST
if [ "${SYSTEM_PULLREQUEST_TARGETBRANCH:-}" ]; then
IS_PULL_REQUEST=true
COMMIT_MESSAGE=$(git log --format=%B -n 1 HEAD^2)
else
IS_PULL_REQUEST=
COMMIT_MESSAGE=$(git log --format=%B -n 1 HEAD)
fi
COMPLETE=
COVERAGE=
if [ "${BUILD_REASON}" = "Schedule" ]; then
COMPLETE=yes
if printf '%s\n' "${coverage_branches[@]}" | grep -q "^${BUILD_SOURCEBRANCHNAME}$"; then
COVERAGE=yes
fi
fi
"${entry_point}" "${test}" 2>&1 | "$(dirname "$0")/time-command.py"

View File

@ -0,0 +1,25 @@
#!/usr/bin/env python
"""Prepends a relative timestamp to each input line from stdin and writes it to stdout."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
import time
def main():
"""Main program entry point."""
start = time.time()
sys.stdin.reconfigure(errors='surrogateescape')
sys.stdout.reconfigure(errors='surrogateescape')
for line in sys.stdin:
seconds = time.time() - start
sys.stdout.write('%02d:%02d %s' % (seconds // 60, seconds % 60, line))
sys.stdout.flush()
if __name__ == '__main__':
main()

View File

@ -0,0 +1,39 @@
# This template adds a job for processing code coverage data.
# It will upload results to Azure Pipelines and codecov.io.
# Use it from a job stage that completes after all other jobs have completed.
# This can be done by placing it in a separate summary stage that runs after the test stage(s) have completed.
jobs:
- job: Coverage
displayName: Code Coverage
container: default
workspace:
clean: all
steps:
- checkout: self
fetchDepth: $(fetchDepth)
path: $(checkoutPath)
- task: DownloadPipelineArtifact@2
displayName: Download Coverage Data
inputs:
path: coverage/
patterns: "Coverage */*=coverage.combined"
- bash: .azure-pipelines/scripts/combine-coverage.py coverage/
displayName: Combine Coverage Data
- bash: .azure-pipelines/scripts/report-coverage.sh
displayName: Generate Coverage Report
condition: gt(variables.coverageFileCount, 0)
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
# Azure Pipelines only accepts a single coverage data file.
# That means only Python or PowerShell coverage can be uploaded, but not both.
# Set the "pipelinesCoverage" variable to determine which type is uploaded.
# Use "coverage" for Python and "coverage-powershell" for PowerShell.
summaryFileLocation: "$(outputPath)/reports/$(pipelinesCoverage).xml"
displayName: Publish to Azure Pipelines
condition: gt(variables.coverageFileCount, 0)
- bash: .azure-pipelines/scripts/publish-codecov.sh "$(outputPath)"
displayName: Publish to codecov.io
condition: gt(variables.coverageFileCount, 0)
continueOnError: true

View File

@ -0,0 +1,55 @@
# This template uses the provided targets and optional groups to generate a matrix which is then passed to the test template.
# If this matrix template does not provide the required functionality, consider using the test template directly instead.
parameters:
# A required list of dictionaries, one per test target.
# Each item in the list must contain a "test" or "name" key.
# Both may be provided. If one is omitted, the other will be used.
- name: targets
type: object
# An optional list of values which will be used to multiply the targets list into a matrix.
# Values can be strings or numbers.
- name: groups
type: object
default: []
# An optional format string used to generate the job name.
# - {0} is the name of an item in the targets list.
- name: nameFormat
type: string
default: "{0}"
# An optional format string used to generate the test name.
# - {0} is the name of an item in the targets list.
- name: testFormat
type: string
default: "{0}"
# An optional format string used to add the group to the job name.
# {0} is the formatted name of an item in the targets list.
# {{1}} is the group -- be sure to include the double "{{" and "}}".
- name: nameGroupFormat
type: string
default: "{0} - {{1}}"
# An optional format string used to add the group to the test name.
# {0} is the formatted test of an item in the targets list.
# {{1}} is the group -- be sure to include the double "{{" and "}}".
- name: testGroupFormat
type: string
default: "{0}/{{1}}"
jobs:
- template: test.yml
parameters:
jobs:
- ${{ if eq(length(parameters.groups), 0) }}:
- ${{ each target in parameters.targets }}:
- name: ${{ format(parameters.nameFormat, coalesce(target.name, target.test)) }}
test: ${{ format(parameters.testFormat, coalesce(target.test, target.name)) }}
- ${{ if not(eq(length(parameters.groups), 0)) }}:
- ${{ each group in parameters.groups }}:
- ${{ each target in parameters.targets }}:
- name: ${{ format(format(parameters.nameGroupFormat, parameters.nameFormat), coalesce(target.name, target.test), group) }}
test: ${{ format(format(parameters.testGroupFormat, parameters.testFormat), coalesce(target.test, target.name), group) }}

View File

@ -0,0 +1,45 @@
# This template uses the provided list of jobs to create test one or more test jobs.
# It can be used directly if needed, or through the matrix template.
parameters:
# A required list of dictionaries, one per test job.
# Each item in the list must contain a "job" and "name" key.
- name: jobs
type: object
jobs:
- ${{ each job in parameters.jobs }}:
- job: test_${{ replace(replace(replace(job.test, '/', '_'), '.', '_'), '-', '_') }}
displayName: ${{ job.name }}
container: default
workspace:
clean: all
steps:
- checkout: self
fetchDepth: $(fetchDepth)
path: $(checkoutPath)
- bash: .azure-pipelines/scripts/run-tests.sh "$(entryPoint)" "${{ job.test }}" "$(coverageBranches)"
displayName: Run Tests
- bash: .azure-pipelines/scripts/process-results.sh
condition: succeededOrFailed()
displayName: Process Results
- bash: .azure-pipelines/scripts/aggregate-coverage.sh "$(Agent.TempDirectory)"
condition: eq(variables.haveCoverageData, 'true')
displayName: Aggregate Coverage Data
- task: PublishTestResults@2
condition: eq(variables.haveTestResults, 'true')
inputs:
testResultsFiles: "$(outputPath)/junit/*.xml"
displayName: Publish Test Results
- task: PublishPipelineArtifact@1
condition: eq(variables.haveBotResults, 'true')
displayName: Publish Bot Results
inputs:
targetPath: "$(outputPath)/bot/"
artifactName: "Bot $(System.JobAttempt) $(System.StageDisplayName) $(System.JobDisplayName)"
- task: PublishPipelineArtifact@1
condition: eq(variables.haveCoverageData, 'true')
displayName: Publish Coverage Data
inputs:
targetPath: "$(Agent.TempDirectory)/coverage/"
artifactName: "Coverage $(System.JobAttempt) $(System.StageDisplayName) $(System.JobDisplayName)"

2
.github/BOTMETA.yml vendored
View File

@ -4553,8 +4553,6 @@ files:
notified: mattclay
hacking/shippable/:
notified: mattclay
shippable.yml:
notified: mattclay
lib/ansible/modules/cloud/podman/__init__.py:
migrated_to: containers.podman
lib/ansible/modules/cloud/podman/podman_container_info.py:

1
.gitignore vendored
View File

@ -38,6 +38,7 @@ docs/docsite/rst/dev_guide/collections_galaxy_meta.rst
docs/docsite/rst/dev_guide/testing/sanity/index.rst.new
docs/docsite/rst/modules/*.rst
docs/docsite/rst/collections/*.rst
!docs/docsite/rst/collections/all_plugins.rst
docs/docsite/rst/collections/*/*.rst
docs/docsite/rst/playbooks_directives.rst
docs/docsite/rst/plugins_by_category.rst

View File

@ -2,8 +2,8 @@ include README.rst
include COPYING
include SYMLINK_CACHE.json
include requirements.txt
include shippable.yml
recursive-include docs *
include docs/docsite/rst/collections/all_plugins.rst
exclude docs/docsite/rst_warnings
recursive-exclude docs/docsite/_build *
recursive-exclude docs/docsite/_extensions *.pyc *.pyo

View File

@ -96,12 +96,12 @@ GNU General Public License v3.0 or later
See `COPYING <COPYING>`_ to see the full text.
.. |PyPI version| image:: https://img.shields.io/pypi/v/ansible.svg
:target: https://pypi.org/project/ansible
.. |PyPI version| image:: https://img.shields.io/pypi/v/ansible-base.svg
:target: https://pypi.org/project/ansible-base
.. |Docs badge| image:: https://img.shields.io/badge/docs-latest-brightgreen.svg
:target: https://docs.ansible.com/ansible/latest/
.. |Build Status| image:: https://api.shippable.com/projects/573f79d02a8192902e20e34b/badge?branch=devel
:target: https://app.shippable.com/projects/573f79d02a8192902e20e34b
.. |Build Status| image:: https://dev.azure.com/ansible/ansible/_apis/build/status/CI?branchName=stable-2.10
:target: https://dev.azure.com/ansible/ansible/_build/latest?definitionId=20&branchName=stable-2.10
.. |Chat badge| image:: https://img.shields.io/badge/chat-IRC-brightgreen.svg
:target: https://docs.ansible.com/ansible/latest/community/communication.html
.. |Code Of Conduct| image:: https://img.shields.io/badge/code%20of%20conduct-Ansible-silver.svg

View File

@ -5,6 +5,140 @@ Ansible Base 2.10 "When the Levee Breaks" Release Notes
.. contents:: Topics
v2.10.6
=======
Release Summary
---------------
| Release Date: 2021-02-17
| `Porting Guide <https://docs.ansible.com/ansible/devel/porting_guides.html>`__
Minor Changes
-------------
- ansible-test - Added Ubuntu 20.04 LTS image to the default completion list
- inventory cache - do not show a warning when the cache file does not (yet) exist.
Security Fixes
--------------
- **security issue** - Mask default and fallback values for ``no_log`` module options (CVE-2021-20228)
Bugfixes
--------
- Added unsafe_writes test.
- Always mention the name of the deprecated or tombstoned plugin in routing deprecation/tombstone messages (https://github.com/ansible/ansible/pull/73059).
- Correct the inventory source error parse handling, specifically make the config INVENTORY_ANY_UNPARSED_IS_FAILED work as expected.
- Enabled unsafe_writes for get_url which was ignoring the paramter.
- Fix incorrect variable scoping when using ``import with context`` in Jinja2 templates. (https://github.com/ansible/ansible/issues/72615)
- Restored unsafe_writes functionality which was being skipped.
- allow become method 'su' to work on 'local' connection by allocating a fake tty.
- ansble-test - only require a collection name in deprecation warnings when necessary (https://github.com/ansible/ansible/pull/72987)
- ansible-test - Temporarily limit ``cryptography`` to versions before 3.4 to enable tests to function.
- ansible-test - The ``--remote`` option has been updated for Python 2.7 to work around breaking changes in the newly released ``get-pip.py`` bootstrapper.
- ansible-test - The ``--remote`` option has been updated to use a versioned ``get-pip.py`` bootstrapper to avoid issues with future releases.
- ansible-test sanity changelog test - bump dependency on antsibull-changelog to 0.9.0 so that `fragments that add new plugins or objects <https://github.com/ansible-community/antsibull-changelog/blob/main/docs/changelogs.rst#adding-new-roles-playbooks-test-and-filter-plugins>`_ will not fail validation (https://github.com/ansible/ansible/pull/73428).
- display correct error information when an error exists in the last line of the file (https://github.com/ansible/ansible/issues/16456)
- facts - properly report virtualization facts for Linux guests running on bhyve (https://github.com/ansible/ansible/issues/73167)
- git - Only pass ``--raw`` flag to git verify commands (verify-tag, verify-commit) when ``gpg_whitelist`` is in use. Otherwise don't pass it so that non-whitelist GPG validation still works on older Git versions. (https://github.com/ansible/ansible/issues/64469)
- import_playbook - change warning about extra parameters to deprecation (https://github.com/ansible/ansible/issues/72745)
- pause - do not warn when running in the background if a timeout is provided (https://github.com/ansible/ansible/issues/73042)
- psrp connection plugin - ``to_text(stdout)`` before ``json.loads`` in psrp.Connection.put_file in case ``stdout`` is bytes.
- validate-modules - do not raise an ``AttributeError`` if a value is assigned to a module attribute in a try/except block.
v2.10.5
=======
Release Summary
---------------
| Release Date: 2021-01-18
| `Porting Guide <https://docs.ansible.com/ansible/devel/porting_guides.html>`__
Minor Changes
-------------
- ansible-test - Changed the internal name of the custom plugin used to identify use of unwanted imports and functions.
- ansible-test - The ``pylint`` sanity test is now skipped with a warning on Python 3.9 due to unresolved upstream regressions.
- ansible-test - The ``pylint`` sanity test is now supported on Python 3.8.
- ansible-test - add macOS 11.1 as a remote target (https://github.com/ansible/ansible/pull/72622)
- ansible-test - remote macOS instances no longer install ``virtualenv`` during provisioning
- ansible-test - virtualenv helper scripts now prefer ``venv`` on Python 3 over ``virtualenv`` if the ``ANSIBLE_TEST_PREFER_VENV`` environment variable is set
Bugfixes
--------
- Apply ``_wrap_native_text`` only for builtin filters specified in STRING_TYPE_FILTERS.
- Documentation change to the apt module to reference lock files (https://github.com/ansible/ansible/issues/73079).
- Fix --list-tasks format `role_name : task_name` when task name contains the role name. (https://github.com/ansible/ansible/issues/72505)
- Fix ansible-galaxy collection list to show collections in site-packages (https://github.com/ansible/ansible/issues/70147)
- Fix bytestring vs string comparison in module_utils.basic.is_special_selinux_path() so that special-cased filesystems which don't support SELinux context attributes still allow files to be manipulated on them. (https://github.com/ansible/ansible/issues/70244)
- Fix notifying handlers via `role_name : handler_name` when handler name contains the role name. (https://github.com/ansible/ansible/issues/70582)
- async - Fix Python 3 interpreter parsing from module by comparing with bytes (https://github.com/ansible/ansible/issues/70690)
- inventory - pass the vars dictionary to combine_vars instead of an individual key's value (https://github.com/ansible/ansible/issues/72975).
- paramiko connection plugin - Ensure we only reset the connection when one has been previously established (https://github.com/ansible/ansible/issues/65812)
- systemd - preserve the full unit name when using a templated service and ``systemd`` failed to parse dbus due to a known bug in ``systemd`` (https://github.com/ansible/ansible/pull/72985)
- user - do the right thing when ``password_lock=True`` and ``password`` are used together (https://github.com/ansible/ansible/issues/72992)
v2.10.4
=======
Release Summary
---------------
| Release Date: 2020-12-14
| `Porting Guide <https://docs.ansible.com/ansible/devel/porting_guides.html>`__
Minor Changes
-------------
- ansible-doc - provide ``has_action`` field in JSON output for modules. That information is currently only available in the text view (https://github.com/ansible/ansible/pull/72359).
- ansible-galaxy - find any collection dependencies in the globally configured Galaxy servers and not just the server the parent collection is from.
- ansible-test - Added a ``--export`` option to the ``ansible-test coverage combine`` command to facilitate multi-stage aggregation of coverage in CI pipelines.
- ansible-test - Added the ``-remote rhel/7.9`` option to run tests on RHEL 7.9
- ansible-test - CentOS 8 container is now 8.2.2004 (https://github.com/ansible/distro-test-containers/pull/45).
- ansible-test - Fix container hostname/IP discovery for the ``acme`` test plugin.
- ansible-test - OpenSuse container now uses Leap 15.2 (https://github.com/ansible/distro-test-containers/pull/48).
- ansible-test - Ubuntu containers as well as ``default-test-container`` and ``ansible-base-test-container`` are now slightly smaller due to apt cleanup (https://github.com/ansible/distro-test-containers/pull/46).
- ansible-test - ``default-test-container`` and ``ansible-base-test-container`` now use Python 3.9.0 instead of 3.9.0rc1.
- ansible-test - centos6 end of life - container image updated to point to vault base repository (https://github.com/ansible/distro-test-containers/pull/54)
- ansible-test validate-modules - no longer assume that ``default`` for ``type=bool`` options is ``false``, as the default is ``none`` and for some modules, ``none`` and ``false`` mean different things (https://github.com/ansible/ansible/issues/69561).
- iptables - reorder comment postition to be at the end (https://github.com/ansible/ansible/issues/71444).
Bugfixes
--------
- Adjust various hard-coded action names to also include their ``ansible.builtin.`` and ``ansible.legacy.`` prefixed version (https://github.com/ansible/ansible/issues/71817, https://github.com/ansible/ansible/issues/71818, https://github.com/ansible/ansible/pull/71824).
- AnsibleModule - added arg ``ignore_invalid_cwd`` to ``AnsibleModule.run_command()``, to control its behaviour when ``cwd`` is invalid. (https://github.com/ansible/ansible/pull/72390)
- Fixed issue when `netstat` is either missing or doesn't have execution permissions leading to incorrect command being executed.
- Improve Ansible config deprecations to show the source of the deprecation (ansible-base). Also remove space before a comma in config deprecations (https://github.com/ansible/ansible/pull/72697).
- Skip invalid collection names when listing in ansible-doc instead of throwing exception. Issue#72257
- The ``docker`` and ``k8s`` action groups / module default groups now also support the moved modules in `community.docker <https://galaxy.ansible.com/community/docker>`_, `community.kubevirt <https://github.com/ansible-collections/community.kubevirt>`_, `community.okd <https://galaxy.ansible.com/community/okd>`_, and `kubernetes.core <https://galaxy.ansible.com/kubernetes/core>`_ (https://github.com/ansible/ansible/pull/72428).
- account for bug in Python 2.6 that occurs during interpreter shutdown to avoid stack trace
- ansible-test - Correctly detect changes in a GitHub pull request when running on Azure Pipelines.
- ansible-test - Skip installing requirements if they are already installed.
- ansible-test - ``cryptography`` is now limited to versions prior to 3.2 only when an incompatible OpenSSL version (earlier than 1.1.0) is detected
- ansible-test - add constraint for ``cffi`` to prevent failure on systems with older versions of ``gcc`` (https://foss.heptapod.net/pypy/cffi/-/issues/480)
- ansible-test - convert target paths to unicode on Python 2 to avoid ``UnicodeDecodeError`` (https://github.com/ansible/ansible/issues/68398, https://github.com/ansible/ansible/pull/72623).
- ansible-test - improve classification of changes to ``.gitignore``, ``COPYING``, ``LICENSE``, ``Makefile``, and all files ending with one of ``.in`, ``.md`, ``.rst``, ``.toml``, ``.txt`` in the collection root directory (https://github.com/ansible/ansible/pull/72353).
- ansible-test validate-modules - when a module uses ``add_file_common_args=True`` and does not use a keyword argument for ``argument_spec`` in ``AnsibleModule()``, the common file arguments were not considered added during validation (https://github.com/ansible/ansible/pull/72334).
- basic.AnsibleModule - AnsibleModule.run_command silently ignores a non-existent directory in the ``cwd`` argument (https://github.com/ansible/ansible/pull/72390).
- blockinfile - properly insert a block at the end of a file that does not have a trailing newline character (https://github.com/ansible/ansible/issues/72055)
- dnf - fix filtering to avoid dependncy conflicts (https://github.com/ansible/ansible/issues/72316)
- ensure 'local' connection always has the correct default user for actions to consume.
- pause - Fix indefinite hang when using a pause task on a background process (https://github.com/ansible/ansible/issues/32142)
- remove redundant remote_user setting in play_context for local as plugin already does it, also removes fork/thread issue from use of pwd library.
- set_mode_if_different - handle symlink if it is inside a directory with sticky bit set (https://github.com/ansible/ansible/pull/45198)
- systemd - account for templated unit files using ``@`` when searching for the unit file (https://github.com/ansible/ansible/pull/72347#issuecomment-730626228)
- systemd - follow up fix to https://github.com/ansible/ansible/issues/72338 to use ``list-unit-files`` rather than ``list-units`` in order to show all units files on the system.
- systemd - work around bug with ``systemd`` 245 and 5.8 kernel that does not correctly report service state (https://github.com/ansible/ansible/issues/71528)
- wait_for - catch and ignore errors when getting active connections with psutil (https://github.com/ansible/ansible/issues/72322)
v2.10.3
=======
@ -242,7 +376,6 @@ Minor Changes
- ansible-galaxy - Display message if both collections and roles are specified in a requirements file but can't be installed together.
- ansible-galaxy - Install both collections and roles with ``ansible-galaxy install -r requirements.yml`` in certain scenarios.
- ansible-galaxy - Requirement entries for collections now support a 'type' key to indicate whether the collection is a galaxy artifact, file, url, or git repo.
- ansible-galaxy - Support both 'galaxy.yml' and 'galaxy.yaml' files for collections.
- ansible-galaxy - add ``--token`` argument which is the same as ``--api-key`` (https://github.com/ansible/ansible/issues/65955)
- ansible-galaxy - add ``collection list`` command for listing installed collections (https://github.com/ansible/ansible/pull/65022)
- ansible-galaxy - add ``validate_collection_path()`` utility function ()

View File

@ -802,7 +802,6 @@ releases:
- ansible-galaxy - Requirement entries for collections now support a 'type'
key to indicate whether the collection is a galaxy artifact, file, url, or
git repo.
- ansible-galaxy - Support both 'galaxy.yml' and 'galaxy.yaml' files for collections.
- ansible-galaxy - add ``--token`` argument which is the same as ``--api-key``
(https://github.com/ansible/ansible/issues/65955)
- ansible-galaxy - add ``collection list`` command for listing installed collections
@ -2130,3 +2129,315 @@ releases:
- url-lookup-ini.yml
- v2.10.3rc1_summary.yaml
release_date: '2020-10-26'
2.10.4:
changes:
bugfixes:
- ansible-test - ``cryptography`` is now limited to versions prior to 3.2 only
when an incompatible OpenSSL version (earlier than 1.1.0) is detected
release_summary: '| Release Date: 2020-12-14
| `Porting Guide <https://docs.ansible.com/ansible/devel/porting_guides.html>`__
'
codename: When the Levee Breaks
fragments:
- ansible-test-constraints-cryptography.yml
- v2.10.4_summary.yaml
release_date: '2020-12-14'
2.10.4rc1:
changes:
bugfixes:
- Adjust various hard-coded action names to also include their ``ansible.builtin.``
and ``ansible.legacy.`` prefixed version (https://github.com/ansible/ansible/issues/71817,
https://github.com/ansible/ansible/issues/71818, https://github.com/ansible/ansible/pull/71824).
- AnsibleModule - added arg ``ignore_invalid_cwd`` to ``AnsibleModule.run_command()``,
to control its behaviour when ``cwd`` is invalid. (https://github.com/ansible/ansible/pull/72390)
- Fixed issue when `netstat` is either missing or doesn't have execution permissions
leading to incorrect command being executed.
- Improve Ansible config deprecations to show the source of the deprecation
(ansible-base). Also remove space before a comma in config deprecations (https://github.com/ansible/ansible/pull/72697).
- Skip invalid collection names when listing in ansible-doc instead of throwing
exception. Issue#72257
- The ``docker`` and ``k8s`` action groups / module default groups now also
support the moved modules in `community.docker <https://galaxy.ansible.com/community/docker>`_,
`community.kubevirt <https://github.com/ansible-collections/community.kubevirt>`_,
`community.okd <https://galaxy.ansible.com/community/okd>`_, and `kubernetes.core
<https://galaxy.ansible.com/kubernetes/core>`_ (https://github.com/ansible/ansible/pull/72428).
- account for bug in Python 2.6 that occurs during interpreter shutdown to avoid
stack trace
- ansible-test - Correctly detect changes in a GitHub pull request when running
on Azure Pipelines.
- ansible-test - Skip installing requirements if they are already installed.
- 'ansible-test - add constraint for ``cffi`` to prevent failure on systems
with older versions of ``gcc`` (https://foss.heptapod.net/pypy/cffi/-/issues/480)
'
- ansible-test - convert target paths to unicode on Python 2 to avoid ``UnicodeDecodeError``
(https://github.com/ansible/ansible/issues/68398, https://github.com/ansible/ansible/pull/72623).
- ansible-test - improve classification of changes to ``.gitignore``, ``COPYING``,
``LICENSE``, ``Makefile``, and all files ending with one of ``.in`, ``.md`,
``.rst``, ``.toml``, ``.txt`` in the collection root directory (https://github.com/ansible/ansible/pull/72353).
- ansible-test validate-modules - when a module uses ``add_file_common_args=True``
and does not use a keyword argument for ``argument_spec`` in ``AnsibleModule()``,
the common file arguments were not considered added during validation (https://github.com/ansible/ansible/pull/72334).
- basic.AnsibleModule - AnsibleModule.run_command silently ignores a non-existent
directory in the ``cwd`` argument (https://github.com/ansible/ansible/pull/72390).
- 'blockinfile - properly insert a block at the end of a file that does not
have a trailing newline character (https://github.com/ansible/ansible/issues/72055)
'
- dnf - fix filtering to avoid dependncy conflicts (https://github.com/ansible/ansible/issues/72316)
- ensure 'local' connection always has the correct default user for actions
to consume.
- 'pause - Fix indefinite hang when using a pause task on a background process
(https://github.com/ansible/ansible/issues/32142)
'
- remove redundant remote_user setting in play_context for local as plugin already
does it, also removes fork/thread issue from use of pwd library.
- 'set_mode_if_different - handle symlink if it is inside a directory with sticky
bit set (https://github.com/ansible/ansible/pull/45198)
'
- 'systemd - account for templated unit files using ``@`` when searching for
the unit file (https://github.com/ansible/ansible/pull/72347#issuecomment-730626228)
'
- 'systemd - follow up fix to https://github.com/ansible/ansible/issues/72338
to use ``list-unit-files`` rather than ``list-units`` in order to show all
units files on the system.
'
- 'systemd - work around bug with ``systemd`` 245 and 5.8 kernel that does not
correctly report service state (https://github.com/ansible/ansible/issues/71528)
'
- wait_for - catch and ignore errors when getting active connections with psutil
(https://github.com/ansible/ansible/issues/72322)
minor_changes:
- ansible-doc - provide ``has_action`` field in JSON output for modules. That
information is currently only available in the text view (https://github.com/ansible/ansible/pull/72359).
- 'ansible-galaxy - find any collection dependencies in the globally configured
Galaxy servers and not just the server the parent collection is from.
'
- ansible-test - Added a ``--export`` option to the ``ansible-test coverage
combine`` command to facilitate multi-stage aggregation of coverage in CI
pipelines.
- ansible-test - Added the ``-remote rhel/7.9`` option to run tests on RHEL
7.9
- ansible-test - CentOS 8 container is now 8.2.2004 (https://github.com/ansible/distro-test-containers/pull/45).
- ansible-test - Fix container hostname/IP discovery for the ``acme`` test plugin.
- ansible-test - OpenSuse container now uses Leap 15.2 (https://github.com/ansible/distro-test-containers/pull/48).
- ansible-test - Ubuntu containers as well as ``default-test-container`` and
``ansible-base-test-container`` are now slightly smaller due to apt cleanup
(https://github.com/ansible/distro-test-containers/pull/46).
- ansible-test - ``default-test-container`` and ``ansible-base-test-container``
now use Python 3.9.0 instead of 3.9.0rc1.
- ansible-test - centos6 end of life - container image updated to point to vault
base repository (https://github.com/ansible/distro-test-containers/pull/54)
- ansible-test validate-modules - no longer assume that ``default`` for ``type=bool``
options is ``false``, as the default is ``none`` and for some modules, ``none``
and ``false`` mean different things (https://github.com/ansible/ansible/issues/69561).
- iptables - reorder comment postition to be at the end (https://github.com/ansible/ansible/issues/71444).
release_summary: '| Release Date: 2020-12-07
| `Porting Guide <https://docs.ansible.com/ansible/devel/porting_guides.html>`__
'
codename: When the Levee Breaks
fragments:
- 32143-pause-background-hangs.yml
- 71496-iptables-reorder-comment-position.yml
- 71528-systemd-capbpf-workaround.yml
- 71528-systemd-improve-unit-searching.yml
- 71528-systemd-list-unit-files.yml
- 71824-action-fqcns.yml
- 72055-blockinfile-fix-insert-after-line-no-linesep.yml
- 72316-dnf-filtering.yml
- 72322-wait-for-handle-errors.yml
- 72390-return-error-if-cwd-directory-does-not-exist.yml
- 72428-action-groups-docker-k8s.yml
- 72516-fix-aix-network-facts.yml
- 72623-ansible-test-unicode-paths.yml
- 72697-improve-config-deprecations.yml
- 72699-validate-modules-default-for-bools.yml
- ansible-base-update-containers.yml
- ansible-doc-has_action.yml
- ansible-test-acme-test-plugin.yml
- ansible-test-azp-change-detection.yml
- ansible-test-centos6-eol.yml
- ansible-test-collection-classification.yml
- ansible-test-coverage-combine-export.yml
- ansible-test-validate-modules-file-common-args.yml
- cffi-constraint.yml
- ensure_local_user_correctness.yml
- galaxy-servers.yml
- play_context_remove_redundant_pwd.yml
- ps-sanity-requirements.yml
- py26-multiprocess-queue-bug.yml
- rhel-7.9.yml
- run-command-cwd.yml
- set_mode_if_different-symlink-sticky-dir.yml
- skip_invalid_coll_name_when_listing.yml
- v2.10.4rc1_summary.yaml
release_date: '2020-12-07'
2.10.5:
changes:
release_summary: '| Release Date: 2021-01-18
| `Porting Guide <https://docs.ansible.com/ansible/devel/porting_guides.html>`__
'
codename: When the Levee Breaks
fragments:
- v2.10.5_summary.yaml
release_date: '2021-01-18'
2.10.5rc1:
changes:
bugfixes:
- Apply ``_wrap_native_text`` only for builtin filters specified in STRING_TYPE_FILTERS.
- Documentation change to the apt module to reference lock files (https://github.com/ansible/ansible/issues/73079).
- 'Fix --list-tasks format `role_name : task_name` when task name contains the
role name. (https://github.com/ansible/ansible/issues/72505)'
- Fix ansible-galaxy collection list to show collections in site-packages (https://github.com/ansible/ansible/issues/70147)
- Fix bytestring vs string comparison in module_utils.basic.is_special_selinux_path()
so that special-cased filesystems which don't support SELinux context attributes
still allow files to be manipulated on them. (https://github.com/ansible/ansible/issues/70244)
- 'Fix notifying handlers via `role_name : handler_name` when handler name contains
the role name. (https://github.com/ansible/ansible/issues/70582)'
- async - Fix Python 3 interpreter parsing from module by comparing with bytes
(https://github.com/ansible/ansible/issues/70690)
- inventory - pass the vars dictionary to combine_vars instead of an individual
key's value (https://github.com/ansible/ansible/issues/72975).
- paramiko connection plugin - Ensure we only reset the connection when one
has been previously established (https://github.com/ansible/ansible/issues/65812)
- 'systemd - preserve the full unit name when using a templated service and
``systemd`` failed to parse dbus due to a known bug in ``systemd`` (https://github.com/ansible/ansible/pull/72985)
'
- 'user - do the right thing when ``password_lock=True`` and ``password`` are
used together (https://github.com/ansible/ansible/issues/72992)
'
minor_changes:
- ansible-test - Changed the internal name of the custom plugin used to identify
use of unwanted imports and functions.
- ansible-test - The ``pylint`` sanity test is now skipped with a warning on
Python 3.9 due to unresolved upstream regressions.
- ansible-test - The ``pylint`` sanity test is now supported on Python 3.8.
- ansible-test - add macOS 11.1 as a remote target (https://github.com/ansible/ansible/pull/72622)
- ansible-test - remote macOS instances no longer install ``virtualenv`` during
provisioning
- ansible-test - virtualenv helper scripts now prefer ``venv`` on Python 3 over
``virtualenv`` if the ``ANSIBLE_TEST_PREFER_VENV`` environment variable is
set
release_summary: '| Release Date: 2021-01-11
| `Porting Guide <https://docs.ansible.com/ansible/devel/porting_guides.html>`__
'
codename: When the Levee Breaks
fragments:
- 65812-paramiko-attribute-error.yml
- 70244-selinux-special-fs.yml
- 70690-async-interpreter.yml
- 72511-always-prepend-role-to-task-name.yml
- 72979-fix-inventory-merge-hash-replace.yaml
- 72992-user-account-lock-always-changes.yml
- 73079-update-documentation-around-apt-lock.yml
- ansible-test-pylint-plugin-name.yml
- ansible-test-pylint-python-3.8-3.9.yml
- ansible-test-venv-virtualenv-fallback.yml
- ci-add-macos-11.yml
- collection-list-site-packages.yaml
- systemd-preserve-full-unit-name.yml
- v2.10.5rc1_summary.yaml
- wrap_native_text-non-collections-only.yml
release_date: '2021-01-11'
2.10.6:
changes:
release_summary: '| Release Date: 2021-02-17
| `Porting Guide <https://docs.ansible.com/ansible/devel/porting_guides.html>`__
'
codename: When the Levee Breaks
fragments:
- v2.10.6_summary.yaml
release_date: '2021-02-17'
2.10.6rc1:
changes:
bugfixes:
- Added unsafe_writes test.
- Always mention the name of the deprecated or tombstoned plugin in routing
deprecation/tombstone messages (https://github.com/ansible/ansible/pull/73059).
- Correct the inventory source error parse handling, specifically make the config
INVENTORY_ANY_UNPARSED_IS_FAILED work as expected.
- Enabled unsafe_writes for get_url which was ignoring the paramter.
- Fix incorrect variable scoping when using ``import with context`` in Jinja2
templates. (https://github.com/ansible/ansible/issues/72615)
- Restored unsafe_writes functionality which was being skipped.
- allow become method 'su' to work on 'local' connection by allocating a fake
tty.
- ansble-test - only require a collection name in deprecation warnings when
necessary (https://github.com/ansible/ansible/pull/72987)
- ansible-test - Temporarily limit ``cryptography`` to versions before 3.4 to
enable tests to function.
- ansible-test - The ``--remote`` option has been updated for Python 2.7 to
work around breaking changes in the newly released ``get-pip.py`` bootstrapper.
- ansible-test - The ``--remote`` option has been updated to use a versioned
``get-pip.py`` bootstrapper to avoid issues with future releases.
- ansible-test sanity changelog test - bump dependency on antsibull-changelog
to 0.9.0 so that `fragments that add new plugins or objects <https://github.com/ansible-community/antsibull-changelog/blob/main/docs/changelogs.rst#adding-new-roles-playbooks-test-and-filter-plugins>`_
will not fail validation (https://github.com/ansible/ansible/pull/73428).
- display correct error information when an error exists in the last line of
the file (https://github.com/ansible/ansible/issues/16456)
- facts - properly report virtualization facts for Linux guests running on bhyve
(https://github.com/ansible/ansible/issues/73167)
- git - Only pass ``--raw`` flag to git verify commands (verify-tag, verify-commit)
when ``gpg_whitelist`` is in use. Otherwise don't pass it so that non-whitelist
GPG validation still works on older Git versions. (https://github.com/ansible/ansible/issues/64469)
- import_playbook - change warning about extra parameters to deprecation (https://github.com/ansible/ansible/issues/72745)
- pause - do not warn when running in the background if a timeout is provided
(https://github.com/ansible/ansible/issues/73042)
- psrp connection plugin - ``to_text(stdout)`` before ``json.loads`` in psrp.Connection.put_file
in case ``stdout`` is bytes.
- validate-modules - do not raise an ``AttributeError`` if a value is assigned
to a module attribute in a try/except block.
minor_changes:
- ansible-test - Added Ubuntu 20.04 LTS image to the default completion list
- inventory cache - do not show a warning when the cache file does not (yet)
exist.
release_summary: '| Release Date: 2021-02-08
| `Porting Guide <https://docs.ansible.com/ansible/devel/porting_guides.html>`__
'
security_fixes:
- '**security issue** - Mask default and fallback values for ``no_log`` module
options (CVE-2021-20228)'
codename: When the Levee Breaks
fragments:
- 16456-correct-YAML-error-message-when-file-load-failed.yml
- 64469_git_no_raw.yml
- 72615-jinja-import-context-fix.yml
- 72745-import_playbook-deprecation-extra-params.yml
- 73059-improve-deprecation-texts.yml
- 73167-bhyve-facts.yml
- 73428-changelog-linting-bump-version.yml
- ansible-test-pip-bootstrap-s3.yml
- ansible-test-pip-bootstrap.yml
- ansible-test-sanity-deprecation-collection-name.yml
- ansible-test-ubuntu2004.yml
- cryptography-fix.yml
- enable_su_on_local.yaml
- fix_inventory_source_parse_error_handling.yml
- inventory-cache-file-missing-warning.yaml
- no_log-fallback.yml
- pause-do-not-warn-background-with-seconds.yml
- psrp-json-loads-bytes.yml
- unsafe_writes_fix.yml
- v2.10.6rc1_summary.yaml
- validate-modules_found_try_except_import_fails_module_attribute.yaml
release_date: '2021-02-08'

View File

@ -0,0 +1,2 @@
bugfixes:
- display correct error information when an error exists in the last line of the file (https://github.com/ansible/ansible/issues/16456)

View File

@ -0,0 +1,4 @@
bugfixes:
- >
pause - Fix indefinite hang when using a pause task on a background
process (https://github.com/ansible/ansible/issues/32142)

View File

@ -0,0 +1,2 @@
bugfixes:
- git - Only pass ``--raw`` flag to git verify commands (verify-tag, verify-commit) when ``gpg_whitelist`` is in use. Otherwise don't pass it so that non-whitelist GPG validation still works on older Git versions. (https://github.com/ansible/ansible/issues/64469)

View File

@ -0,0 +1,3 @@
bugfixes:
- paramiko connection plugin - Ensure we only reset the connection when one has been
previously established (https://github.com/ansible/ansible/issues/65812)

View File

@ -1,4 +1,3 @@
minor_changes:
- ansible-galaxy - Allow installing collections from git repositories.
- ansible-galaxy - Requirement entries for collections now support a 'type' key to indicate whether the collection is a galaxy artifact, file, url, or git repo.
- ansible-galaxy - Support both 'galaxy.yml' and 'galaxy.yaml' files for collections.

View File

@ -0,0 +1,2 @@
bugfixes:
- Fix bytestring vs string comparison in module_utils.basic.is_special_selinux_path() so that special-cased filesystems which don't support SELinux context attributes still allow files to be manipulated on them. (https://github.com/ansible/ansible/issues/70244)

View File

@ -0,0 +1,3 @@
bugfixes:
- async - Fix Python 3 interpreter parsing from module by comparing with bytes
(https://github.com/ansible/ansible/issues/70690)

View File

@ -0,0 +1,2 @@
minor_changes:
- iptables - reorder comment postition to be at the end (https://github.com/ansible/ansible/issues/71444).

View File

@ -0,0 +1,4 @@
bugfixes:
- >
systemd - work around bug with ``systemd`` 245 and 5.8 kernel that does not correctly
report service state (https://github.com/ansible/ansible/issues/71528)

View File

@ -0,0 +1,4 @@
bugfixes:
- >
systemd - account for templated unit files using ``@`` when searching for
the unit file (https://github.com/ansible/ansible/pull/72347#issuecomment-730626228)

View File

@ -0,0 +1,5 @@
bugfixes:
- >
systemd - follow up fix to https://github.com/ansible/ansible/issues/72338
to use ``list-unit-files`` rather than ``list-units`` in order to show
all units files on the system.

View File

@ -0,0 +1,2 @@
bugfixes:
- "Adjust various hard-coded action names to also include their ``ansible.builtin.`` and ``ansible.legacy.`` prefixed version (https://github.com/ansible/ansible/issues/71817, https://github.com/ansible/ansible/issues/71818, https://github.com/ansible/ansible/pull/71824)."

View File

@ -0,0 +1,4 @@
bugfixes:
- >
blockinfile - properly insert a block at the end of a file that does not
have a trailing newline character (https://github.com/ansible/ansible/issues/72055)

View File

@ -0,0 +1,2 @@
bugfixes:
- dnf - fix filtering to avoid dependncy conflicts (https://github.com/ansible/ansible/issues/72316)

View File

@ -0,0 +1,2 @@
bugfixes:
- wait_for - catch and ignore errors when getting active connections with psutil (https://github.com/ansible/ansible/issues/72322)

View File

@ -0,0 +1,2 @@
bugfixes:
- basic.AnsibleModule - AnsibleModule.run_command silently ignores a non-existent directory in the ``cwd`` argument (https://github.com/ansible/ansible/pull/72390).

View File

@ -0,0 +1,2 @@
bugfixes:
- "The ``docker`` and ``k8s`` action groups / module default groups now also support the moved modules in `community.docker <https://galaxy.ansible.com/community/docker>`_, `community.kubevirt <https://github.com/ansible-collections/community.kubevirt>`_, `community.okd <https://galaxy.ansible.com/community/okd>`_, and `kubernetes.core <https://galaxy.ansible.com/kubernetes/core>`_ (https://github.com/ansible/ansible/pull/72428)."

View File

@ -0,0 +1,3 @@
bugfixes:
- 'Fix notifying handlers via `role_name : handler_name` when handler name contains the role name. (https://github.com/ansible/ansible/issues/70582)'
- 'Fix --list-tasks format `role_name : task_name` when task name contains the role name. (https://github.com/ansible/ansible/issues/72505)'

View File

@ -0,0 +1,2 @@
bugfixes:
- Fixed issue when `netstat` is either missing or doesn't have execution permissions leading to incorrect command being executed.

View File

@ -0,0 +1,2 @@
bugfixes:
- Fix incorrect variable scoping when using ``import with context`` in Jinja2 templates. (https://github.com/ansible/ansible/issues/72615)

View File

@ -0,0 +1,2 @@
bugfixes:
- "ansible-test - convert target paths to unicode on Python 2 to avoid ``UnicodeDecodeError`` (https://github.com/ansible/ansible/issues/68398, https://github.com/ansible/ansible/pull/72623)."

View File

@ -0,0 +1,2 @@
bugfixes:
- "Improve Ansible config deprecations to show the source of the deprecation (ansible-base). Also remove space before a comma in config deprecations (https://github.com/ansible/ansible/pull/72697)."

View File

@ -0,0 +1,2 @@
minor_changes:
- "ansible-test validate-modules - no longer assume that ``default`` for ``type=bool`` options is ``false``, as the default is ``none`` and for some modules, ``none`` and ``false`` mean different things (https://github.com/ansible/ansible/issues/69561)."

View File

@ -0,0 +1,2 @@
bugfixes:
- import_playbook - change warning about extra parameters to deprecation (https://github.com/ansible/ansible/issues/72745)

View File

@ -0,0 +1,2 @@
bugfixes:
- inventory - pass the vars dictionary to combine_vars instead of an individual key's value (https://github.com/ansible/ansible/issues/72975).

View File

@ -0,0 +1,4 @@
bugfixes:
- >
user - do the right thing when ``password_lock=True`` and ``password``
are used together (https://github.com/ansible/ansible/issues/72992)

View File

@ -0,0 +1,2 @@
bugfixes:
- "Always mention the name of the deprecated or tombstoned plugin in routing deprecation/tombstone messages (https://github.com/ansible/ansible/pull/73059)."

View File

@ -0,0 +1,2 @@
bugfixes:
- "Documentation change to the apt module to reference lock files (https://github.com/ansible/ansible/issues/73079)."

View File

@ -0,0 +1,2 @@
bugfixes:
- facts - properly report virtualization facts for Linux guests running on bhyve (https://github.com/ansible/ansible/issues/73167)

View File

@ -0,0 +1,2 @@
bugfixes:
- "ansible-test sanity changelog test - bump dependency on antsibull-changelog to 0.9.0 so that `fragments that add new plugins or objects <https://github.com/ansible-community/antsibull-changelog/blob/main/docs/changelogs.rst#adding-new-roles-playbooks-test-and-filter-plugins>`_ will not fail validation (https://github.com/ansible/ansible/pull/73428)."

View File

@ -0,0 +1,5 @@
minor_changes:
- ansible-test - OpenSuse container now uses Leap 15.2 (https://github.com/ansible/distro-test-containers/pull/48).
- ansible-test - Ubuntu containers as well as ``default-test-container`` and ``ansible-base-test-container`` are now slightly smaller due to apt cleanup (https://github.com/ansible/distro-test-containers/pull/46).
- ansible-test - CentOS 8 container is now 8.2.2004 (https://github.com/ansible/distro-test-containers/pull/45).
- ansible-test - ``default-test-container`` and ``ansible-base-test-container`` now use Python 3.9.0 instead of 3.9.0rc1.

View File

@ -0,0 +1,2 @@
minor_changes:
- "ansible-doc - provide ``has_action`` field in JSON output for modules. That information is currently only available in the text view (https://github.com/ansible/ansible/pull/72359)."

View File

@ -0,0 +1,2 @@
minor_changes:
- ansible-test - Fix container hostname/IP discovery for the ``acme`` test plugin.

View File

@ -0,0 +1,2 @@
bugfixes:
- ansible-test - Correctly detect changes in a GitHub pull request when running on Azure Pipelines.

View File

@ -0,0 +1,2 @@
minor_changes:
- ansible-test - centos6 end of life - container image updated to point to vault base repository (https://github.com/ansible/distro-test-containers/pull/54)

View File

@ -0,0 +1,2 @@
bugfixes:
- "ansible-test - improve classification of changes to ``.gitignore``, ``COPYING``, ``LICENSE``, ``Makefile``, and all files ending with one of ``.in`, ``.md`, ``.rst``, ``.toml``, ``.txt`` in the collection root directory (https://github.com/ansible/ansible/pull/72353)."

View File

@ -0,0 +1,2 @@
bugfixes:
- ansible-test - ``cryptography`` is now limited to versions prior to 3.2 only when an incompatible OpenSSL version (earlier than 1.1.0) is detected

View File

@ -0,0 +1,2 @@
minor_changes:
- ansible-test - Added a ``--export`` option to the ``ansible-test coverage combine`` command to facilitate multi-stage aggregation of coverage in CI pipelines.

View File

@ -0,0 +1,2 @@
bugfixes:
- ansible-test - The ``--remote`` option has been updated to use a versioned ``get-pip.py`` bootstrapper to avoid issues with future releases.

View File

@ -0,0 +1,2 @@
bugfixes:
- ansible-test - The ``--remote`` option has been updated for Python 2.7 to work around breaking changes in the newly released ``get-pip.py`` bootstrapper.

View File

@ -0,0 +1,2 @@
minor_changes:
- ansible-test - Changed the internal name of the custom plugin used to identify use of unwanted imports and functions.

View File

@ -0,0 +1,3 @@
minor_changes:
- ansible-test - The ``pylint`` sanity test is now supported on Python 3.8.
- ansible-test - The ``pylint`` sanity test is now skipped with a warning on Python 3.9 due to unresolved upstream regressions.

View File

@ -0,0 +1,2 @@
bugfixes:
- ansble-test - only require a collection name in deprecation warnings when necessary (https://github.com/ansible/ansible/pull/72987)

View File

@ -0,0 +1,2 @@
minor_changes:
- ansible-test - Added Ubuntu 20.04 LTS image to the default completion list

View File

@ -0,0 +1,2 @@
bugfixes:
- "ansible-test validate-modules - when a module uses ``add_file_common_args=True`` and does not use a keyword argument for ``argument_spec`` in ``AnsibleModule()``, the common file arguments were not considered added during validation (https://github.com/ansible/ansible/pull/72334)."

View File

@ -0,0 +1,3 @@
minor_changes:
- ansible-test - virtualenv helper scripts now prefer ``venv`` on Python 3 over ``virtualenv`` if the ``ANSIBLE_TEST_PREFER_VENV`` environment variable is set
- ansible-test - remote macOS instances no longer install ``virtualenv`` during provisioning

View File

@ -0,0 +1,4 @@
bugfixes:
- >
ansible-test - add constraint for ``cffi`` to prevent failure on systems with
older versions of ``gcc`` (https://foss.heptapod.net/pypy/cffi/-/issues/480)

View File

@ -0,0 +1,2 @@
minor_changes:
- ansible-test - add macOS 11.1 as a remote target (https://github.com/ansible/ansible/pull/72622)

View File

@ -0,0 +1,3 @@
bugfixes:
- Fix ansible-galaxy collection list to show collections in site-packages
(https://github.com/ansible/ansible/issues/70147)

View File

@ -0,0 +1,2 @@
bugfixes:
- ansible-test - Temporarily limit ``cryptography`` to versions before 3.4 to enable tests to function.

View File

@ -0,0 +1,2 @@
bugfixes:
- allow become method 'su' to work on 'local' connection by allocating a fake tty.

View File

@ -0,0 +1,2 @@
bugfixes:
- ensure 'local' connection always has the correct default user for actions to consume.

View File

@ -0,0 +1,2 @@
bugfixes:
- Correct the inventory source error parse handling, specifically make the config INVENTORY_ANY_UNPARSED_IS_FAILED work as expected.

View File

@ -0,0 +1,4 @@
minor_changes:
- >
ansible-galaxy - find any collection dependencies in the globally configured Galaxy servers and not just the server
the parent collection is from.

View File

@ -0,0 +1,2 @@
minor_changes:
- inventory cache - do not show a warning when the cache file does not (yet) exist.

View File

@ -0,0 +1,2 @@
security_fixes:
- '**security issue** - Mask default and fallback values for ``no_log`` module options (CVE-2021-20228)'

View File

@ -0,0 +1,2 @@
bugfixes:
- pause - do not warn when running in the background if a timeout is provided (https://github.com/ansible/ansible/issues/73042)

View File

@ -0,0 +1,2 @@
bugfixes:
- remove redundant remote_user setting in play_context for local as plugin already does it, also removes fork/thread issue from use of pwd library.

View File

@ -0,0 +1,2 @@
bugfixes:
- ansible-test - Skip installing requirements if they are already installed.

View File

@ -0,0 +1,2 @@
bugfixes:
- psrp connection plugin - ``to_text(stdout)`` before ``json.loads`` in psrp.Connection.put_file in case ``stdout`` is bytes.

View File

@ -0,0 +1,2 @@
bugfixes:
- account for bug in Python 2.6 that occurs during interpreter shutdown to avoid stack trace

View File

@ -0,0 +1,2 @@
minor_changes:
- ansible-test - Added the ``-remote rhel/7.9`` option to run tests on RHEL 7.9

View File

@ -0,0 +1,2 @@
bugfixes:
- AnsibleModule - added arg ``ignore_invalid_cwd`` to ``AnsibleModule.run_command()``, to control its behaviour when ``cwd`` is invalid. (https://github.com/ansible/ansible/pull/72390)

View File

@ -0,0 +1,4 @@
bugfixes:
- >
set_mode_if_different - handle symlink if it is inside a directory with
sticky bit set (https://github.com/ansible/ansible/pull/45198)

View File

@ -0,0 +1,2 @@
bugfixes:
- Skip invalid collection names when listing in ansible-doc instead of throwing exception. Issue#72257

View File

@ -0,0 +1,4 @@
bugfixes:
- >
systemd - preserve the full unit name when using a templated service and
``systemd`` failed to parse dbus due to a known bug in ``systemd`` (https://github.com/ansible/ansible/pull/72985)

View File

@ -0,0 +1,4 @@
bugfixes:
- Restored unsafe_writes functionality which was being skipped.
- Added unsafe_writes test.
- Enabled unsafe_writes for get_url which was ignoring the paramter.

View File

@ -0,0 +1,3 @@
release_summary: |
| Release Date: 2020-12-14
| `Porting Guide <https://docs.ansible.com/ansible/devel/porting_guides.html>`__

View File

@ -0,0 +1,3 @@
release_summary: |
| Release Date: 2020-12-07
| `Porting Guide <https://docs.ansible.com/ansible/devel/porting_guides.html>`__

View File

@ -0,0 +1,3 @@
release_summary: |
| Release Date: 2021-01-18
| `Porting Guide <https://docs.ansible.com/ansible/devel/porting_guides.html>`__

View File

@ -0,0 +1,3 @@
release_summary: |
| Release Date: 2021-01-11
| `Porting Guide <https://docs.ansible.com/ansible/devel/porting_guides.html>`__

View File

@ -0,0 +1,3 @@
release_summary: |
| Release Date: 2021-02-17
| `Porting Guide <https://docs.ansible.com/ansible/devel/porting_guides.html>`__

View File

@ -0,0 +1,3 @@
release_summary: |
| Release Date: 2021-02-08
| `Porting Guide <https://docs.ansible.com/ansible/devel/porting_guides.html>`__

View File

@ -0,0 +1,3 @@
---
bugfixes:
- validate-modules - do not raise an ``AttributeError`` if a value is assigned to a module attribute in a try/except block.

View File

@ -0,0 +1,2 @@
bugfixes:
- Apply ``_wrap_native_text`` only for builtin filters specified in STRING_TYPE_FILTERS.

View File

@ -94,7 +94,11 @@ clean:
rm -f rst/reference_appendices/playbooks_keywords.rst
rm -f rst/dev_guide/collections_galaxy_meta.rst
rm -f rst/cli/*.rst
rm -rf rst/collections/*
for filename in `ls rst/collections/` ; do \
if test x"$$filename" != x'all_plugins.rst' ; then \
rm -rf "rst/collections/$$filename"; \
fi \
done
@echo "Cleaning up legacy generated rst locations"
rm -rf rst/modules
rm -f rst/plugins/*/*.rst

View File

@ -10,19 +10,27 @@
document.write('</div>');
}
{% if (not READTHEDOCS) and (available_versions is defined) %}
// Create a banner if we're not the latest version
// Create a banner
current_url_path = window.location.pathname;
if (startsWith(current_url_path, "/ansible/latest/") || startsWith(current_url_path, "/ansible/{{ latest_version }}/")) {
// no banner for latest release
/* temp banner to advertise AnsibleFest
document.write('<div id="banner_id" class="admonition caution">');
document.write('<p>You are reading the latest community version of the Ansible documentation. Red Hat subscribers, select <b>2.9</b> in the version selection to the left for the most recent Red Hat release.</p>');
document.write('</div>');
} else if (startsWith(current_url_path, "/ansible/2.9/")) {
document.write('<div id="banner_id" class="admonition caution">');
document.write('<p>You are reading the latest Red Hat released version of the Ansible documentation. Community users can use this, or select any version in version selection to the left, including <b>latest</b> for the most recent community version.</p>');
document.write('</div>');
} else if (startsWith(current_url_path, "/ansible/devel/")) {
/* temp banner to advertise survey
document.write('<div id="banner_id" class="admonition important">');
document.write('<p><a href="https://www.ansible.com/ansiblefest?sc_cid=7013a000002gyPxAAI">AnsibleFest</a> is going virtual with two days of expert speakers, live demos and hands-on labs Oct 13-14!</p>');
document.write('<br><p>Please take our <a href="https://www.surveymonkey.co.uk/r/B9V3CDY">Docs survey</a> before December 31 to help us improve Ansible documentation.</p><br>');
document.write('</div>'); */
} else if (startsWith(current_url_path, "/ansible/devel/")) {
document.write('<div id="banner_id" class="admonition caution">');
document.write('<p>You are reading the *devel* version of the Ansible documentation - this version is not guaranteed stable. Use the version selection to the left if you want the latest stable released version.</p>');
document.write('<p>You are reading the <b>devel</b> version of the Ansible documentation - this version is not guaranteed stable. Use the version selection to the left if you want the latest stable released version.</p>');
document.write('</div>');
} else {
document.write('<div id="banner_id" class="admonition caution">');
document.write('<p>You are reading an older version of the Ansible documentation. Use the version selection to the left if you want the latest stable released version.</p>');

View File

@ -0,0 +1,11 @@
.. _all_modules_and_plugins:
Indexes of all modules and plugins
----------------------------------
.. toctree::
:maxdepth: 1
:caption: Plugin indexes
:glob:
index_*

View File

@ -536,19 +536,30 @@ First, look at `Ansible Collection Checklist <https://github.com/ansible-collect
To migrate content from one collection to another, if the collections are parts of `Ansible distribution <https://github.com/ansible-community/ansible-build-data/blob/main/2.10/ansible.in>`_:
#. Copy content from the source (old) collection to the target collection.
#. Deprecate the module/plugin with ``removal_version`` scheduled for the next major version in ``meta/runtime.yml`` of the source collection. The deprecation must be released after the copied content has been included in a release of the target collection.
#. When the next major release comes:
#. Copy content from the source (old) collection to the target (new) collection.
#. Deprecate the module/plugin with ``removal_version`` scheduled for the next major version in ``meta/runtime.yml`` of the old collection. The deprecation must be released after the copied content has been included in a release of the new collection.
#. When the next major release of the old collection is prepared:
* remove the module/plugin from the source collection
* add ``redirect`` to the corresponding entry in ``meta/runtime.yml``
* remove ``removal_version`` from there
* remove the module/plugin from the old collection
* remove the symlink stored in ``plugin/modules`` directory if appropriate (mainly when removing from ``community.general`` and ``community.network``)
* remove related unit and integration tests
* remove specific module utils
* remove specific documentation fragments if there are any in the old collection
* add a changelog fragment containing entries for ``removed_features`` and ``breaking_changes``; you can see an example of a changelog fragment in this `pull request <https://github.com/ansible-collections/community.general/pull/1304>`_
* change ``meta/runtime.yml`` in the old collection:
* add ``redirect`` to the corresponding module/plugin's entry
* in particular, add ``redirect`` for the removed module utils and documentation fragments if applicable
* remove ``removal_version`` from there
* remove related entries from ``tests/sanity/ignore.txt`` files if exist
* remove changelog fragments for removed content that are not yet part of the changelog (in other words, do not modify `changelogs/changelog.yaml` and do not delete files mentioned in it)
* remove requirements that are no longer required in ``tests/unit/requirements.txt``, ``tests/requirements.yml`` and ``galaxy.yml``
According to the above, you need to create at least three PRs as follows:
#. Create a PR against the target collection to copy the content.
#. Deprecate the module/plugin in the source collection.
#. Later create a PR against the source collection to remove the content according to the schedule.
#. Create a PR against the new collection to copy the content.
#. Deprecate the module/plugin in the old collection.
#. Later create a PR against the old collection to remove the content according to the schedule.
Adding the content to the new collection

View File

@ -114,7 +114,8 @@ All fields in the ``DOCUMENTATION`` block are lower-case. All fields are require
:version_added:
* The version of Ansible when the module was added.
* This is a string, and not a float, for example, ``version_added: '2.1'``
* This is a string, and not a float, for example, ``version_added: '2.1'``.
* In collections, this must be the collection version the module was added to, not the Ansible version. For example, ``version_added: 1.0.0``.
:author:
@ -182,6 +183,7 @@ All fields in the ``DOCUMENTATION`` block are lower-case. All fields are require
* Only needed if this option was extended after initial Ansible release, in other words, this is greater than the top level `version_added` field.
* This is a string, and not a float, for example, ``version_added: '2.3'``.
* In collections, this must be the collection version the option was added to, not the Ansible version. For example, ``version_added: 1.0.0``.
:suboptions:
@ -241,7 +243,7 @@ content in a uniform way:
* ``I()`` for option names. For example: ``Required if I(state=present).`` This is italicized in
the documentation.
* ``C()`` for files and option values. For example: ``If not set the environment variable C(ACME_PASSWORD) will be used.`` This displays with a mono-space font in the documentation.
* ``C()`` for files, option values, and inline code. For example: ``If not set the environment variable C(ACME_PASSWORD) will be used.`` or ``Use C(var | foo.bar.my_filter) to transform C(var) into the required format.`` This displays with a mono-space font in the documentation.
* ``B()`` currently has no standardized usage. It is displayed in boldface in the documentation.
* ``HORIZONTALLINE`` is used sparingly as a separator in long descriptions. It becomes a horizontal rule (the ``<hr>`` html tag) in the documentation.
@ -372,7 +374,7 @@ Otherwise, for each value returned, provide the following fields. All fields are
Only needed if this return was extended after initial Ansible release, in other words, this is greater than the top level `version_added` field.
This is a string, and not a float, for example, ``version_added: '2.3'``.
:contains:
Optional. To describe nested return values, set ``type: complex``, ``type: dict``, or ``type: list``/``elements: dict`` and repeat the elements above for each sub-field.
Optional. To describe nested return values, set ``type: dict``, or ``type: list``/``elements: dict``, or if you really have to, ``type: complex``, and repeat the elements above for each sub-field.
Here are two example ``RETURN`` sections, one with three simple fields and one with a complex nested field::
@ -398,12 +400,13 @@ Here are two example ``RETURN`` sections, one with three simple fields and one w
packages:
description: Information about package requirements.
returned: success
type: complex
type: dict
contains:
missing:
description: Packages that are missing from the system.
returned: success
type: list
elements: str
sample:
- libmysqlclient-dev
- libxml2-dev
@ -411,6 +414,7 @@ Here are two example ``RETURN`` sections, one with three simple fields and one w
description: Packages that are installed but at bad versions.
returned: success
type: list
elements: dict
sample:
- package: libxml2-dev
version: 2.9.4+dfsg1-2

View File

@ -75,7 +75,7 @@ To create an info module:
1. Navigate to the correct directory for your new module: ``$ cd lib/ansible/modules/``. If you are developing module using collection, ``$ cd plugins/modules/`` inside your collection development tree.
2. Create your new module file: ``$ touch my_test_info.py``.
3. Paste the content below into your new info module file. It includes the :ref:`required Ansible format and documentation <developing_modules_documenting>` and some example code.
3. Paste the content below into your new info module file. It includes the :ref:`required Ansible format and documentation <developing_modules_documenting>`, a simple :ref:`argument spec for declaring the module options <argument_spec>`, and some example code.
4. Modify and extend the code to do what you want your new info module to do. See the :ref:`programming tips <developing_modules_best_practices>` and :ref:`Python 3 compatibility <developing_python_3>` pages for pointers on writing clean and concise module code.
.. literalinclude:: ../../../../examples/scripts/my_test_info.py
@ -93,8 +93,8 @@ To create a new module:
1. Navigate to the correct directory for your new module: ``$ cd lib/ansible/modules/``. If you are developing a module in a :ref:`collection <developing_collections>`, ``$ cd plugins/modules/`` inside your collection development tree.
2. Create your new module file: ``$ touch my_test.py``.
3. Paste the content below into your new module file. It includes the :ref:`required Ansible format and documentation <developing_modules_documenting>` and some example code.
4. Modify and extend the code to do what you want your new module to do. See the :ref:`programming tips <developing_modules_best_practices>` and :ref:`Python 3 compatibility <developing_python_3>` pages for pointers on writing clean, concise module code.
3. Paste the content below into your new module file. It includes the :ref:`required Ansible format and documentation <developing_modules_documenting>`, a simple :ref:`argument spec for declaring the module options <argument_spec>`, and some example code.
4. Modify and extend the code to do what you want your new module to do. See the :ref:`programming tips <developing_modules_best_practices>` and :ref:`Python 3 compatibility <developing_python_3>` pages for pointers on writing clean and concise module code.
.. literalinclude:: ../../../../examples/scripts/my_test.py
:language: python

View File

@ -221,7 +221,7 @@ but with an extra option so you can see how configuration works in Ansible versi
requirements:
- whitelist in configuration
short_description: Adds time to play stats
version_added: "2.0"
version_added: "2.0" # for collections, use the collection version, not the Ansible version
description:
- This callback just adds total play duration to the play stats.
options:
@ -334,7 +334,7 @@ Here's a simple lookup plugin implementation --- this lookup returns the content
DOCUMENTATION = """
lookup: file
author: Daniel Hokka Zakrisson <daniel@hozac.com>
version_added: "0.9"
version_added: "0.9" # for collections, use the collection version, not the Ansible version
short_description: read file contents
description:
- This lookup returns the contents from a file on the Ansible controller's file system.
@ -460,7 +460,7 @@ Include the ``vars_plugin_staging`` documentation fragment to allow users to det
DOCUMENTATION = '''
vars: custom_hostvars
version_added: "2.10"
version_added: "2.10" # for collections, use the collection version, not the Ansible version
short_description: Load custom host vars
description: Load custom host vars
options:

View File

@ -561,83 +561,320 @@ Example ``argument_spec``:
This section will discuss the behavioral attributes for arguments:
type
""""
:type:
``type`` allows you to define the type of the value accepted for the argument. The default value for ``type`` is ``str``. Possible values are:
``type`` allows you to define the type of the value accepted for the argument. The default value for ``type`` is ``str``. Possible values are:
* str
* list
* dict
* bool
* int
* float
* path
* raw
* jsonarg
* json
* bytes
* bits
* str
* list
* dict
* bool
* int
* float
* path
* raw
* jsonarg
* json
* bytes
* bits
The ``raw`` type, performs no type validation or type casting, and maintains the type of the passed value.
The ``raw`` type, performs no type validation or type casting, and maintains the type of the passed value.
elements
""""""""
:elements:
``elements`` works in combination with ``type`` when ``type='list'``. ``elements`` can then be defined as ``elements='int'`` or any other type, indicating that each element of the specified list should be of that type.
``elements`` works in combination with ``type`` when ``type='list'``. ``elements`` can then be defined as ``elements='int'`` or any other type, indicating that each element of the specified list should be of that type.
default
"""""""
:default:
The ``default`` option allows sets a default value for the argument for the scenario when the argument is not provided to the module. When not specified, the default value is ``None``.
The ``default`` option allows sets a default value for the argument for the scenario when the argument is not provided to the module. When not specified, the default value is ``None``.
fallback
""""""""
:fallback:
``fallback`` accepts a ``tuple`` where the first argument is a callable (function) that will be used to perform the lookup, based on the second argument. The second argument is a list of values to be accepted by the callable.
``fallback`` accepts a ``tuple`` where the first argument is a callable (function) that will be used to perform the lookup, based on the second argument. The second argument is a list of values to be accepted by the callable.
The most common callable used is ``env_fallback`` which will allow an argument to optionally use an environment variable when the argument is not supplied.
The most common callable used is ``env_fallback`` which will allow an argument to optionally use an environment variable when the argument is not supplied.
Example::
Example:
username=dict(fallback=(env_fallback, ['ANSIBLE_NET_USERNAME']))
.. code-block:: python
choices
"""""""
username=dict(fallback=(env_fallback, ['ANSIBLE_NET_USERNAME']))
``choices`` accepts a list of choices that the argument will accept. The types of ``choices`` should match the ``type``.
:choices:
required
""""""""
``choices`` accepts a list of choices that the argument will accept. The types of ``choices`` should match the ``type``.
``required`` accepts a boolean, either ``True`` or ``False`` that indicates that the argument is required. When not specified, ``required`` defaults to ``False``. This should not be used in combination with ``default``.
:required:
no_log
""""""
``required`` accepts a boolean, either ``True`` or ``False`` that indicates that the argument is required. When not specified, ``required`` defaults to ``False``. This should not be used in combination with ``default``.
``no_log`` accepts a boolean, either ``True`` or ``False``, that indicates explicitly whether or not the argument value should be masked in logs and output.
:no_log:
.. note::
In the absence of ``no_log``, if the parameter name appears to indicate that the argument value is a password or passphrase (such as "admin_password"), a warning will be shown and the value will be masked in logs but **not** output. To disable the warning and masking for parameters that do not contain sensitive information, set ``no_log`` to ``False``.
``no_log`` accepts a boolean, either ``True`` or ``False``, that indicates explicitly whether or not the argument value should be masked in logs and output.
aliases
"""""""
.. note::
In the absence of ``no_log``, if the parameter name appears to indicate that the argument value is a password or passphrase (such as "admin_password"), a warning will be shown and the value will be masked in logs but **not** output. To disable the warning and masking for parameters that do not contain sensitive information, set ``no_log`` to ``False``.
``aliases`` accepts a list of alternative argument names for the argument, such as the case where the argument is ``name`` but the module accepts ``aliases=['pkg']`` to allow ``pkg`` to be interchangeably with ``name``
:aliases:
options
"""""""
``aliases`` accepts a list of alternative argument names for the argument, such as the case where the argument is ``name`` but the module accepts ``aliases=['pkg']`` to allow ``pkg`` to be interchangeably with ``name``
``options`` implements the ability to create a sub-argument_spec, where the sub options of the top level argument are also validated using the attributes discussed in this section. The example at the top of this section demonstrates use of ``options``. ``type`` or ``elements`` should be ``dict`` is this case.
:options:
apply_defaults
""""""""""""""
``options`` implements the ability to create a sub-argument_spec, where the sub options of the top level argument are also validated using the attributes discussed in this section. The example at the top of this section demonstrates use of ``options``. ``type`` or ``elements`` should be ``dict`` is this case.
``apply_defaults`` works alongside ``options`` and allows the ``default`` of the sub-options to be applied even when the top-level argument is not supplied.
:apply_defaults:
In the example of the ``argument_spec`` at the top of this section, it would allow ``module.params['top_level']['second_level']`` to be defined, even if the user does not provide ``top_level`` when calling the module.
``apply_defaults`` works alongside ``options`` and allows the ``default`` of the sub-options to be applied even when the top-level argument is not supplied.
removed_in_version
""""""""""""""""""
In the example of the ``argument_spec`` at the top of this section, it would allow ``module.params['top_level']['second_level']`` to be defined, even if the user does not provide ``top_level`` when calling the module.
``removed_in_version`` indicates which version of Ansible a deprecated argument will be removed in.
:removed_in_version:
``removed_in_version`` indicates which version of ansible-base or a collection a deprecated argument will be removed in. Mutually exclusive with ``removed_at_date``, and must be used with ``removed_from_collection``.
Example:
.. code-block:: python
'option': {
'type': 'str',
'removed_in_version': '2.0.0',
'collection_name': 'testns.testcol',
},
:removed_at_date:
``removed_at_date`` indicates that a deprecated argument will be removed in a minor ansible-base release or major collection release after this date. Mutually exclusive with ``removed_in_version``, and must be used with ``removed_from_collection``.
Example:
.. code-block:: python
'option': {
'type': 'str',
'removed_at_date': '2020-12-31',
'collection_name': 'testns.testcol',
},
:removed_from_collection:
Specifies which collection (or ansible-base) deprecates this deprecated argument. Specify ``ansible.builtin`` for ansible-base, or the collection's name (format ``foo.bar``). Must be used with ``removed_in_version`` or ``removed_at_date``.
:deprecated_aliases:
Deprecates aliases of this argument. Must contain a list or tuple of dictionaries having some the following keys:
:name:
The name of the alias to deprecate. (Required.)
:version:
The version of ansible-base or the collection this alias will be removed in. Either ``version`` or ``date`` must be specified.
:date:
The a date after which a minor release of ansible-base or a major collection release will no longer contain this alias.. Either ``version`` or ``date`` must be specified.
:collection_name:
Specifies which collection (or ansible-base) deprecates this deprecated alias. Specify ``ansible.builtin`` for ansible-base, or the collection's name (format ``foo.bar``). Must be used with ``version`` or ``date``.
Examples:
.. code-block:: python
'option': {
'type': 'str',
'aliases': ['foo', 'bar'],
'depecated_aliases': [
{
'name': 'foo',
'version': '2.0.0',
'collection_name': 'testns.testcol',
},
{
'name': 'foo',
'date': '2020-12-31',
'collection_name': 'testns.testcol',
},
],
},
:mutually_exclusive:
If ``options`` is specified, ``mutually_exclusive`` refers to the sub-options described in ``options`` and behaves as in :ref:`argument_spec_dependencies`.
:required_together:
If ``options`` is specified, ``required_together`` refers to the sub-options described in ``options`` and behaves as in :ref:`argument_spec_dependencies`.
:required_one_of:
If ``options`` is specified, ``required_one_of`` refers to the sub-options described in ``options`` and behaves as in :ref:`argument_spec_dependencies`.
:required_if:
If ``options`` is specified, ``required_if`` refers to the sub-options described in ``options`` and behaves as in :ref:`argument_spec_dependencies`.
:required_by:
If ``options`` is specified, ``required_by`` refers to the sub-options described in ``options`` and behaves as in :ref:`argument_spec_dependencies`.
.. _argument_spec_dependencies:
Dependencies between module options
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The following are optional arguments for ``AnsibleModule()``:
.. code-block:: python
module = AnsibleModule(
argument_spec,
mutually_exclusive=[
('path', 'content'),
],
required_one_of=[
('path', 'content'),
],
)
:mutually_exclusive:
Must be a sequence (list or tuple) of sequences of strings. Every sequence of strings is a list of option names which are mutually exclusive. If more than one options of a list are specified together, Ansible will fail the module with an error.
Example:
.. code-block:: python
mutually_exclusive=[
('path', 'content'),
('repository_url', 'repository_filename'),
],
In this example, the options ``path`` and ``content`` must not specified at the same time. Also the options ``repository_url`` and ``repository_filename`` must not be specified at the same time. But specifying ``path`` and ``repository_url`` is accepted.
To ensure that precisely one of two (or more) options is specified, combine ``mutually_exclusive`` with ``required_one_of``.
:required_together:
Must be a sequence (list or tuple) of sequences of strings. Every sequence of strings is a list of option names which are must be specified together. If at least one of these options are specified, the other ones from the same sequence must all be present.
Example:
.. code-block:: python
required_together=[
('file_path', 'file_hash'),
],
In this example, if one of the options ``file_path`` or ``file_hash`` is specified, Ansible will fail the module with an error if the other one is not specified.
:required_one_of:
Must be a sequence (list or tuple) of sequences of strings. Every sequence of strings is a list of option names from which at least one must be specified. If none one of these options are specified, Ansible will fail module execution.
Example:
.. code-block:: python
required_one_of=[
('path', 'content'),
],
In this example, at least one of ``path`` and ``content`` must be specified. If none are specified, execution will fail. Specifying both is explicitly allowed; to prevent this, combine ``required_one_of`` with ``mutually_exclusive``.
:required_if:
Must be a sequence of sequences. Every inner sequence describes one conditional dependency. Every sequence must have three or four values. The first two values are the option's name and the option's value which describes the condition. The further elements of the sequence are only needed if the option of that name has precisely this value.
If you want that all options in a list of option names are specified if the condition is met, use one of the following forms:
.. code-block:: python
('option_name', option_value, ('option_a', 'option_b', ...)),
('option_name', option_value, ('option_a', 'option_b', ...), False),
If you want that at least one option of a list of option names is specified if the condition is met, use the following form:
.. code-block:: python
('option_name', option_value, ('option_a', 'option_b', ...), True),
Example:
.. code-block:: python
required_if=[
('state', 'present', ('path', 'content'), True),
('force', True, ('force_reason', 'force_code')),
],
In this example, if the user specifies ``state=present``, at least one of the options ``path`` and ``content`` must be supplied (or both). To make sure that precisely one can be specified, combine ``required_if`` with ``mutually_exclusive``.
On the other hand, if ``force`` (a boolean parameter) is set to ``true``, ``yes`` etc., both ``force_reason`` and ``force_code`` must be specified.
:required_by:
Must be a dictionary mapping option names to sequences of option names. If the option name in a dictionary key is specified, the option names it maps to must all also be specified. Note that instead of a sequence of option names, you can also specify one single option name.
Example:
.. code-block:: python
required_by={
'force': 'force_reason',
'path': ('mode', 'owner', 'group'),
},
In the example, if ``force`` is specified, ``force_reason`` must also be specified. Also, if ``path`` is specified, then three three options ``mode``, ``owner`` and ``group`` also must be specified.
Declaring check mode support
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To declare that a module supports check mode, supply ``supports_check_mode=True`` to the ``AnsibleModule()`` call:
.. code-block:: python
module = AnsibleModule(argument_spec, supports_check_mode=True)
The module can determine whether it is called in check mode by checking the boolean value ``module.check_mode``. If it evaluates to ``True``, the module must take care not to do any modification.
If ``supports_check_mode=False`` is specified, which is the default value, the module will exit in check mode with ``skipped=True`` and message ``remote module (<insert module name here>) does not support check mode``.
Adding file options
^^^^^^^^^^^^^^^^^^^
To declare that a module should add support for all common file options, supply ``add_file_common_args=True`` to the ``AnsibleModule()`` call:
.. code-block:: python
module = AnsibleModule(argument_spec, add_file_common_args=True)
You can find `a list of all file options here <https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/doc_fragments/files.py>`_. It is recommended that you make your ``DOCUMENTATION`` extend the doc fragment ``ansible.builtin.files`` (see :ref:`module_docs_fragments`) in this case, to make sure that all these fields are correctly documented.
The helper functions ``module.load_file_common_arguments()`` and ``module.set_fs_attributes_if_different()`` can be used to handle these arguments for you:
.. code-block:: python
argument_spec = {
'path': {
'type': 'str',
'required': True,
},
}
module = AnsibleModule(argument_spec, add_file_common_args=True)
changed = False
# TODO do something with module.params['path'], like update it's contents
# Ensure that module.params['path'] satisfies the file options supplied by the user
file_args = module.load_file_common_arguments(module.params)
changed = module.set_fs_attributes_if_different(file_args, changed)
module.exit_json(changed=changed)

Some files were not shown because too many files have changed in this diff Show More