Compare commits

...

102 Commits

Author SHA1 Message Date
f21dfd85cd New release v2.5.11 2018-10-31 10:04:22 -07:00
ffcad9adec [stable-2.5] Detect the socket path after starting the service. Fixes #47582 (#47626)
(cherry picked from commit 10e129e)

Co-authored-by: Matt Martz <matt@sivel.net>
2018-10-25 15:20:47 -07:00
cdc798df8f [stable-2.5] Fix mysql authentication errors (#47596)
The mysql-server package on Ubuntu16.04 was recently updated to disallow
unauthenticated root user login over tcp/ip.  This, coupled with pymysql
using tcp/ip whenever host and port is specified causes us to fail to
connect to the database when testing Python3 on Ubuntu16.04.

The fix is to use the unix socket instead..
(cherry picked from commit 748ea39ecd)

Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
2018-10-25 14:05:08 -07:00
77928e6c3a 2.5: user: do not pass ssh_key_passphrase on cmdline (#47486)
* user: do not pass ssh_key_passphrase on cmdline

* user: do not pass ssh_key_passphrase on cmdline

CVE-2018-16837

Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
(cherry picked from commit a0aa53d1a1)

* Ignore user module use of subprocess.

(cherry picked from commit 8d00afc013)

* Fix python3 problem in user module cve fix

(cherry picked from commit 9088671c4e)

* Fix changelog entry for user module CVE fix

(cherry picked from commit 210a43ebeb)
(cherry picked from commit b618339c32)

* zap ignore entry
2018-10-24 11:04:14 -07:00
97826dc970 ansible-test: add retry for Windows httptester download (#47334)
(cherry picked from commit e6a327fb82)
2018-10-19 07:29:53 -07:00
5e7d057b36 win httptester: add wait for endpoint in case it is still coming up (#47326)
(cherry picked from commit c0546b4133)
2018-10-18 21:03:31 -07:00
292c7db739 Add constraint for requests on python 2.6. (#47306)
* Add constraint for requests on python 2.6.

(cherry picked from commit f74f7b0373)
2018-10-18 14:25:26 -07:00
999bd5e695 ansible-test: setup up http runner in between each target (#47100)
* ansible-test: setup up http runner in between each target

* review changes

(cherry picked from commit 9a5561da0f)
2018-10-16 16:51:33 -07:00
65920fccf1 ansible-test: run win httptester with bypass policy (#47090)
(cherry picked from commit 69e1088ec1)
2018-10-16 16:51:33 -07:00
1d3aef6917 win test: add http tester container to Windows tests (#46606)
(cherry picked from commit 6e2897647c)
2018-10-16 16:51:33 -07:00
481c48c708 ansible-test: add skip/windows/... alias to skip tests on specific Windows versions (#46845)
* ansible-test: add skip/windows/... alias to skip tests on specific Windows versions

* show what tests were skipped

* changes to logic to only skip if all Windows targets are set to skip

* codestyle improvements

* change warning message based on review

* check args type before running the Windows path

(cherry picked from commit 0f5331645f)
2018-10-16 16:51:33 -07:00
00bf656c89 win_uri: use variable for httpbin host (#46734)
(cherry picked from commit f34f75be45)
2018-10-16 16:51:33 -07:00
cadc146ffe ps-lint: ignore rules that are not relevant to Ansible (#46376)
(cherry picked from commit ba638f40cf)
2018-10-16 16:50:25 -07:00
abef1d5dd3 [stable-2.5] Update requirements for urllib3 for python 2.6.
(cherry picked from commit d048785640)

Co-authored-by: Matt Clay <matt@mystile.com>
2018-10-16 15:40:16 -07:00
31ed283e33 ansible-test: swap 2.5 to use AWS and not Azure 2018-10-15 15:44:06 -07:00
9dda676118 Make filters doc easier to read. Backport of #46569. (#47000) 2018-10-15 16:52:34 -05:00
ca13e678ae Backport test infra fixes and updates to stable-2.5. (#46992)
* Fix unit test parametrize order on Python 3.5.

(cherry picked from commit 53b230ca74)

* Fix ansible-test unit test execution. (#45772)

* Fix ansible-test units requirements install.
* Run unit tests as unprivileged user under Docker.

(cherry picked from commit 379a7f4f5a)

* Run unit tests in parallel. (#45812)

(cherry picked from commit abe8e4c9e8)

* Minor fixes for unit test delegation.

(cherry picked from commit be199cfe90)

* add support for opening shell on remote Windows host (#43919)

* add support for opening shell on remote Windows host

* added arg completion and fix sanity check

* remove uneeded arg

(cherry picked from commit 6ca4ea0c1f)

* Block network access for unit tests in docker.

(cherry picked from commit 99cac99cbc)

* Make ansible-test available in the bin directory. (#45876)

(cherry picked from commit f3d1f9544b)

* Support comments in ansible-test flat files.

(cherry picked from commit 5a3000af19)

* Fix incorrect use of subprocess.CalledProcessError (#45890)

(cherry picked from commit 24dd87bd0a)

* Improve ansible-test match error handling.

(cherry picked from commit 2056c981ae)

* Improve error handling for docs-build test.

(cherry picked from commit 2148999048)

* Bug fixes and cleanup for ansible-test. (#45991)

* Remove unused imports.
* Clean up ConfigParser usage in ansible-test.
* Fix bare except statements in ansible-test.
* Miscellaneous cleanup from PyCharm inspections.
* Enable pylint no-self-use for ansible-test.
* Remove obsolete pylint ignores for Python 3.7.
* Fix shellcheck issuers under newer shellcheck.
* Use newer path for ansible-test.
* Fix issues in code-smell tests.

(cherry picked from commit ac492476e5)

* Fix integration test library search path.

This prevents tests from loading modules outside the source tree,
which could result in testing the wrong module if a system-wide
install is present, or custom modules exist.

(cherry picked from commit d603cd41fe)

* Update default container to version 1.2.0.

(cherry picked from commit d478a4c3f6)
(cherry picked from commit 21c4eb8db5)

* Fix ansible-test docker python version handling.

This removes the old name based version detection behavior and
uses versions defined in the docker completion file instead, as
the new containers do not follow the old naming scheme.

(cherry picked from commit 54937ba784)

* Reduce noise in docs-build test failures.

(cherry picked from commit 4085d01617)

* Fix ansible-test encoding issues for exceptions.

(cherry picked from commit 0d7a156319)

* Fix ansible-test multi-group smoke test handling. (#46363)

* Fix ansible-test smoke tests across groups.
* Fix ansible-test list arg defaults.
* Fix ansible-test require and exclude delegation.
* Fix detection of Windows specific changes.
* Add minimal Windows testing for Python 3.7.

(cherry picked from commit e53390b3b1)

* Use default-test-container version 1.3.0.

(cherry picked from commit 6d9be66418)

* Add file exists check in integration-aliases test.

(cherry picked from commit 33a8be9109)

* Improve ansible-test environment checking between tests. (#46459)

* Add unified diff output to environment validation.

This makes it easier to see where the environment changed.

* Compare Python interpreters by version to pip shebangs.

This helps expose cases where pip executables use a different
Python interpreter than is expected.

* Query `pip.__version__` instead of using `pip --version`.

This is a much faster way to query the pip version. It also more
closely matches how we invoke pip within ansible-test.

* Remove redundant environment scan between tests.

This reuses the environment scan from the end of the previous test
as the basis for comparison during the next test.

(cherry picked from commit 0dc7f38787)

* Add symlinks sanity test. (#46467)

* Add symlinks sanity test.
* Replace legacy test symlinks with actual content.
* Remove dir symlink from template_jinja2_latest.
* Update import test to use generated library dir.
* Fix copy test symlink setup.

(cherry picked from commit e2b6047514)

* Fix parametrize warning in unit tests.

(cherry picked from commit 1a28898a00)

* Update MANIFEST.in (#46502)

* Update MANIFEST.in:

- Remove unnecessary prune.
- Include files needed by tests.
- Exclude botmeta sanity test.

These changes permit sanity tests to pass on sdist output.
(cherry picked from commit cbb49f66ec)

* Fix unit tests which modify the source tree. (#45763)

* Fix CNOS unit test log usage.
* Use temp dir for Galaxy unit tests.
* Write to temp files in interfaces_file unit test.
* Fix log placement in netapp_e_ldap unit test.

(cherry picked from commit 0686450cae)

* Fix ansible-test custom docker image traceback.

(cherry picked from commit 712ad9ed64)

* ansible-test: Create public key creating Windows targets (#43760)

* ansible-test: Create public key creating Windows targets

* Changed to always set SSH Key for Windows hosts

(cherry picked from commit adc0efe10c)

* Fix and re-enable sts_assume_role integration tests (#46026)

* Fix the STS assume role error message assertion when the role to assume does not exist.

(cherry picked from commit 18dc928e28)

* Fix ACI unit test on Python 3.7.0.

The previous logic was only needed for pre-release versions of 3.7.

(cherry picked from commit c0bf9815c9)

* Remove placeboify from unit tests that are not calling AWS (i.e. creating a recording) (#45754)

(cherry picked from commit 2167ce6cb6)

* Update sanity test ignore entries.
2018-10-13 10:44:11 -07:00
f9c4da4cdf ansible-test: set ulimit to enforce consistent test environment (#46652)
* ansible-test: set ulimit to enforce consistent test environment

* fixed santiy issue

(cherry picked from commit 7b774117ab)
2018-10-09 18:56:02 -07:00
034e5b6341 Use default Shippable container. (#46703)
(cherry picked from commit 40c9301b27)
2018-10-09 11:47:39 -07:00
9a497b0557 Add 'auto' to documented default enabled inventory plugins (#46621) (#46639)
* Correct default inventory plugins enabled in docs and example/ansible.cfg

* Fix headers

(cherry picked from commit 43d12c11be)
2018-10-08 15:22:32 -05:00
b074980d12 updated to 2.7 and fixed merge conflict (#46417) 2018-10-02 16:22:44 -05:00
37ca38bf67 New release v2.5.10 2018-09-27 16:30:06 -07:00
954bf74158 doc: index_var: fix version added (#37982) (#46224)
e9b0a4ccb4 is present since v2.5.0b1

(cherry picked from commit 2a604f6fe6)
2018-09-27 13:58:53 -05:00
ade5934d33 skip installing linux-image-extra in CI as it shouldn't be needed (#46101) (#46131)
(cherry picked from commit 40379b76b1)
2018-09-25 13:25:33 -07:00
e0eec68fe2 [stable-2.5] Fix issues with PLUGIN_FILTERS_CFG config handling (#45994) (#46092)
* Ensure that the value of PLUGIN_FILTERS_CFG is treated as type=path, and that we use the standard section of 'defaults' instead of 'default'

* deprecate the default section

* Don't add version_added for the corrected section
(cherry picked from commit 172137c)

Co-authored-by: Matt Martz <matt@sivel.net>
2018-09-25 13:25:06 -07:00
412b6a8ca7 append AWS region to test instance file (#45877) (#45884)
(cherry picked from commit 582a4dfa13)
2018-09-25 13:24:30 -07:00
ad1c62d6dd Added default value for when CloudFrontOriginAccessIdentityList is (#44984)
missing.

(cherry picked from commit 93cd050250)
2018-09-25 13:18:11 -07:00
7aad590d3d [stable-2.5] Migrate from MySQLdb to PyMySQL (#40123) (#45982)
* Migrate from MySQLdb to PyMySQL

* Deduplicate driver loading and failure message

* Explain requirements

* Apply requirements docs change to proxysql too

* Add changelog.
(cherry picked from commit d34cf93f1a)

Co-authored-by: Daniel Speichert <DSpeichert@users.noreply.github.com>
2018-09-25 10:10:28 -07:00
c484a6efdd add skip/docker alias to skip tests when running on Docker (#45955) (#45959)
* add skip/docker alias to skip tests when running on Docker

* changed warning message wording

(cherry picked from commit 27c10fa502)
2018-09-25 09:14:31 -07:00
65fa6c17a7 go back to FreeBSD 11.1 for tests due to 11.2 stability issues (#45872) (#45873)
(cherry picked from commit a7d372c3ba)
2018-09-25 09:12:51 -07:00
4e2d6df970 [stable-2.5] Support transfering empty files to target host. Fixes #36725 (#45751) (#45790)
(cherry picked from commit b6fcbfe)

Co-authored-by: Matt Martz <matt@sivel.net>
2018-09-25 09:11:51 -07:00
c60c27b7da Backport 2.5: Return correct version on installed VyOS (#39115) (#45715)
* Return correct version on installed VyOS (#39115)

* Return correct version on installed VyOS

Previously existing regexp will shows only "VyOS" without numeric output of router version.
For example: from  "Version:      VyOS 1.1.6" only VyOS will be written in ansible_net_version variable
For more informative output numeric value should be returned as well

* Fixed unittests

(cherry picked from commit 235b11f681)

* Added changelog
2018-09-25 09:10:52 -07:00
6eb21c7852 [stable-2.5] Support empty files with piped transfer_method. Fixes #45426 (#45618) (#45626)
(cherry picked from commit e68f895)

Co-authored-by: Matt Martz <matt@sivel.net>
2018-09-25 09:10:00 -07:00
0ba6cbfd02 [stable-2.5] Fix logic to not re-download existing files when force=no (#45495) (#45509) (#45567)
* [stable-2.5] [stable-2.7] Fix logic to not re-download existing files when force=no (#45495) (#45509)

* [stable-2.7] Fix logic to not re-download existing files when force=no (#45495)

* Fix logic to not re-download existing files when force=no. Fixes #45491

* Reduce logic complexity.
(cherry picked from commit 5785de582f)

Co-authored-by: Matt Martz <matt@sivel.net>

* Backport of get_url fix cannot use result

result was only added in 2.8+.
(cherry picked from commit 99171a9c6f)

Co-authored-by: Matt Martz <matt@sivel.net>

* Update get_url.py
2018-09-25 09:09:18 -07:00
1c8aeb0410 reordered windows test groups for better efficiency (#45445) (#45449)
(cherry picked from commit 25ae4f2b73)
2018-09-25 09:07:00 -07:00
d1ef02c714 [stable-2.5] Don't pass file_name to DataLoader.load in script inventory plugin (#45428) (#45441)
* Don't pass file_name to DataLoader.load in script inventory plugin. Fixes #34164

* Add changelog fragment
(cherry picked from commit 263b9fa)

Co-authored-by: Matt Martz <matt@sivel.net>
2018-09-25 09:06:32 -07:00
9046c3e63c [stable-2.5] Ensure loop with delegate_to can short circuit the same as without delegate_to. Fixes #45189 (#45231). (#45354)
(cherry picked from commit 2ac647def8)
2018-09-25 09:00:24 -07:00
52e4d2b36c [2.5] Fix python2.6 nothing to repeat nxos terminal plugin bug (#45283)
* fix python26 nxos terminal plugin bug (#45271)

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
(cherry picked from commit c98494d5bf)

* nxos terminal plugin changelog

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* Update nxos_terminal_plugin_2.5.yaml
2018-09-25 08:59:20 -07:00
72889706d3 [stable-2.5] HashiVault: fix AttributeError when auth_method != 'token' (#36513) (#45243)
* Fixed `'HashiVault' object has no attribute 'verify'"}` (#36513)


(cherry picked from commit 0ceb717cae)

* Add changelog entry

* Update hashi_vault_fix_object_has_no_attribute_verify
2018-09-25 08:57:48 -07:00
f87f239925 Restore license agreement (#45809) (#46019)
* adds page for CLA in community docs with link from community index

(partial cherry-pick from commit f430f60541)
2018-09-21 19:24:44 -05:00
c25d2f2562 Backport a change on doc for lvol module (#45914)
* Documentation change for resizefs (#43224)
Changed documentation to match the default value of resizefs set in the code.
Added a note on the resizefs use on the example utilizing it.
2018-09-21 15:53:31 -05:00
062113731a Update RHEL and FreeBSD versions used for tests:
- RHEL 7.4 -> 7.5
- FreeBSD 11.1 -> 11.2

(cherry picked from commit c50d6f1944)
2018-09-12 10:19:07 -07:00
7fc2fbb55c New release v2.5.9 2018-09-10 04:34:45 -07:00
729736f30c Remove obsolete default container.
(cherry picked from commit 4173a30941)
2018-09-05 19:21:48 -07:00
e7d75d4bff Switch default test container to quay.io.
(cherry picked from commit 3f8edb440a)
2018-09-05 19:21:48 -07:00
8e048c0ab7 Fixes for ansible-test sanity import test. (#45249)
* Fix import test on Python 3.7.
* Fix path processing in import sanity test.

(cherry picked from commit 6fb333faff)
2018-09-05 19:21:48 -07:00
0c3faa2e1c Fix ansible-test virtualenv use in import test.
(cherry picked from commit 998badbda5)
2018-09-05 19:21:48 -07:00
9ac580f564 Update test constraints. (#44975)
- Limit virtualenv version on Python 2.6.
- Limit pyopenssl version on Python 2.6.
- Pin pyfmg version to keep unit tests passing.

(cherry picked from commit b3a3e8ba7b)
2018-09-05 19:21:48 -07:00
c8eeafdc15 Flush output from timing script.
(cherry picked from commit 771768966f)
2018-09-05 19:21:48 -07:00
fb153e4da7 Add seccomp support to ansible-test.
(cherry picked from commit c1173a2aec)
2018-09-05 19:21:48 -07:00
339d064584 Correct to development_process (#39069) (#45264)
(cherry picked from commit c4e298b808)
2018-09-05 20:52:50 -05:00
38b9fee32f Get packages for dnf and yum tests from S3.
(cherry picked from commit 22d5f5d97f)
2018-09-05 15:35:01 -07:00
7113e50a42 Fix ios_user issue CP in 2.5 (#45180)
* Fix ios_user issues (#44904)

* Fix ios_user issues

* Modify regex and fix unittests

(cherry picked from commit 0f268e70a1)

* Added changelog
2018-09-05 11:08:43 -07:00
5ea238912f [stable-2.5] Don't allow import_tasks to transition to dynamic when file is missing. See #44822 (#44836) (#44854)
* [stable-2.5] Don't allow import_tasks to transition to dynamic when file is missing. See #44822 (#44836)
(cherry picked from commit cd2f66f)

Co-authored-by: Matt Martz <matt@sivel.net>

* Look in task_ds, as we don't have action var in 2.5
2018-09-05 11:08:09 -07:00
d89bd2d3c1 [stable-2.5] Fix another corner case of too many warnings for world readable current working directory (#44610)
There should be no warning if there is no ansible.cfg file i nthe
current working directory.
(cherry picked from commit f46c943)

Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
2018-09-05 11:07:31 -07:00
2a2e4721a4 Pass path to GalaxyRole object (#43051) (#44583)
This will list all roles in all paths in roles_path rather than just the first path in roles_path.

(cherry picked from commit 05fff27415)
2018-09-05 11:06:39 -07:00
12d0684ee2 Fix enable_snat parameter (#44418) (#44451)
* Fix enable_snat parameter (#44418)

Fixes the issue #44285
(cherry picked from commit b7139782cf)

* Fix enable_snat parameter (#44418)

Fixes the issue #44285
(cherry picked from commit b7139782cf)

* Fix enable_snat parameter (#44418)

Fixes the issue #44285
(cherry picked from commit b7139782cf)
2018-09-05 11:06:06 -07:00
8854f77d67 Strip trailing comments from /etc/default/passwd (#43931) (#44367)
* strip additional comments from /etc/default/passwd

Strip trailling comments from /etc/default/passwd like
MINWEEKS=1 #MINWEEKS=2
MAXWEEKS=12  # MAXWEEKS=8
Which otherwise cause failures with "failed to read /etc/default/passwd: too many values to unpack"

* fix carriage return typo in commit

* yet another typo in commit

* Fix indent problem

* add changelog fragment for PR 43931

(cherry picked from commit 5c1e620504)
2018-09-05 11:05:26 -07:00
3f80b6ccb1 Remove python-keyczar dependency (#38534) (#44321)
(cherry picked from commit 02bc4c570f)
2018-09-05 11:04:38 -07:00
847a7f9ca5 Fix ios_vlan and ios_l2_interface issues CP in 2.5 (#44253)
* Fixes ios_l2_interface and ios_vlan not working on certain interface types issue (#43819)

* Fixes #43654 and #43582

* Remove q statement

* Fix shippable errors

* Fix more shippable errors

* Fix unittest

(cherry picked from commit b14f256d41)

* Added changelog entries

* Fixed Shippable yamllint error
2018-09-05 11:04:07 -07:00
3e6cc1abd5 nxos bugfix Pick 2.5 (#44249)
* nxos_interface port-channel idempotence fix for mode (#44248)

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
(cherry picked from commit 6af6e806ed)

* changelog

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* Add md5sum check in nxos_file_copy module (#43423)

* Add md5sum check in nxos_file_copy module

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* address review comment

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
(cherry picked from commit fee4c24ad4)

* changelog

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* check_mode in nxos_static_route module (#44252)

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
(cherry picked from commit 7e39c5bf07)

* changelog nxos_static_route

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* nxos_linkagg mode fix (#44294)

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
(cherry picked from commit 6090802551)

* changelog nxos_linkagg

* fix Python 2.6 regex bug terminal plugin nxos, iosxr (#45135)

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
(cherry picked from commit ab3cd10dfe)

* terminal plugin changelog

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2018-09-05 11:03:19 -07:00
019c28bc3b Broken dependencies in 2.5 (#41952)
* essential fixes in 2.5

* one more fix

* disable try to see whats the problem

* fix indent

* try to fix msrest version

* fixed test

* undo try-except commenting out

* updated tests
2018-09-05 11:02:00 -07:00
6321e70232 Backport/2.5/44902 (#44920)
* Update lightsail.py
(cherry picked from commit dc8307a063)
* Correct AWS Lightsail documentation example
* add changelog fragment
2018-08-30 15:30:49 -05:00
0724f4bfc2 Remove obsolete test/utils/docker/ directory.
(cherry picked from commit 78bd020429)
2018-08-30 09:12:26 -07:00
642c1d16fb List quay.io images during Shippable run.
(cherry picked from commit a96a51b0c6)
2018-08-30 09:12:26 -07:00
9959d7f722 Switch distro test containers to quay.io images.
(cherry picked from commit 773c0982b0)
2018-08-30 09:12:26 -07:00
de932d9c17 Fix change detection on retried Shippable jobs.
(cherry picked from commit c0aaf0fff7)
2018-08-30 09:12:26 -07:00
053273fc7e Ignore CentOS 6.10 for passwordstore test.
(cherry picked from commit 18da873531)
2018-08-30 09:12:26 -07:00
8ab11c3228 Restore repos after zypper_repository test runs.
This also allows the test to run on newer containers by not
manipulating any of the pre-configured repositories.

(cherry picked from commit cac51e6da8)
2018-08-30 09:12:26 -07:00
36fd4a2255 Documentation fix, decrypt is True by default (#44435) (#44472)
(cherry picked from commit 88659dcba4)
2018-08-27 18:26:57 -05:00
c5d9c98cdf Use runtime instead of datetime for test output.
(cherry picked from commit 31a5b874a1)
2018-08-23 14:21:12 -07:00
b23b1c2ee0 New release v2.5.8 2018-08-16 14:45:46 -07:00
d19ef234bd Fix path handling in hacking/env-setup. (#44086)
(cherry picked from commit 0392dbeba1)
2018-08-13 18:19:04 -07:00
f73ac53e58 Only template values in vars_prompt rather than all vars (#39304) (#44082)
This allows the use of variables in vars_prompt fields but allows variables entered in the prompt to affect play vars rather than throwing an undefined error.

Add tests for vars_prompt

(cherry picked from commit 6d38167d49)
2018-08-13 18:18:48 -07:00
4c9e83f9f5 [stable-2.5] Fix the local and ssh plugins for a cornercase retrying a syscall (#44074)
The bundled selectors library which is used by the local and ssh
connection plugins had a bug which caused a traceback in a cornercase.
If selectors were in use and a syscall was interrupted, selectors would
attempt to restart the syscall after the interrupt was processed.  if
the attempt determined that the timeout for running the syscall had
already expired, the code attempted to raise OSError.  The raise was
using a Python3-ism and needed to be ported to work on Python2.

Fixes #41630
(cherry picked from commit e2e44f8)

Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
2018-08-13 18:17:50 -07:00
e107da11e0 Fix fact cleaning (#42595) (#43956)
* Fix fact cleaning (#42595)

* fix fact cleanup

fixes #41684

(cherry picked from commit 006f08da99)

* fix misspelled key name

* update changelog text
2018-08-13 18:17:03 -07:00
8d2c129944 [stable-2.5] Only print warning when ansible.cfg is actually skipped (#43583) (#43649)
Only print warning when ansible.cfg is actually skipped

* Also add unittests for the find_ini_config_file function
* Add documentation on world writable current working directory
  config files can no longer be loaded from a world writable current
  working directory but the end user is allowed to specify that
  explicitly.  Give appropriate warnings and information on how.

Fixes #42388
(cherry picked from commit 30662bedad)

Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
2018-08-13 18:16:24 -07:00
e22bff5b76 [2.5] Fix invocation output. Fixes #43447 (#43542) (#43647)
* [2.5] Fix invocation output. Fixes #43447 (#43542)
(cherry picked from commit 4094b01)

Co-authored-by: Matt Martz <matt@sivel.net>

* Add changelog for #43542
2018-08-13 18:15:22 -07:00
3f7ca8daf1 fix issue [ get_url does not change mode when checksum matches ] (#43342) (#43623)
* fix  #29614

* add change log for #43342

* Cleanup tests and add tests for this scenario


Co-authored-by: ptux
(cherry picked from commit 68683b4c73)
2018-08-13 18:14:53 -07:00
8a0fa4a3e3 Fix for creation and removal of swap record in fstab (fixes #42706, #31437 and #30090) (#42837) (#43518) 2018-08-13 18:13:25 -07:00
0854dc3f7f Add AnsibleModule signature schema, and fix associated issues (#43512) (#43515)
* Add AnsibleModule signature schema, and fix associated issues (#43512)

(cherry picked from commit 01c0446cb5)

* Address additional module issues
2018-08-13 18:12:37 -07:00
959a19e4f1 Fixes #42042 (#42736)
There is no need to add an empty hosts group, when region is not set
2018-08-13 18:10:55 -07:00
8b2abfe446 openvswitch_db : Handle column value conversion and idempotency in no_key case (#43869)
* change column value to string. handle idempotency in no key case

* fix unit test failures in baseline

(cherry picked from commit 8eaebf86b6)
2018-08-13 17:52:47 -07:00
445a3e4127 Fix download URL for yum integration test.
(cherry picked from commit 3b693be80f)
2018-08-09 14:47:07 -07:00
6b81a39daa openvswitch_db: Make 'key' parameter optional (#42110) (#43552)
* openvswitch_db: Split key-value pairs correctly (#33335)

Map values can contain commas, e.g.
    - name: Configure OVN bridge mapping
      openvswitch_db:
        state: present                                                                                                                                                                                                                                table: open_vswitch                                                                                                                                                                                                                           record: .                                                                                                                                                                                                                                     col: external_ids                                                                                                                                                                                                                             key: ovn-bridge-mappings
        value: '"vmnet-static:br-vmnet-st,vmnet-dynamic:br-vmnet-dyn"'

Previous behaviour was splitting the value and raised an exception.
(cherry picked from commit 3c53e2f8ea)

* openvswitch_db: Make 'key' parameter optional (#42110)

The OVSDB schema consists of typed columns. The 'key' parameter is
required only for columns with type of a 'map'. This patch makes 'key'
an optional parameter to allow setting values for other column types
like int.

Fixes #42108

(cherry picked from commit 26b0908270)
(cherry picked from commit 01097715fd)
2018-08-08 16:01:42 +02:00
da043d635e Update JSON Query filter examples (#42432) (#43491)
* Update JSON Query filter examples

Correct syntax on one example
Add more examples of escaping
Change example to show joining list to string

(cherry picked from commit 7b0dea45e9)
2018-07-31 10:17:23 -05:00
41a0bcf2fc New release 2.5.7 2018-07-26 16:09:54 -07:00
fe61636d66 Remove unused test matrix entries. 2018-07-24 10:02:00 -07:00
bf8f228fd5 Update Shippable integration test groups. (#43118)
* Update Shippable integration test groups.
* Update integration test group aliases.
* Rebalance AWS and Azure tests with extra group.
* Rebalance Windows tests with another group.

(cherry picked from commit 4e489d1be8)
2018-07-24 10:02:00 -07:00
5805e6a89b Mark win_uri unstable.
(cherry picked from commit 547f11ad8f)
2018-07-23 18:28:04 -07:00
30a0c88c35 To fix EOS_FACTS failure when lldp will be disabled. (#42347)
* to fix the bug 41165

* adding the changelog file

* Hook check_rc failure up so that this will actually work

* Update eos_facts-failure.yml
2018-07-23 10:53:42 -07:00
f320b1507d Eos subnet overlap fix (#43023) (#43099)
* Detect overlapping subnet & provide better errors

(cherry picked from commit dba975470d)
2018-07-23 09:41:10 -07:00
d48ebcee40 [doc] fix a typo in ec2_eni docs (#36571) (#43068)
(cherry picked from commit 918b29f0fc)
2018-07-23 09:34:15 -07:00
8f3a82dc9b Avoid exiting config mode before configuring port-channel members (#42999) 2018-07-23 09:33:41 -07:00
85122a6c38 Fix ios_vlan issue CP in 2.5 (#42668)
* Make ios_vlan identify vlans starting with 9 (#42247)

* Make ios_vlan identify vlans starting with 9

* Add unit test for vlan id start with 9

(cherry picked from commit 70e33ef92c)

* Added changelog for ios_vlan fix
2018-07-23 09:25:18 -07:00
3a481c4548 Fix ios_linkagg issue CP in 2.5 (#42663)
* Fixed regex to pick correct items (#42557)

(cherry picked from commit fa624eba29)

* Added changelog for ios_linkagg fix
2018-07-23 09:23:07 -07:00
67859c3476 Fix NameError in pause module (#42038) (#42635)
* Fix NameError in pause module

* Add comment and changelog

Co-authored-by: Jerry Chong <jchong@netbase.com>
(cherry picked from commit 42f44b24c6)
2018-07-23 09:22:25 -07:00
dc37b41b72 [2.5] Update ios tests (#42509) (#42515)
* [2.5] Update ios tests (#42509)

* 192.168.0.1/24 conflicts with management IP

* Images don't have the hostnames we expect
(cherry picked from commit 399d13d)

Co-authored-by: Nathaniel Case <this.is@nathanielca.se>

* ios test cleanup pt 2 (#42570)

* Remove local from ios_config to avoid needing to add provider

* ios_smoke should test all with local to pick up the slack

(cherry picked from commit 381263ad99)
2018-07-23 09:21:16 -07:00
e3993bd01b nxos_nxapi fix pick-2.5 (#42490)
* Enforcing NXAPI default HTTP behavior (#41817)

* nxos_nxapi http default behavior

* Use nxos_nxapi module in prepare_nxos_tests

* Refactor nxos_nxapi configure test to use yaml block

* Extend nxos_nxapi https & http test cases

* Removed NXOS internal release naming

* Resolved ansibot sanity errors

* Fix typo in prepare_nxos_tests

* Address PR comments

* Shippable indicates this is no longer needed

* Add port change logic and testing

(cherry picked from commit db7300904d)

* add changelog

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* Add get_capabilities in nxapi module_utils (#42688)

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
(cherry picked from commit d5e9653c96)
2018-07-23 09:20:54 -07:00
306be9f23c Fix pause module so it does not stack trace when redirecting stdout. (#42217) (#42441)
* Use separate variables for stdin and stdout file descriptors

* Do not set stdout to raw mode when output is not a TTY

(cherry picked from commit 1d1595b990)
2018-07-23 09:20:14 -07:00
d6bc698ed8 Changing example code block language from yaml to yaml+jinja. (#40365) (#42436)
(cherry picked from commit 9f84c09bf3)
2018-07-23 09:19:32 -07:00
b00358e4fb Remove unwanted containers at CI job start.
(cherry picked from commit 528de5b82f)
2018-07-09 21:50:29 -07:00
716 changed files with 4814 additions and 2678 deletions

View File

@ -1,12 +1,16 @@
prune ticket_stubs
prune hacking
include README.rst COPYING
include SYMLINK_CACHE.json
include requirements.txt
include .coveragerc
include .yamllint
include shippable.yml
include tox.ini
include bin/ansible-test
include examples/hosts
include examples/ansible.cfg
include examples/scripts/ConfigureRemotingForAnsible.ps1
include examples/scripts/upgrade_to_ps3.ps1
recursive-include lib/ansible/module_utils/powershell *
recursive-include lib/ansible/modules *
recursive-include lib/ansible/galaxy/data *

View File

@ -117,7 +117,7 @@ ifneq ($(REPOTAG),)
endif
# ansible-test parameters
ANSIBLE_TEST ?= test/runner/ansible-test
ANSIBLE_TEST ?= bin/ansible-test
TEST_FLAGS ?=
# ansible-test units parameters (make test / make test-py3)

15
bin/ansible-test Executable file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
"""Primary entry point for ansible-test."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import sys
if __name__ == '__main__':
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(os.path.dirname(__file__)), 'test', 'runner')))
import lib.cli
lib.cli.main()

View File

@ -2,6 +2,203 @@
Ansible 2.5 "Kashmir" Release Notes
===================================
.. _Ansible 2.5 "Kashmir" Release Notes_v2.5.11:
v2.5.11
=======
.. _Ansible 2.5 "Kashmir" Release Notes_v2.5.11_Release Summary:
Release Summary
---------------
| Release Date: 2018-10-31
| Security release for CVE-2018-16837 (https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2018-16837)
.. _Ansible 2.5 "Kashmir" Release Notes_v2.5.11_Bugfixes:
Bugfixes
--------
- user module - do not pass ssh_key_passphrase on cmdline (CVE-2018-16837)
.. _Ansible 2.5 "Kashmir" Release Notes_v2.5.10:
v2.5.10
=======
.. _Ansible 2.5 "Kashmir" Release Notes_v2.5.10_Release Summary:
Release Summary
---------------
| Release Date: 2018-09-27
| **Final scheduled release in 2.5 series**; future releases will be for critical security fixes only
| `Porting Guide <https://docs.ansible.com/ansible/devel/porting_guides.html>`_
.. _Ansible 2.5 "Kashmir" Release Notes_v2.5.10_Bugfixes:
Bugfixes
--------
- docker connection - Support empty files with copying to target (https://github.com/ansible/ansible/issues/36725)
- chroot connection - Support empty files with copying to target (https://github.com/ansible/ansible/issues/36725)
- jail connection - Support empty files with copying to target (https://github.com/ansible/ansible/issues/36725)
- kubectl connection - Support empty files with copying to target (https://github.com/ansible/ansible/issues/36725)
- libvirt_lxc connection - Support empty files with copying to target (https://github.com/ansible/ansible/issues/36725)
- zone connection - Support empty files with copying to target (https://github.com/ansible/ansible/issues/36725)
- cloudfront - fix bug when CloudFrontOriginAccessIdentityList is missing (https://github.com/ansible/ansible/pull/44984)
- vyos_facts - fix vyos_facts not returning version number issue (https://github.com/ansible/ansible/pull/39115)
- get_url - Don't re-download files unnecessarily when force=no (https://github.com/ansible/ansible/issues/45491)
- loop - Ensure that a loop with a when condition that evaluates to false and delegate_to, will short circuit if the loop references an undefined variable. This matches the behavior in the same scenario without delegate_to (https://github.com/ansible/ansible/issues/45189)
- mysql_*, proxysql_* - PyMySQL (a pure-Python MySQL driver) is now a preferred dependency also supporting Python 3.X.
- nxos terminal plugin - fix python2.6 `nothing to repeat` bug (https://github.com/ansible/ansible/pull/45271).
- ssh connection - Support empty files with piped transfer_method (https://github.com/ansible/ansible/issues/45426)
- PLUGIN_FILTERS_CFG - Ensure that the value is treated as type=path, and that we use the standard section of ``defaults`` instead of ``default`` (https://github.com/ansible/ansible/pull/45994)
- script inventory plugin - Don't pass file_name to DataLoader.load, which will prevent misleading error messages (https://github.com/ansible/ansible/issues/34164)
.. _Ansible 2.5 "Kashmir" Release Notes_v2.5.9:
v2.5.9
======
.. _Ansible 2.5 "Kashmir" Release Notes_v2.5.9_Release Summary:
Release Summary
---------------
| Release Date: 2018-09-10
| `Porting Guide <https://docs.ansible.com/ansible/devel/porting_guides.html>`_
.. _Ansible 2.5 "Kashmir" Release Notes_v2.5.9_Minor Changes:
Minor Changes
-------------
- import_tasks - Do not allow import_tasks to transition to dynamic if the file is missing (https://github.com/ansible/ansible/issues/44822)
.. _Ansible 2.5 "Kashmir" Release Notes_v2.5.9_Bugfixes:
Bugfixes
--------
- user - Strip trailing comments in /etc/default/passwd (https://github.com/ansible/ansible/pull/43931)
- fix example code for AWS lightsail documentation
- fix the enable_snat parameter that is only supposed to be used by an user with the right policies. https://github.com/ansible/ansible/pull/44418
- ios_l2_interface - fix issue with certain interface types (https://github.com/ansible/ansible/pull/43819)
- ios_user - fix unable to delete user admin issue (https://github.com/ansible/ansible/pull/44904)
- ansible-galaxy - properly list all roles in roles_path (https://github.com/ansible/ansible/issues/43010)
- ios_vlan - fix unable to work on certain interface types issue (https://github.com/ansible/ansible/pull/43819)
- The fix for `CVE-2018-10875 <https://access.redhat.com/security/cve/cve-2018-10875>`_ prints out a warning message about skipping a config file from a world writable current working directory. However, if the user is in a world writable current working directory which does not contain a config file, it should not print a warning message. This release fixes that extaneous warning.
- Add md5sum check in nxos_file_copy module (https://github.com/ansible/ansible/pull/43423).
- nxos_interface port-channel idempotence fix for mode (https://github.com/ansible/ansible/pull/44248).
- nxos_linkagg mode fix (https://github.com/ansible/ansible/pull/44294).
- Fix check_mode in nxos_static_route module (https://github.com/ansible/ansible/pull/44252).
- Fix Python2.6 regex bug terminal plugin nxos, iosxr (https://github.com/ansible/ansible/pull/45135).
.. _Ansible 2.5 "Kashmir" Release Notes_v2.5.8:
v2.5.8
======
.. _Ansible 2.5 "Kashmir" Release Notes_v2.5.8_Release Summary:
Release Summary
---------------
| Release Date: 2018-08-16
| `Porting Guide <https://docs.ansible.com/ansible/devel/porting_guides.html>`_
.. _Ansible 2.5 "Kashmir" Release Notes_v2.5.8_Bugfixes:
Bugfixes
--------
- fix for the bundled selectors module (used in the ssh and local connection plugins) when a syscall is restarted after being interrupted by a signal (https://github.com/ansible/ansible/issues/41630)
- Fix the mount module's handling of swap entries in fstab (https://github.com/ansible/ansible/pull/42837)
- The fix for `CVE-2018-10875 <https://access.redhat.com/security/cve/cve-2018-10875>`_ prints out a warning message about skipping a config file from a world writable current working directory. However, if the user explicitly specifies that the config file should be used via the ANSIBLE_CONFIG environment variable then Ansible would honor that but still print out the warning message. This has been fixed so that Ansible honors the user's explicit wishes and does not print a warning message in that circumstance.
- fact names that conflict with well-known connection vars are now filtered (https://github.com/ansible/ansible/issues/41684)
- get_url - fix the bug that get_url does not change mode when checksum matches (https://github.com/ansible/ansible/issues/29614)
- openvswitch_db - make 'key' argument optional https://github.com/ansible/ansible/issues/42108
- slack callback - Fix invocation by looking up data from cli.options (https://github.com/ansible/ansible/pull/43542)
- vars_prompt - properly template play level variables in vars_prompt (https://github.com/ansible/ansible/issues/37984)
.. _Ansible 2.5 "Kashmir" Release Notes_v2.5.7:
v2.5.7
======
.. _Ansible 2.5 "Kashmir" Release Notes_v2.5.7_Release Summary:
Release Summary
---------------
| Release Date: 2018-07-26
| `Porting Guide <https://docs.ansible.com/ansible/devel/porting_guides.html>`_
.. _Ansible 2.5 "Kashmir" Release Notes_v2.5.7_Bugfixes:
Bugfixes
--------
- eos_facts - fix failure when lldp will be disabled (https://github.com/ansible/ansible/pull/42347)
- ios_vlan - fix unable to identify correct vlan issue (https://github.com/ansible/ansible/pull/42247)
- ios_linkagg - fix picking correct interface names issue (https://github.com/ansible/ansible/pull/42557)
- get_capabilities in nxapi module_utils should not return empty dictionary (https://github.com/ansible/ansible/pull/42688).
- Enforcing NXAPI default HTTP behavior (https://github.com/ansible/ansible/pull/41817).
- pause - do not set stdout to raw mode when redirecting to a file (https://github.com/ansible/ansible/issues/41717)
- pause - nest try except when importing curses to gracefully fail if curses is not present (https://github.com/ansible/ansible/issues/42004)
.. _Ansible 2.5 "Kashmir" Release Notes_v2.5.6:
v2.5.6

View File

@ -0,0 +1,2 @@
bugfixes:
- user - Strip trailing comments in /etc/default/passwd (https://github.com/ansible/ansible/pull/43931)

View File

@ -0,0 +1,3 @@
---
bugfixes:
- fix example code for AWS lightsail documentation

View File

@ -0,0 +1,7 @@
bugfixes:
- docker connection - Support empty files with copying to target (https://github.com/ansible/ansible/issues/36725)
- chroot connection - Support empty files with copying to target (https://github.com/ansible/ansible/issues/36725)
- jail connection - Support empty files with copying to target (https://github.com/ansible/ansible/issues/36725)
- kubectl connection - Support empty files with copying to target (https://github.com/ansible/ansible/issues/36725)
- libvirt_lxc connection - Support empty files with copying to target (https://github.com/ansible/ansible/issues/36725)
- zone connection - Support empty files with copying to target (https://github.com/ansible/ansible/issues/36725)

View File

@ -0,0 +1,4 @@
---
bugfixes:
- eos_facts - fix failure when lldp will be disabled
(https://github.com/ansible/ansible/pull/42347)

View File

@ -0,0 +1,3 @@
bugfixes:
- fix the enable_snat parameter that is only supposed to be used by an user
with the right policies. https://github.com/ansible/ansible/pull/44418

View File

@ -0,0 +1,5 @@
---
bugfixes:
- fix for the bundled selectors module (used in the ssh and local connection
plugins) when a syscall is restarted after being interrupted by a signal
(https://github.com/ansible/ansible/issues/41630)

View File

@ -0,0 +1,4 @@
---
bugfixes:
- Fix the mount module's handling of swap entries in fstab
(https://github.com/ansible/ansible/pull/42837)

View File

@ -0,0 +1,9 @@
---
bugfixes:
- The fix for `CVE-2018-10875 <https://access.redhat.com/security/cve/cve-2018-10875>`_
prints out a warning message about skipping a config file from a world
writable current working directory. However, if the user explicitly
specifies that the config file should be used via the ANSIBLE_CONFIG
environment variable then Ansible would honor that but still print out the
warning message. This has been fixed so that Ansible honors the user's
explicit wishes and does not print a warning message in that circumstance.

View File

@ -0,0 +1,2 @@
bugfixes:
- cloudfront - fix bug when CloudFrontOriginAccessIdentityList is missing (https://github.com/ansible/ansible/pull/44984)

View File

@ -0,0 +1,2 @@
bugfixes:
- fact names that conflict with well-known connection vars are now filtered (https://github.com/ansible/ansible/issues/41684)

View File

@ -0,0 +1,3 @@
---
bugfixes:
- ios_l2_interface - fix issue with certain interface types (https://github.com/ansible/ansible/pull/43819)

View File

@ -0,0 +1,3 @@
---
bugfixes:
- ios_user - fix unable to delete user admin issue (https://github.com/ansible/ansible/pull/44904)

View File

@ -0,0 +1,2 @@
bugfixes:
- ios_vlan - fix unable to identify correct vlan issue (https://github.com/ansible/ansible/pull/42247)

View File

@ -0,0 +1,3 @@
---
bugfixes:
- vyos_facts - fix vyos_facts not returning version number issue (https://github.com/ansible/ansible/pull/39115)

View File

@ -0,0 +1,2 @@
bugfixes:
- ansible-galaxy - properly list all roles in roles_path (https://github.com/ansible/ansible/issues/43010)

View File

@ -0,0 +1,2 @@
bugfixes:
- get_url - Don't re-download files unnecessarily when force=no (https://github.com/ansible/ansible/issues/45491)

View File

@ -0,0 +1,2 @@
bugfixes:
- get_url - fix the bug that get_url does not change mode when checksum matches (https://github.com/ansible/ansible/issues/29614)

View File

@ -0,0 +1,3 @@
---
bugfixes:
- hashi_vault - fix AttributeError when 'auth_method' isn't 'token' (https://github.com/ansible/ansible/pull/36513)

View File

@ -0,0 +1,2 @@
bugfixes:
- ios_linkagg - fix picking correct interface names issue (https://github.com/ansible/ansible/pull/42557)

View File

@ -0,0 +1,3 @@
---
bugfixes:
- ios_vlan - fix unable to work on certain interface types issue (https://github.com/ansible/ansible/pull/43819)

View File

@ -0,0 +1,4 @@
bugfixes:
- loop - Ensure that a loop with a when condition that evaluates to false and delegate_to, will short circuit if the
loop references an undefined variable. This matches the behavior in the same scenario without delegate_to
(https://github.com/ansible/ansible/issues/45189)

View File

@ -0,0 +1,7 @@
---
bugfixes:
- The fix for `CVE-2018-10875 <https://access.redhat.com/security/cve/cve-2018-10875>`_
prints out a warning message about skipping a config file from a world
writable current working directory. However, if the user is in a world
writable current working directory which does not contain a config file, it
should not print a warning message. This release fixes that extaneous warning.

View File

@ -0,0 +1,2 @@
bugfixes:
- mysql_*, proxysql_* - PyMySQL (a pure-Python MySQL driver) is now a preferred dependency also supporting Python 3.X.

View File

@ -0,0 +1,5 @@
minor_changes:
- import_tasks - Do not allow import_tasks to transition to dynamic if the file is missing (https://github.com/ansible/ansible/issues/44822)
release_summary: |
| Release Date: 2018-09-10
| `Porting Guide <https://docs.ansible.com/ansible/devel/porting_guides.html>`_

View File

@ -0,0 +1,2 @@
bugfixes:
- Add md5sum check in nxos_file_copy module (https://github.com/ansible/ansible/pull/43423).

View File

@ -0,0 +1,2 @@
bugfixes:
- nxos_interface port-channel idempotence fix for mode (https://github.com/ansible/ansible/pull/44248).

View File

@ -0,0 +1,2 @@
bugfixes:
- nxos_linkagg mode fix (https://github.com/ansible/ansible/pull/44294).

View File

@ -0,0 +1,2 @@
bugfixes:
- get_capabilities in nxapi module_utils should not return empty dictionary (https://github.com/ansible/ansible/pull/42688).

View File

@ -0,0 +1,2 @@
bugfixes:
- Enforcing NXAPI default HTTP behavior (https://github.com/ansible/ansible/pull/41817).

View File

@ -0,0 +1,2 @@
bugfixes:
- Fix check_mode in nxos_static_route module (https://github.com/ansible/ansible/pull/44252).

View File

@ -0,0 +1,2 @@
bugfixes:
- nxos terminal plugin - fix python2.6 `nothing to repeat` bug (https://github.com/ansible/ansible/pull/45271).

View File

@ -0,0 +1,2 @@
bugfixes:
- openvswitch_db - make 'key' argument optional https://github.com/ansible/ansible/issues/42108

View File

@ -0,0 +1,2 @@
bugfixes:
- pause - do not set stdout to raw mode when redirecting to a file (https://github.com/ansible/ansible/issues/41717)

View File

@ -0,0 +1,2 @@
bugfixes:
- pause - nest try except when importing curses to gracefully fail if curses is not present (https://github.com/ansible/ansible/issues/42004)

View File

@ -0,0 +1,2 @@
bugfixes:
- ssh connection - Support empty files with piped transfer_method (https://github.com/ansible/ansible/issues/45426)

View File

@ -0,0 +1,2 @@
bugfixes:
- PLUGIN_FILTERS_CFG - Ensure that the value is treated as type=path, and that we use the standard section of ``defaults`` instead of ``default`` (https://github.com/ansible/ansible/pull/45994)

View File

@ -0,0 +1,2 @@
bugfixes:
- script inventory plugin - Don't pass file_name to DataLoader.load, which will prevent misleading error messages (https://github.com/ansible/ansible/issues/34164)

View File

@ -0,0 +1,2 @@
bugfixes:
- slack callback - Fix invocation by looking up data from cli.options (https://github.com/ansible/ansible/pull/43542)

View File

@ -0,0 +1,2 @@
bugfixes:
- Fix Python2.6 regex bug terminal plugin nxos, iosxr (https://github.com/ansible/ansible/pull/45135).

View File

@ -0,0 +1,2 @@
bugfixes:
- user module - do not pass ssh_key_passphrase on cmdline (CVE-2018-16837)

View File

@ -0,0 +1,4 @@
release_summary: |
| Release Date: 2018-09-27
| **Final scheduled release in 2.5 series**; future releases will be for critical security fixes only
| `Porting Guide <https://docs.ansible.com/ansible/devel/porting_guides.html>`_

View File

@ -0,0 +1,3 @@
release_summary: |
| Release Date: 2018-10-31
| Security release for CVE-2018-16837 (https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2018-16837)

View File

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

View File

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

View File

@ -0,0 +1,2 @@
bugfixes:
- vars_prompt - properly template play level variables in vars_prompt (https://github.com/ansible/ansible/issues/37984)

View File

@ -0,0 +1,7 @@
.. _contributor_license_agreement:
******************************
Contributors License Agreement
******************************
By contributing you agree that these contributions are your own (or approved by your employer) and you grant a full, complete, irrevocable copyright license to all users and developers of the project, present and future, pursuant to the license of the project.

View File

@ -1,3 +1,5 @@
.. _community_development_process:
The Ansible Development Process
===============================

View File

@ -3,7 +3,7 @@ How To Help
.. contents:: Topics
Thanks for being interested in helping the Ansible project!
Thanks for being interested in helping the Ansible project!
There are many ways to help the Ansible project...but first, please read and understand the :ref:`code_of_conduct`.
@ -23,7 +23,7 @@ When you become a power user, your ability and opportunities to help the Ansible
Ask and answer questions online
-------------------------------
There are many forums online where Ansible users ask and answer questions. Reach out and communicate with your fellow Ansible users.
There are many forums online where Ansible users ask and answer questions. Reach out and communicate with your fellow Ansible users.
You can find the official :ref:`Ansible communication channels <communication>`.
@ -45,7 +45,7 @@ If you should discover that the bug you're trying to file already exists in an i
Review and submit pull requests
-------------------------------
As you become more familiar with how Ansible works, you may be able to fix issues or develop new features yourself. If you think you've got a solution to a bug you've found in Ansible, or if you've got a new feature that you've written and would like to share with millions of Ansible users, read all about the `Ansible development process <http://docs.ansible.com/ansible/latest/community/development_process.rst>`_ to learn how to get your code accepted into Ansible.
As you become more familiar with how Ansible works, you may be able to fix issues or develop new features yourself. If you think you've got a solution to a bug you've found in Ansible, or if you've got a new feature that you've written and would like to share with millions of Ansible users, read all about the :ref:`Ansible development process <community_development_process>` to learn how to get your code accepted into Ansible.
Another good way to help is to review pull requests that other Ansible users have submitted. The Ansible community keeps a full list of `open pull requests by file <https://ansible.sivel.net/byfile.html>`_, so if there's a particular module or plug-in that particularly interests you, you can easily keep track of all the relevant new pull requests and provide testing or feedback.

View File

@ -21,8 +21,5 @@ To get started, please read and understand the :ref:`code_of_conduct`, and then
maintainers
release_managers
communication
contributor_license_agreement
other_tools_and_programs

View File

@ -117,8 +117,8 @@ Read the complete :ref:`module metadata specification <ansible_metadata_block>`
serializable. A common pitfall is to try returning an object via
exit_json(). Instead, convert the fields you need from the object into the
fields of a dictionary and return the dictionary.
* When fetching URLs, please use either fetch_url or open_url from ansible.module_utils.urls
rather than urllib2; urllib2 does not natively verify TLS certificates and so is insecure for https.
* When fetching URLs, please use either fetch_url or open_url from ansible.module_utils.urls
rather than urllib2; urllib2 does not natively verify TLS certificates and so is insecure for https.
* facts modules must return facts in the ansible_facts field of the :ref:`result
dictionary<common_return_values>`.
* modules that are purely about fact gathering need to implement check_mode.

View File

@ -13,10 +13,11 @@ Tests must be configured to run in exactly one group. This is done by adding the
The following are examples of some of the available groups:
- ``posix/ci/group1``
- ``windows/ci/group2``
- ``posix/ci/cloud/group3/azure``
- ``posix/ci/cloud/group4/aws``
- ``shippable/posix/group1``
- ``shippable/windows/group2``
- ``shippable/azure/group3``
- ``shippable/aws/group1``
- ``shippable/cloud/group1``
Groups are used to balance tests across multiple CI jobs to minimize test run time.
They also improve efficiency by keeping tests with similar requirements running together.
@ -41,6 +42,7 @@ Aliases can be used to skip platforms using one of the following:
- ``skip/freebsd`` - Skip tests on FreeBSD.
- ``skip/osx`` - Skip tests on macOS / OS X.
- ``skip/rhel`` - Skip tests on RHEL.
- ``skip/docker`` - Skip tests when running on a Docker container
Aliases can be used to skip Python major versions using one of the following:

View File

@ -0,0 +1,6 @@
Sanity Tests » symlinks
=======================
Symbolic links are only permitted for files that exist to ensure proper tarball generation during a release.
If other types of symlinks are needed for tests they must be created as part of the test.

View File

@ -110,6 +110,7 @@ Errors
321 ``Exception`` attempting to import module for ``argument_spec`` introspection
322 argument is listed in the argument_spec, but not documented in the module
323 argument is listed in DOCUMENTATION.options, but not accepted by the module
332 ``AnsibleModule`` schema validation error
..
--------- -------------------
**4xx** **Syntax**

View File

@ -2,7 +2,7 @@
Inventory Plugins
-----------------
=================
Inventory plugins allow users to point at data sources to compile the inventory of hosts that Ansible uses to target tasks, either via the ``-i /path/to/file`` and/or ``-i 'host1, host2`` command line parameters or from other configuration sources.
@ -10,7 +10,7 @@ Inventory plugins allow users to point at data sources to compile the inventory
.. _enabling_inventory:
Enabling Inventory Plugins
++++++++++++++++++++++++++
--------------------------
Most inventory plugins shipped with Ansible are disabled by default and need to be whitelisted in your
:ref:`ansible.cfg <ansible_configuration_settings>` file in order to function. This is how the default whitelist looks in the
@ -19,7 +19,7 @@ config file that ships with Ansible:
.. code-block:: ini
[inventory]
enable_plugins = host_list, script, yaml, ini
enable_plugins = host_list, script, yaml, ini, auto
This list also establishes the order in which each plugin tries to parse an inventory source. Any plugins left out of the list will not be considered, so you can 'optimize' your inventory loading by minimizing it to what you actually use. For example:
@ -32,7 +32,7 @@ This list also establishes the order in which each plugin tries to parse an inve
.. _using_inventory:
Using Inventory Plugins
+++++++++++++++++++++++
-----------------------
The only requirement for using an inventory plugin after it is enabled is to provide an inventory source to parse.
Ansible will try to use the list of enabled inventory plugins, in order, against each inventory source provided.
@ -42,7 +42,7 @@ Once an inventory plugin succeeds at parsing a source, the any remaining invento
.. _inventory_plugin_list:
Plugin List
+++++++++++
-----------
You can use ``ansible-doc -t inventory -l`` to see the list of available plugins.
Use ``ansible-doc -t inventory <plugin name>`` to see plugin-specific documentation and examples.

View File

@ -19,9 +19,6 @@ Ansible has a graduated support structure that extends to three major releases.
For more information, read about the :ref:`development_and_stable_version_maintenance_workflow` or
see the chart in :ref:`release_schedule` for the degrees to which current releases are supported.
.. note:: Support for three major releases began with Ansible-2.4. Ansible-2.3 and older versions
are only supported for two releases.
If you are using a release of Ansible that is no longer supported, we strongly
encourage you to upgrade as soon as possible in order to benefit from the
latest features and security fixes.
@ -40,14 +37,16 @@ Release status
=============== ========================== =================================================
Ansible Release Latest Version Status
=============== ========================== =================================================
devel `2.6` (unreleased, trunk) In development
2.5 `2.5.0`_ (2018-03-23) Supported (security **and** general bugfixes)
2.4 `2.4.4`_ (2018-01-31) Supported (security **and** critical bug fixes)
2.3 `2.3.3`_ (2017-12-20) Unsupported (end of life)
2.2 `2.2.3`_ (2017-05-09) Unsupported (end of life)
2.1 `2.1.6`_ (2017-06-01) Unsupported (end of life)
2.0 `2.0.2`_ (2016-04-19) Unsupported (end of life)
1.9 `1.9.6`_ (2016-04-15) Unsupported (end of life)
devel 2.8 (unreleased, trunk) In development
`2.7`_ 2.7.0 (2018-10-04) Supported (security **and** general bug fixes)
`2.6`_ 2.6.5 (2018-09-28) Supported (security **and** critical bug fixes)
`2.5`_ 2.5.9 (2018-09-10) Supported (security fixes)
`2.4`_ 2.4.6 (2018-07-05) Unsupported (end of life)
`2.3`_ 2.3.3 (2017-12-20) Unsupported (end of life)
`2.2`_ 2.2.3 (2017-05-09) Unsupported (end of life)
`2.1`_ 2.1.6 (2017-06-01) Unsupported (end of life)
`2.0`_ 2.0.2 (2016-04-19) Unsupported (end of life)
`1.9`_ 1.9.6 (2016-04-15) Unsupported (end of life)
<1.9 n/a Unsupported (end of life)
=============== ========================== =================================================
@ -57,13 +56,15 @@ devel `2.6` (unreleased, trunk) In development
.. Comment: devel used to point here but we're currently revamping our changelog process and have no
link to a static changelog for devel _2.6: https://github.com/ansible/ansible/blob/devel/CHANGELOG.md
.. _2.5.0: https://github.com/ansible/ansible/blob/stable-2.5/changelogs/CHANGELOG-v2.5.rst
.. _2.4.4: https://github.com/ansible/ansible/blob/stable-2.4/CHANGELOG.md
.. _2.3.3: https://github.com/ansible/ansible/blob/stable-2.3/CHANGELOG.md
.. _2.2.3: https://github.com/ansible/ansible/blob/stable-2.2/CHANGELOG.md
.. _2.1.6: https://github.com/ansible/ansible/blob/stable-2.1/CHANGELOG.md
.. _2.0.2: https://github.com/ansible/ansible/blob/stable-2.0/CHANGELOG.md
.. _1.9.6: https://github.com/ansible/ansible/blob/stable-1.9/CHANGELOG.md
.. _2.7: https://github.com/ansible/ansible/blob/stable-2.7/changelogs/CHANGELOG-v2.7.rst
.. _2.6: https://github.com/ansible/ansible/blob/stable-2.6/changelogs/CHANGELOG-v2.6.rst
.. _2.5: https://github.com/ansible/ansible/blob/stable-2.5/changelogs/CHANGELOG-v2.5.rst
.. _2.4: https://github.com/ansible/ansible/blob/stable-2.4/CHANGELOG.md
.. _2.3: https://github.com/ansible/ansible/blob/stable-2.3/CHANGELOG.md
.. _2.2: https://github.com/ansible/ansible/blob/stable-2.2/CHANGELOG.md
.. _2.1: https://github.com/ansible/ansible/blob/stable-2.1/CHANGELOG.md
.. _2.0: https://github.com/ansible/ansible/blob/stable-2.0/CHANGELOG.md
.. _1.9: https://github.com/ansible/ansible/blob/stable-1.9/CHANGELOG.md
.. _support_life:
.. _methods:

View File

@ -87,7 +87,7 @@ Omitting Parameters
As of Ansible 1.8, it is possible to use the default filter to omit module parameters using the special `omit` variable::
- name: touch files with an optional mode
file: dest={{item.path}} state=touch mode={{item.mode|default(omit)}}
file: dest={{ item.path }} state=touch mode={{ item.mode | default(omit) }}
loop:
- path: /tmp/foo
- path: /tmp/bar
@ -123,11 +123,11 @@ To get the maximum value from a list of numbers::
Flatten a list (same thing the `flatten` lookup does)::
{{ [3, [4, 2] ]|flatten }}
{{ [3, [4, 2] ] | flatten }}
Flatten only the first level of a list (akin to the `items` lookup)::
{{ [3, [4, [2]] ]|flatten(level=1) }}
{{ [3, [4, [2]] ] | flatten(level=1) }}
To get the minimum value from list of numbers::
@ -173,29 +173,29 @@ items), but can also generate a random number based on a range.
To get a random item from a list::
"{{ ['a','b','c']|random }}"
"{{ ['a','b','c'] | random }}"
# => 'c'
To get a random number between 0 and a specified number::
"{{ 60 |random}} * * * * root /script/from/cron"
"{{ 60 | random }} * * * * root /script/from/cron"
# => '21 * * * * root /script/from/cron'
Get a random number from 0 to 100 but in steps of 10::
{{ 101 |random(step=10) }}
{{ 101 | random(step=10) }}
# => 70
Get a random number from 1 to 100 but in steps of 10::
{{ 101 |random(1, 10) }}
{{ 101 | random(1, 10) }}
# => 31
{{ 101 |random(start=1, step=10) }}
{{ 101 | random(start=1, step=10) }}
# => 51
As of Ansible version 2.3, it's also possible to initialize the random number generator from a seed. This way, you can create random-but-idempotent numbers::
"{{ 60 |random(seed=inventory_hostname) }} * * * * root /script/from/cron"
"{{ 60 | random(seed=inventory_hostname) }} * * * * root /script/from/cron"
Shuffle Filter
@ -207,14 +207,14 @@ This filter will randomize an existing list, giving a different order every invo
To get a random list from an existing list::
{{ ['a','b','c']|shuffle }}
{{ ['a','b','c'] | shuffle }}
# => ['c','a','b']
{{ ['a','b','c']|shuffle }}
{{ ['a','b','c'] | shuffle }}
# => ['b','c','a']
As of Ansible version 2.3, it's also possible to shuffle a list idempotent. All you need is a seed.::
{{ ['a','b','c']|shuffle(seed=inventory_hostname) }}
{{ ['a','b','c'] | shuffle(seed=inventory_hostname) }}
# => ['b','a','c']
note that when used with a non 'listable' item it is a noop, otherwise it always returns a list
@ -288,40 +288,51 @@ Now, let's take the following data structure::
To extract all clusters from this structure, you can use the following query::
- name: "Display all cluster names"
debug: var=item
loop: "{{domain_definition|json_query('domain.cluster[*].name')}}"
debug:
var: item
loop: "{{ domain_definition | json_query('domain.cluster[*].name') }}"
Same thing for all server names::
- name: "Display all server names"
debug: var=item
loop: "{{domain_definition|json_query('domain.server[*].name')}}"
debug:
var: item
loop: "{{ domain_definition | json_query('domain.server[*].name') }}"
This example shows ports from cluster1::
- name: "Display all server names from cluster1"
debug: var=item
loop: "{{domain_definition|json_query(server_name_cluster1_query)}}"
- name: "Display all ports from cluster1"
debug:
var: item
loop: "{{ domain_definition | json_query(server_name_cluster1_query) }}"
vars:
server_name_cluster1_query: "domain.server[?cluster=='cluster1'].port"
.. note:: You can use a variable to make the query more readable.
Or, alternatively::
Or, alternatively print out the ports in a comma separated string::
- name: "Display all server names from cluster1"
- name: "Display all ports from cluster1 as a string"
debug:
var: item
loop: "{{domain_definition|json_query('domain.server[?cluster=`cluster1`].port')}}"
msg: "{{ domain_definition | json_query('domain.server[?cluster==`cluster1`].port') | join(', ') }}"
.. note:: Here, quoting literals using backticks avoids escaping quotes and maintains readability.
Or, using YAML `single quote escaping <http://yaml.org/spec/current.html#id2534365>`_::
- name: "Display all ports from cluster1"
debug:
var: item
loop: "{{ domain_definition | json_query('domain.server[?cluster==''cluster1''].port') }}"
.. note:: Escaping single quotes within single quotes in YAML is done by doubling the single quote.
In this example, we get a hash map with all ports and names of a cluster::
- name: "Display all server ports and names from cluster1"
debug:
var: item
loop: "{{domain_definition|json_query(server_name_cluster1_query)}}"
loop: "{{ domain_definition | json_query(server_name_cluster1_query) }}"
vars:
server_name_cluster1_query: "domain.server[?cluster=='cluster2'].{name: name, port: port}"
@ -558,31 +569,31 @@ Hashing filters
To get the sha1 hash of a string::
{{ 'test1'|hash('sha1') }}
{{ 'test1' | hash('sha1') }}
To get the md5 hash of a string::
{{ 'test1'|hash('md5') }}
{{ 'test1' | hash('md5') }}
Get a string checksum::
{{ 'test2'|checksum }}
{{ 'test2' | checksum }}
Other hashes (platform dependent)::
{{ 'test2'|hash('blowfish') }}
{{ 'test2' | hash('blowfish') }}
To get a sha512 password hash (random salt)::
{{ 'passwordsaresecret'|password_hash('sha512') }}
{{ 'passwordsaresecret' | password_hash('sha512') }}
To get a sha256 password hash with a specific salt::
{{ 'secretpassword'|password_hash('sha256', 'mysecretsalt') }}
{{ 'secretpassword' | password_hash('sha256', 'mysecretsalt') }}
An idempotent method to generate unique hashes per system is to use a salt that is consistent between runs::
{{ 'secretpassword'|password_hash('sha512', 65534|random(seed=inventory_hostname)|string) }}
{{ 'secretpassword' | password_hash('sha512', 65534 | random(seed=inventory_hostname) | string) }}
Hash types available depend on the master system running ansible,
'hash' depends on hashlib password_hash depends on passlib (http://passlib.readthedocs.io/en/stable/lib/passlib.hash.html).
@ -597,7 +608,7 @@ Combining hashes/dictionaries
The `combine` filter allows hashes to be merged. For example, the
following would override keys in one hash::
{{ {'a':1, 'b':2}|combine({'b':3}) }}
{{ {'a':1, 'b':2} | combine({'b':3}) }}
The resulting hash would be::
@ -609,7 +620,7 @@ hashes and merge their keys too
.. code-block:: jinja
{{ {'a':{'foo':1, 'bar':2}, 'b':2}|combine({'a':{'bar':3, 'baz':4}}, recursive=True) }}
{{ {'a':{'foo':1, 'bar':2}, 'b':2} | combine({'a':{'bar':3, 'baz':4}}, recursive=True) }}
This would result in::
@ -617,7 +628,7 @@ This would result in::
The filter can also take multiple arguments to merge::
{{ a|combine(b, c, d) }}
{{ a | combine(b, c, d) }}
In this case, keys in `d` would override those in `c`, which would
override those in `b`, and so on.
@ -635,8 +646,8 @@ Extracting values from containers
The `extract` filter is used to map from a list of indices to a list of
values from a container (hash or array)::
{{ [0,2]|map('extract', ['x','y','z'])|list }}
{{ ['x','y']|map('extract', {'x': 42, 'y': 31})|list }}
{{ [0,2] | map('extract', ['x','y','z']) | list }}
{{ ['x','y'] | map('extract', {'x': 42, 'y': 31}) | list }}
The results of the above expressions would be::
@ -645,7 +656,7 @@ The results of the above expressions would be::
The filter can take another argument::
{{ groups['x']|map('extract', hostvars, 'ec2_ip_address')|list }}
{{ groups['x'] | map('extract', hostvars, 'ec2_ip_address') | list }}
This takes the list of hosts in group 'x', looks them up in `hostvars`,
and then looks up the `ec2_ip_address` of the result. The final result
@ -654,7 +665,7 @@ is a list of IP addresses for the hosts in group 'x'.
The third argument to the filter can also be a list, for a recursive
lookup inside the container::
{{ ['a']|map('extract', b, ['x','y'])|list }}
{{ ['a'] | map('extract', b, ['x','y']) | list }}
This would return a list containing the value of `b['a']['x']['y']`.
@ -918,19 +929,19 @@ doesn't know it is a boolean value::
To make use of one attribute from each item in a list of complex variables, use the "map" filter (see the `Jinja2 map() docs`_ for more)::
# get a comma-separated list of the mount points (e.g. "/,/mnt/stuff") on a host
{{ ansible_mounts|map(attribute='mount')|join(',') }}
{{ ansible_mounts | map(attribute='mount') | join(',') }}
To get date object from string use the `to_datetime` filter, (new in version in 2.2)::
# Get total amount of seconds between two dates. Default date format is %Y-%m-%d %H:%M:%S but you can pass your own format
{{ (("2016-08-14 20:00:12"|to_datetime) - ("2015-12-25"|to_datetime('%Y-%m-%d'))).total_seconds() }}
{{ (("2016-08-14 20:00:12" | to_datetime) - ("2015-12-25" | to_datetime('%Y-%m-%d'))).total_seconds() }}
# Get remaining seconds after delta has been calculated. NOTE: This does NOT convert years, days, hours, etc to seconds. For that, use total_seconds()
{{ (("2016-08-14 20:00:12"|to_datetime) - ("2016-08-14 18:00:00"|to_datetime)).seconds }}
{{ (("2016-08-14 20:00:12" | to_datetime) - ("2016-08-14 18:00:00" | to_datetime)).seconds }}
# This expression evaluates to "12" and not "132". Delta is 2 hours, 12 seconds
# get amount of days between two dates. This returns only number of days and discards remaining hours, minutes, and seconds
{{ (("2016-08-14 20:00:12"|to_datetime) - ("2015-12-25"|to_datetime('%Y-%m-%d'))).days }}
{{ (("2016-08-14 20:00:12" | to_datetime) - ("2015-12-25" | to_datetime('%Y-%m-%d'))).days }}
Combination Filters
````````````````````
@ -942,34 +953,34 @@ To get permutations of a list::
- name: give me largest permutations (order matters)
debug:
msg: "{{ [1,2,3,4,5]|permutations|list }}"
msg: "{{ [1,2,3,4,5] | permutations | list }}"
- name: give me permutations of sets of three
debug:
msg: "{{ [1,2,3,4,5]|permutations(3)|list }}"
msg: "{{ [1,2,3,4,5] | permutations(3) | list }}"
Combinations always require a set size::
- name: give me combinations for sets of two
debug:
msg: "{{ [1,2,3,4,5]|combinations(2)|list }}"
msg: "{{ [1,2,3,4,5] | combinations(2) | list }}"
To get a list combining the elements of other lists use ``zip``::
- name: give me list combo of two lists
debug:
msg: "{{ [1,2,3,4,5]|zip(['a','b','c','d','e','f'])|list }}"
msg: "{{ [1,2,3,4,5] | zip(['a','b','c','d','e','f']) | list }}"
- name: give me shortest combo of two lists
debug:
msg: "{{ [1,2,3]|zip(['a','b','c','d','e','f'])|list }}"
msg: "{{ [1,2,3] | zip(['a','b','c','d','e','f']) | list }}"
To always exhaust all list use ``zip_longest``::
- name: give me longest combo of three lists , fill with X
debug:
msg: "{{ [1,2,3]|zip_longest(['a','b','c','d','e','f'], [21, 22, 23], fillvalue='X')|list }}"
msg: "{{ [1,2,3] | zip_longest(['a','b','c','d','e','f'], [21, 22, 23], fillvalue='X') | list }}"
.. versionadded:: 2.4

View File

@ -302,7 +302,7 @@ Another option to loop control is ``pause``, which allows you to control the tim
loop_control:
pause: 3
.. versionadded:: 2.7
.. versionadded:: 2.5
If you need to keep track of where you are in a loop, you can use the ``index_var`` option to loop control to specify a variable name to contain the current loop index.::

View File

@ -39,6 +39,40 @@ Ansible will process the above list and use the first file found, all others are
inventory = /etc/ansible/hosts ; This points to the file that lists your hosts
.. _cfg_in_world_writable_dir:
Avoiding security risks with ``ansible.cfg`` in the current directory
---------------------------------------------------------------------
If Ansible were to load :file:ansible.cfg from a world-writable current working
directory, it would create a serious security risk. Another user could place
their own config file there, designed to make Ansible run malicious code both
locally and remotely, possibly with elevated privileges. For this reason,
Ansible will not automatically load a config file from the current working
directory if the directory is world-writable.
If you depend on using Ansible with a config file in the current working
directory, the best way to avoid this problem is to restrict access to your
Ansible directories to particular user(s) and/or group(s). If your Ansible
directories live on a filesystem which has to emulate Unix permissions, like
Vagrant or Windows Subsystem for Linux (WSL), you may, at first, not know how
you can fix this as ``chmod``, ``chown``, and ``chgrp`` might not work there.
In most of those cases, the correct fix is to modify the mount options of the
filesystem so the files and directories are readable and writable by the users
and groups running Ansible but closed to others. For more details on the
correct settings, see:
* for Vagrant, Jeremy Kendall's `blog post <http://jeremykendall.net/2013/08/09/vagrant-synced-folders-permissions/>`_ covers synced folder permissions.
* for WSL, the `WSL docs <https://docs.microsoft.com/en-us/windows/wsl/wsl-config#set-wsl-launch-settings>`_
and this `Microsoft blog post <https://blogs.msdn.microsoft.com/commandline/2018/01/12/chmod-chown-wsl-improvements/>`_ cover mount options.
If you absolutely depend on having the config live in a world-writable current
working directory, you can explicitly specify the config file via the
:envvar:`ANSIBLE_CONFIG` environment variable. Please take
appropriate steps to mitigate the security concerns above before doing so.
Common Options
==============

View File

@ -221,7 +221,7 @@ Notes
Examples
--------
.. code-block:: yaml
.. code-block:: yaml+jinja
{% for example in examples %}
{% if example['description'] %}@{ example['description'] | indent(4, True) }@{% endif %}

View File

@ -308,7 +308,7 @@
#any_errors_fatal = False
[inventory]
# enable inventory plugins, default: 'host_list', 'script', 'yaml', 'ini'
# enable inventory plugins, default: 'host_list', 'script', 'yaml', 'ini', 'auto'
#enable_plugins = host_list, virtualbox, yaml, constructed
# ignore these extensions when parsing a directory as inventory source

View File

@ -1,6 +1,22 @@
# usage: source hacking/env-setup [-q]
# modifies environment for running Ansible from checkout
# prepend a value to a potentially empty path variable
# usage: prepend_path variable_name value
prepend_path()
{
variable_name="$1"
value="$2"
old_value=$( eval "echo \$$variable_name" )
if [ "x$old_value" != "x" ]; then
value="$value:"
fi
export "$variable_name=$value$old_value"
}
# Default values for shell variables we use
PYTHONPATH=${PYTHONPATH-""}
PATH=${PATH-""}
@ -31,12 +47,12 @@ FULL_PATH=$($PYTHON_BIN -c "import os; print(os.path.realpath('$HACKING_DIR'))")
export ANSIBLE_HOME="$(dirname "$FULL_PATH")"
PREFIX_PYTHONPATH="$ANSIBLE_HOME/lib"
PREFIX_PATH="$ANSIBLE_HOME/bin:$ANSIBLE_HOME/test/runner"
PREFIX_PATH="$ANSIBLE_HOME/bin"
PREFIX_MANPATH="$ANSIBLE_HOME/docs/man"
expr "$PYTHONPATH" : "${PREFIX_PYTHONPATH}.*" > /dev/null || export PYTHONPATH="$PREFIX_PYTHONPATH:$PYTHONPATH"
expr "$PATH" : "${PREFIX_PATH}.*" > /dev/null || export PATH="$PREFIX_PATH:$PATH"
expr "$MANPATH" : "${PREFIX_MANPATH}.*" > /dev/null || export MANPATH="$PREFIX_MANPATH:$MANPATH"
expr "$PYTHONPATH" : "${PREFIX_PYTHONPATH}.*" > /dev/null || prepend_path PYTHONPATH "$PREFIX_PYTHONPATH"
expr "$PATH" : "${PREFIX_PATH}.*" > /dev/null || prepend_path PATH "$PREFIX_PATH"
expr "$MANPATH" : "${PREFIX_MANPATH}.*" > /dev/null || prepend_path MANPATH "$PREFIX_MANPATH"
#
# Generate egg_info so that pkg_resources works

View File

@ -5,7 +5,7 @@ set HACKING_DIR (dirname (status -f))
set FULL_PATH (python -c "import os; print(os.path.realpath('$HACKING_DIR'))")
set ANSIBLE_HOME (dirname $FULL_PATH)
set PREFIX_PYTHONPATH $ANSIBLE_HOME/lib
set PREFIX_PATH $ANSIBLE_HOME/bin $ANSIBLE_HOME/test/runner
set PREFIX_PATH $ANSIBLE_HOME/bin
set PREFIX_MANPATH $ANSIBLE_HOME/docs/man
# set quiet flag

View File

@ -488,7 +488,7 @@ class GalaxyCLI(CLI):
path_files = os.listdir(role_path)
path_found = True
for path_file in path_files:
gr = GalaxyRole(self.galaxy, path_file)
gr = GalaxyRole(self.galaxy, path_file, path=path)
if gr.metadata:
install_info = gr.install_info
version = None

View File

@ -25,6 +25,14 @@ package exists on pypi to backport the functionality as far as python-2.6.
'''
# The following makes it easier for us to script updates of the bundled code
_BUNDLED_METADATA = {"pypi_name": "selectors2", "version": "1.1.0"}
# Added these bugfix commits from 2.1.0:
# * https://github.com/SethMichaelLarson/selectors2/commit/3bd74f2033363b606e1e849528ccaa76f5067590
# Wrap kqueue.control so that timeout is a keyword arg
# * https://github.com/SethMichaelLarson/selectors2/commit/6f6a26f42086d8aab273b30be492beecb373646b
# Fix formatting of the kqueue.control patch for pylint
# * https://github.com/SethMichaelLarson/selectors2/commit/f0c2c6c66cfa7662bc52beaf4e2d65adfa25e189
# Fix use of OSError exception for py3 and use the wrapper of kqueue.control so retries of
# interrupted syscalls work with kqueue
import os.path
import sys

View File

@ -136,7 +136,7 @@ else:
if expires is not None:
current_time = monotonic()
if current_time > expires:
raise OSError(errno=errno.ETIMEDOUT)
raise OSError(errno.ETIMEDOUT)
if recalc_timeout:
if "timeout" in kwargs:
kwargs["timeout"] = expires - current_time
@ -340,7 +340,7 @@ if hasattr(select, "select"):
timeout = None if timeout is None else max(timeout, 0.0)
ready = []
r, w, _ = _syscall_wrapper(self._select, True, self._readers,
self._writers, timeout)
self._writers, timeout=timeout)
r = set(r)
w = set(w)
for fd in r | w:
@ -561,14 +561,14 @@ if hasattr(select, "kqueue"):
select.KQ_FILTER_READ,
select.KQ_EV_ADD)
_syscall_wrapper(self._kqueue.control, False, [kevent], 0, 0)
_syscall_wrapper(self._wrap_control, False, [kevent], 0, 0)
if events & EVENT_WRITE:
kevent = select.kevent(key.fd,
select.KQ_FILTER_WRITE,
select.KQ_EV_ADD)
_syscall_wrapper(self._kqueue.control, False, [kevent], 0, 0)
_syscall_wrapper(self._wrap_control, False, [kevent], 0, 0)
return key
@ -579,7 +579,7 @@ if hasattr(select, "kqueue"):
select.KQ_FILTER_READ,
select.KQ_EV_DELETE)
try:
_syscall_wrapper(self._kqueue.control, False, [kevent], 0, 0)
_syscall_wrapper(self._wrap_control, False, [kevent], 0, 0)
except SelectorError:
pass
if key.events & EVENT_WRITE:
@ -587,7 +587,7 @@ if hasattr(select, "kqueue"):
select.KQ_FILTER_WRITE,
select.KQ_EV_DELETE)
try:
_syscall_wrapper(self._kqueue.control, False, [kevent], 0, 0)
_syscall_wrapper(self._wrap_control, False, [kevent], 0, 0)
except SelectorError:
pass
@ -600,8 +600,8 @@ if hasattr(select, "kqueue"):
max_events = len(self._fd_to_key) * 2
ready_fds = {}
kevent_list = _syscall_wrapper(self._kqueue.control, True,
None, max_events, timeout)
kevent_list = _syscall_wrapper(self._wrap_control, True,
None, max_events, timeout=timeout)
for kevent in kevent_list:
fd = kevent.ident
@ -626,6 +626,9 @@ if hasattr(select, "kqueue"):
self._kqueue.close()
super(KqueueSelector, self).close()
def _wrap_control(self, changelist, max_events, timeout):
return self._kqueue.control(changelist, max_events, timeout)
__all__.append('KqueueSelector')

View File

@ -1458,6 +1458,13 @@ PLUGIN_FILTERS_CFG:
ini:
- key: plugin_filters_cfg
section: default
deprecated:
why: Specifying "plugin_filters_cfg" under the "default" section is deprecated
version: "2.12"
alternatives: the "defaults" section instead
- key: plugin_filters_cfg
section: defaults
type: path
RETRY_FILES_ENABLED:
name: Retry files
default: True

View File

@ -5,6 +5,7 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import os.path
import sys
import stat
import tempfile
@ -144,31 +145,63 @@ def find_ini_config_file(warnings=None):
''' Load INI Config File order(first found is used): ENV, CWD, HOME, /etc/ansible '''
# FIXME: eventually deprecate ini configs
path0 = os.getenv("ANSIBLE_CONFIG", None)
if path0 is not None:
path0 = unfrackpath(path0, follow=False)
if os.path.isdir(path0):
path0 += "/ansible.cfg"
try:
path1 = os.getcwd()
perms1 = os.stat(path1)
if perms1.st_mode & stat.S_IWOTH:
if warnings is not None:
warnings.add("Ansible is in a world writable directory (%s), ignoring it as an ansible.cfg source." % to_text(path1))
path1 = None
else:
path1 += "/ansible.cfg"
except OSError:
path1 = None
path2 = unfrackpath("~/.ansible.cfg", follow=False)
path3 = "/etc/ansible/ansible.cfg"
if warnings is None:
# Note: In this case, warnings does nothing
warnings = set()
for path in [path0, path1, path2, path3]:
if path is not None and os.path.exists(path):
# A value that can never be a valid path so that we can tell if ANSIBLE_CONFIG was set later
# We can't use None because we could set path to None.
SENTINEL = object
potential_paths = []
# Environment setting
path_from_env = os.getenv("ANSIBLE_CONFIG", SENTINEL)
if path_from_env is not SENTINEL:
path_from_env = unfrackpath(path_from_env, follow=False)
if os.path.isdir(path_from_env):
path_from_env = os.path.join(path_from_env, "ansible.cfg")
potential_paths.append(path_from_env)
# Current working directory
warn_cmd_public = False
try:
cwd = os.getcwd()
perms = os.stat(cwd)
cwd_cfg = os.path.join(cwd, "ansible.cfg")
if perms.st_mode & stat.S_IWOTH:
# Working directory is world writable so we'll skip it.
# Still have to look for a file here, though, so that we know if we have to warn
if os.path.exists(cwd_cfg):
warn_cmd_public = True
else:
potential_paths.append(cwd_cfg)
except OSError:
# If we can't access cwd, we'll simply skip it as a possible config source
pass
# Per user location
potential_paths.append(unfrackpath("~/.ansible.cfg", follow=False))
# System location
potential_paths.append("/etc/ansible/ansible.cfg")
for path in potential_paths:
if os.path.exists(path):
break
else:
path = None
# Emit a warning if all the following are true:
# * We did not use a config from ANSIBLE_CONFIG
# * There's an ansible.cfg in the current working directory that we skipped
if path_from_env != path and warn_cmd_public:
warnings.add(u"Ansible is being run in a world writable directory (%s),"
u" ignoring it as an ansible.cfg source."
u" For more information see"
u" https://docs.ansible.com/ansible/devel/reference_appendices/config.html#cfg-in-world-writable-dir"
% to_text(cwd))
return path

View File

@ -22,7 +22,7 @@ def _warning(msg):
try:
from __main__ import display
display.warning(msg)
except:
except Exception:
import sys
sys.stderr.write(' [WARNING] %s\n' % (msg))
@ -32,7 +32,7 @@ def _deprecated(msg, version='2.8'):
try:
from __main__ import display
display.deprecated(msg, version=version)
except:
except Exception:
import sys
sys.stderr.write(' [DEPRECATED] %s, to be removed in %s\n' % (msg, version))
@ -53,7 +53,7 @@ def get_config(parser, section, key, env_var, default_value, value_type=None, ex
if value is None:
try:
value = get_ini_config_value(parser, {'key': key, 'section': section})
except:
except Exception:
pass
if value is None:
value = default_value
@ -121,6 +121,10 @@ VAULT_VERSION_MAX = 1.0
# object. The dictionary values are tuples, to account for aliases
# in variable names.
COMMON_CONNECTION_VARS = frozenset(set(('ansible_connection', 'ansible_host', 'ansible_user', 'ansible_shell_executable',
'ansible_port', 'ansible_pipelining', 'ansible_password', 'ansible_timeout',
'ansible_shell_type', 'ansible_module_compression', 'ansible_private_key_file')))
MAGIC_VARIABLE_MAPPING = dict(
# base
@ -191,7 +195,7 @@ for setting in config.data.get_settings():
value = literal_eval(value)
except ValueError:
pass # not a python data structure
except:
except Exception:
pass # not templatable
value = ensure_type(value, setting.name)

View File

@ -102,16 +102,13 @@ class PlaybookExecutor:
# clear any filters which may have been applied to the inventory
self._inventory.remove_restriction()
# Create a temporary copy of the play here, so we can run post_validate
# on it without the templating changes affecting the original object.
# Doing this before vars_prompt to allow for using variables in prompt.
# Allow variables to be used in vars_prompt fields.
all_vars = self._variable_manager.get_vars(play=play)
templar = Templar(loader=self._loader, variables=all_vars)
new_play = play.copy()
new_play.post_validate(templar)
setattr(play, 'vars_prompt', templar.template(play.vars_prompt))
if play.vars_prompt:
for var in new_play.vars_prompt:
for var in play.vars_prompt:
vname = var['name']
prompt = var.get("prompt", vname)
default = var.get("default", None)
@ -128,17 +125,17 @@ class PlaybookExecutor:
else: # we are either in --list-<option> or syntax check
play.vars[vname] = default
# Post validating again in case variables were entered in the prompt.
all_vars = self._variable_manager.get_vars(play=play)
templar = Templar(loader=self._loader, variables=all_vars)
new_play.post_validate(templar)
# Post validate so any play level variables are templated
all_vars = self._variable_manager.get_vars(play=play)
templar = Templar(loader=self._loader, variables=all_vars)
play.post_validate(templar)
if self._options.syntax:
continue
if self._tqm is None:
# we are just doing a listing
entry['plays'].append(new_play)
entry['plays'].append(play)
else:
self._tqm._unreachable_hosts.update(self._unreachable_hosts)
@ -148,9 +145,9 @@ class PlaybookExecutor:
break_play = False
# we are actually running plays
batches = self._get_serialized_batches(new_play)
batches = self._get_serialized_batches(play)
if len(batches) == 0:
self._tqm.send_callback('v2_playbook_on_play_start', new_play)
self._tqm.send_callback('v2_playbook_on_play_start', play)
self._tqm.send_callback('v2_playbook_on_no_hosts_matched')
for batch in batches:
# restrict the inventory to the hosts in the serialized batch

View File

@ -93,7 +93,7 @@ class CloudFrontFactsServiceManager(object):
def list_origin_access_identities(self):
try:
paginator = self.client.get_paginator('list_cloud_front_origin_access_identities')
result = paginator.paginate().build_full_result()['CloudFrontOriginAccessIdentityList']
result = paginator.paginate().build_full_result().get('CloudFrontOriginAccessIdentityList', {})
return result.get('Items', [])
except botocore.exceptions.ClientError as e:
self.module.fail_json_aws(e, msg="Error listing cloud front origin access identities")

View File

@ -839,6 +839,9 @@ class AzureRMModuleBase(object):
profile_default_version = api_profile_dict.get('default_api_version', None)
if api_version or profile_default_version:
client_kwargs['api_version'] = api_version or profile_default_version
if 'profile' in client_kwargs:
# remove profile; only pass API version if specified
client_kwargs.pop('profile')
client = client_type(**client_kwargs)

View File

@ -30,10 +30,14 @@
import os
try:
import MySQLdb
mysqldb_found = True
import pymysql as mysql_driver
except ImportError:
mysqldb_found = False
try:
import MySQLdb as mysql_driver
except ImportError:
mysql_driver = None
mysql_driver_fail_msg = 'The PyMySQL (Python 2.7 and Python 3.X) or MySQL-python (Python 2.X) module is required.'
def mysql_connect(module, login_user=None, login_password=None, config_file='', ssl_cert=None, ssl_key=None, ssl_ca=None, db=None, cursor_class=None,
@ -69,8 +73,8 @@ def mysql_connect(module, login_user=None, login_password=None, config_file='',
if connect_timeout is not None:
config['connect_timeout'] = connect_timeout
db_connection = MySQLdb.connect(**config)
db_connection = mysql_driver.connect(**config)
if cursor_class is not None:
return db_connection.cursor(cursorclass=MySQLdb.cursors.DictCursor)
return db_connection.cursor(cursorclass=mysql_driver.cursors.DictCursor)
else:
return db_connection.cursor()

View File

@ -176,7 +176,12 @@ class Cli:
prompt = None
answer = None
out = connection.get(command, prompt, answer)
try:
out = connection.get(command, prompt, answer)
except ConnectionError as exc:
if check_rc:
raise
out = getattr(exc, 'err', exc)
out = to_text(out, errors='surrogate_or_strict')
try:
@ -338,7 +343,7 @@ class Eapi:
return response
def run_commands(self, commands):
def run_commands(self, commands, check_rc=True):
"""Runs list of commands on remote device and returns results
"""
output = None
@ -440,7 +445,11 @@ class Eapi:
commands = ['configure session %s' % session, 'abort']
self.send_request(commands)
err = response['error']
self._module.fail_json(msg=err['message'], code=err['code'])
error_text = []
for data in err['data']:
error_text.extend(data.get('errors', []))
error_text = '\n'.join(error_text) or err['message']
self._module.fail_json(msg=error_text, code=err['code'])
commands = ['configure session %s' % session, 'show session-config diffs']
if commit:
@ -489,9 +498,9 @@ def get_config(module, flags=None):
return conn.get_config(flags)
def run_commands(module, commands):
def run_commands(module, commands, check_rc=True):
conn = get_connection(module)
return conn.run_commands(to_command(module, commands))
return conn.run_commands(to_command(module, commands), check_rc)
def load_config(module, config, commit=False, replace=False):

View File

@ -166,3 +166,51 @@ def load_config(module, commands):
connection = get_connection(module)
return connection.edit_config(commands)
def normalize_interface(name):
"""Return the normalized interface name
"""
if not name:
return
def _get_number(name):
digits = ''
for char in name:
if char.isdigit() or char in '/.':
digits += char
return digits
if name.lower().startswith('gi'):
if_type = 'GigabitEthernet'
elif name.lower().startswith('te'):
if_type = 'TenGigabitEthernet'
elif name.lower().startswith('fa'):
if_type = 'FastEthernet'
elif name.lower().startswith('fo'):
if_type = 'FortyGigabitEthernet'
elif name.lower().startswith('et'):
if_type = 'Ethernet'
elif name.lower().startswith('vl'):
if_type = 'Vlan'
elif name.lower().startswith('lo'):
if_type = 'loopback'
elif name.lower().startswith('po'):
if_type = 'port-channel'
elif name.lower().startswith('nv'):
if_type = 'nve'
else:
if_type = None
number_list = name.split(' ')
if len(number_list) == 2:
if_number = number_list[-1].strip()
else:
if_number = _get_number(name)
if if_type:
proper_interface = if_type + if_number
else:
proper_interface = name
return proper_interface

View File

@ -418,8 +418,34 @@ class Nxapi:
else:
return []
def get_device_info(self):
device_info = {}
device_info['network_os'] = 'nxos'
reply = self.run_commands({'command': 'show version', 'output': 'json'})
data = reply[0]
platform_reply = self.run_commands({'command': 'show inventory', 'output': 'json'})
platform_info = platform_reply[0]
device_info['network_os_version'] = data.get('sys_ver_str') or data.get('kickstart_ver_str')
device_info['network_os_model'] = data['chassis_id']
device_info['network_os_hostname'] = data['host_name']
device_info['network_os_image'] = data.get('isan_file_name') or data.get('kick_file_name')
if platform_info:
inventory_table = platform_info['TABLE_inv']['ROW_inv']
for info in inventory_table:
if 'Chassis' in info['name']:
device_info['network_os_platform'] = info['productid']
return device_info
def get_capabilities(self):
return {}
result = {}
result['device_info'] = self.get_device_info()
result['network_api'] = 'nxapi'
return result
def is_json(cmd):

View File

@ -157,8 +157,7 @@ EXAMPLES = '''
subnet_id: subnet-xxxxxxxx
eni_id: eni-yyyyyyyy
state: present
secondary_private_ip_addresses:
-
secondary_private_ip_address_count: 0
# Destroy an ENI, detaching it from any instance if necessary
- ec2_eni:

View File

@ -257,7 +257,7 @@ def main():
attributes=dict(required=True, type='list'),
))
required_together = (['cluster', 'ec2_instance_id', 'attributes'])
required_together = [['cluster', 'ec2_instance_id', 'attributes']]
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True,
required_together=required_together)

View File

@ -162,7 +162,7 @@ def main():
delay=dict(required=False, type='int', default=10),
repeat=dict(required=False, type='int', default=10)
))
required_together = (['state', 'name'])
required_together = [['state', 'name']]
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True, required_together=required_together)

View File

@ -989,9 +989,9 @@ def main():
required_if=[
('state', 'present', ['subnets', 'security_groups'])
],
required_together=(
required_together=[
['access_logs_enabled', 'access_logs_s3_bucket', 'access_logs_s3_prefix']
)
]
)
# Quick check of listeners parameters

View File

@ -258,7 +258,7 @@ def main():
)
module = AnsibleModule(argument_spec=argument_spec,
mutually_exclusive=['load_balancer_arns', 'names'],
mutually_exclusive=[['load_balancer_arns', 'names']],
supports_check_mode=True
)

View File

@ -296,7 +296,7 @@ def main():
)
module = AnsibleModule(argument_spec=argument_spec,
mutually_exclusive=['target_group_arn', 'target_group_name']
mutually_exclusive=[['target_group_arn', 'target_group_name']]
)
if not HAS_BOTO3:

View File

@ -247,7 +247,7 @@ def main():
)
module = AnsibleModule(argument_spec=argument_spec,
mutually_exclusive=['load_balancer_arn', 'target_group_arns', 'names'],
mutually_exclusive=[['load_balancer_arn', 'target_group_arns', 'names']],
supports_check_mode=True
)

View File

@ -93,7 +93,7 @@ EXAMPLES = '''
msg: "Name is {{ my_instance.instance.name }}"
- debug:
msg: "IP is {{ my_instance.instance.publicIpAddress }}"
msg: "IP is {{ my_instance.instance.public_ip_address }}"
# Delete an instance if present
- lightsail:

View File

@ -50,7 +50,7 @@ options:
choices:
- public
- none
default: None
default: 'none'
ports:
description:
- List of ports exposed within the container group.
@ -93,7 +93,7 @@ options:
description:
- Force update of existing container instance. Any update will result in deletion and recreation of existing containers.
type: bool
default: False
default: 'no'
extends_documentation_fragment:
- azure
@ -145,6 +145,7 @@ from ansible.module_utils.azure_rm_common import AzureRMModuleBase
try:
from msrestazure.azure_exceptions import CloudError
from msrestazure.azure_operation import AzureOperationPoller
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
except ImportError:
# This is handled in azure_rm_common
@ -383,6 +384,9 @@ class AzureRMContainerInstance(AzureRMModuleBase):
container_group_name=self.name,
container_group=parameters)
if isinstance(response, AzureOperationPoller):
response = self.get_poller_result(response)
return response.as_dict()
def delete_containerinstance(self):

View File

@ -88,9 +88,9 @@ import time
from ansible.module_utils.azure_rm_common import AzureRMModuleBase
try:
from msrestazure.azure_exceptions import CloudError
from msrestazure.azure_operation import AzureOperationPoller
from azure.mgmt.rdbms.mysql import MySQLManagementClient
from msrestazure.azure_exceptions import CloudError
from msrest.polling import LROPoller
from msrest.serialization import Model
except ImportError:
# This is handled in azure_rm_common
@ -240,7 +240,7 @@ class AzureRMDatabases(AzureRMModuleBase):
server_name=self.server_name,
database_name=self.name,
parameters=self.parameters)
if isinstance(response, AzureOperationPoller):
if isinstance(response, LROPoller):
response = self.get_poller_result(response)
except CloudError as exc:

View File

@ -124,9 +124,9 @@ import time
from ansible.module_utils.azure_rm_common import AzureRMModuleBase
try:
from msrestazure.azure_exceptions import CloudError
from msrestazure.azure_operation import AzureOperationPoller
from azure.mgmt.rdbms.mysql import MySQLManagementClient
from msrestazure.azure_exceptions import CloudError
from msrest.polling import LROPoller
from msrest.serialization import Model
except ImportError:
# This is handled in azure_rm_common
@ -303,10 +303,15 @@ class AzureRMServers(AzureRMModuleBase):
self.log("Creating / Updating the MySQL Server instance {0}".format(self.name))
try:
response = self.mgmt_client.servers.create_or_update(resource_group_name=self.resource_group,
server_name=self.name,
parameters=self.parameters)
if isinstance(response, AzureOperationPoller):
if (self.to_do == Actions.Create):
response = self.mgmt_client.servers.create(resource_group_name=self.resource_group,
server_name=self.name,
parameters=self.parameters)
else:
response = self.mgmt_client.servers.update(resource_group_name=self.resource_group,
server_name=self.name,
parameters=self.parameters)
if isinstance(response, LROPoller):
response = self.get_poller_result(response)
except CloudError as exc:

View File

@ -88,9 +88,9 @@ import time
from ansible.module_utils.azure_rm_common import AzureRMModuleBase
try:
from msrestazure.azure_exceptions import CloudError
from msrestazure.azure_operation import AzureOperationPoller
from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient
from msrestazure.azure_exceptions import CloudError
from msrest.polling import LROPoller
from msrest.serialization import Model
except ImportError:
# This is handled in azure_rm_common
@ -240,7 +240,7 @@ class AzureRMDatabases(AzureRMModuleBase):
server_name=self.server_name,
database_name=self.name,
parameters=self.parameters)
if isinstance(response, AzureOperationPoller):
if isinstance(response, LROPoller):
response = self.get_poller_result(response)
except CloudError as exc:

View File

@ -124,9 +124,9 @@ import time
from ansible.module_utils.azure_rm_common import AzureRMModuleBase
try:
from msrestazure.azure_exceptions import CloudError
from msrestazure.azure_operation import AzureOperationPoller
from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient
from msrestazure.azure_exceptions import CloudError
from msrest.polling import LROPoller
from msrest.serialization import Model
except ImportError:
# This is handled in azure_rm_common
@ -311,7 +311,7 @@ class AzureRMServers(AzureRMModuleBase):
response = self.mgmt_client.servers.update(resource_group_name=self.resource_group,
server_name=self.name,
parameters=self.parameters)
if isinstance(response, AzureOperationPoller):
if isinstance(response, LROPoller):
response = self.get_poller_result(response)
except CloudError as exc:

View File

@ -308,12 +308,12 @@ def main():
validate_certs=dict(type='bool', default=True),
timeout=dict(type='int', default=30),
),
required_if=([
required_if=[
('state', 'delete', ['ip'])
]),
mutually_exclusive=(
],
mutually_exclusive=[
['region', 'droplet_id']
),
],
)
core(module)

View File

@ -42,7 +42,7 @@ options:
description:
- Enable Source NAT (SNAT) attribute.
required: false
default: true
type: bool
network:
description:
- Unique name or ID of the external gateway network.
@ -317,7 +317,8 @@ def _build_kwargs(cloud, module, router, network):
if network:
kwargs['ext_gateway_net_id'] = network['id']
# can't send enable_snat unless we have a network
kwargs['enable_snat'] = module.params['enable_snat']
if module.params['enable_snat']:
kwargs['enable_snat'] = module.params['enable_snat']
if module.params['external_fixed_ips']:
kwargs['ext_fixed_ips'] = []
@ -381,7 +382,7 @@ def main():
state=dict(default='present', choices=['absent', 'present']),
name=dict(required=True),
admin_state_up=dict(type='bool', default=True),
enable_snat=dict(type='bool', default=True),
enable_snat=dict(type='bool'),
network=dict(default=None),
interfaces=dict(type='list', default=None),
external_fixed_ips=dict(type='list', default=None),

View File

@ -163,7 +163,7 @@ def main():
module = AnsibleModule(
argument_spec=argument_spec,
required_one_of=[['name', 'uuid']],
required_together=['name', 'folder']
required_together=[['name', 'folder']],
)
# FindByInventoryPath() does not require an absolute path

View File

@ -349,7 +349,7 @@ def main():
mutually_exclusive=(('file_reference', 'inline_data'),
('url_username', 'insecure'),
('url_password', 'insecure')),
required_one_of=(('file_reference', 'inline_data')),
required_one_of=(('file_reference', 'inline_data'),),
)
if not HAS_LIB_YAML:

View File

@ -68,7 +68,9 @@ requirements:
- mysql (command line binary)
- mysqldump (command line binary)
notes:
- Requires the python-mysqldb package on the remote host, as well as mysql and mysqldump binaries.
- Requires the PyMySQL (Python 2.7 and Python 3.X) or MySQL-python (Python 2.X) package on the remote host,
as well as mysql and mysqldump binaries.
- This module is B(not idempotent) when I(state) is C(import), and will import the dump file each time if run more than once.
extends_documentation_fragment: mysql
'''
@ -107,16 +109,9 @@ import pipes
import subprocess
import traceback
try:
import MySQLdb
except ImportError:
mysqldb_found = False
else:
mysqldb_found = True
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.database import mysql_quote_identifier
from ansible.module_utils.mysql import mysql_connect, mysqldb_found
from ansible.module_utils.mysql import mysql_connect, mysql_driver, mysql_driver_fail_msg
from ansible.module_utils._text import to_native
@ -275,8 +270,8 @@ def main():
supports_check_mode=True
)
if not mysqldb_found:
module.fail_json(msg="The MySQL-python module is required.")
if mysql_driver is None:
module.fail_json(msg=mysql_driver_fail_msg)
db = module.params["name"]
encoding = module.params["encoding"]

View File

@ -121,15 +121,8 @@ EXAMPLES = '''
import os
import warnings
try:
import MySQLdb
except ImportError:
mysqldb_found = False
else:
mysqldb_found = True
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.mysql import mysql_connect
from ansible.module_utils.mysql import mysql_connect, mysql_driver, mysql_driver_fail_msg
from ansible.module_utils._text import to_native
@ -242,16 +235,16 @@ def main():
connect_timeout = module.params['connect_timeout']
config_file = module.params['config_file']
if not mysqldb_found:
module.fail_json(msg="The MySQL-python module is required.")
if mysql_driver is None:
module.fail_json(msg=mysql_driver_fail_msg)
else:
warnings.filterwarnings('error', category=MySQLdb.Warning)
warnings.filterwarnings('error', category=mysql_driver.Warning)
login_password = module.params["login_password"]
login_user = module.params["login_user"]
try:
cursor = mysql_connect(module, login_user, login_password, config_file, ssl_cert, ssl_key, ssl_ca, None, 'MySQLdb.cursors.DictCursor',
cursor = mysql_connect(module, login_user, login_password, config_file, ssl_cert, ssl_key, ssl_ca, None, 'mysql_driver.cursors.DictCursor',
connect_timeout=connect_timeout)
except Exception as e:
if os.path.exists(config_file):
@ -328,7 +321,7 @@ def main():
chm.append("MASTER_AUTO_POSITION = 1")
try:
changemaster(cursor, chm, chm_params)
except MySQLdb.Warning as e:
except mysql_driver.Warning as e:
result['warning'] = to_native(e)
except Exception as e:
module.fail_json(msg='%s. Query == CHANGE MASTER TO %s' % (to_native(e), chm))

View File

@ -208,16 +208,9 @@ import re
import string
import traceback
try:
import MySQLdb
except ImportError:
mysqldb_found = False
else:
mysqldb_found = True
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.database import SQLParseError
from ansible.module_utils.mysql import mysql_connect, mysqldb_found
from ansible.module_utils.mysql import mysql_connect, mysql_driver, mysql_driver_fail_msg
from ansible.module_utils.six import iteritems
from ansible.module_utils._text import to_native
@ -590,8 +583,8 @@ def main():
db = 'mysql'
sql_log_bin = module.params["sql_log_bin"]
if not mysqldb_found:
module.fail_json(msg="The MySQL-python module is required.")
if mysql_driver is None:
module.fail_json(msg=mysql_driver_fail_msg)
cursor = None
try:
@ -630,14 +623,14 @@ def main():
else:
changed = user_mod(cursor, user, host, host_all, None, encrypted, priv, append_privs, module)
except (SQLParseError, InvalidPrivsError, MySQLdb.Error) as e:
except (SQLParseError, InvalidPrivsError, mysql_driver.Error) as e:
module.fail_json(msg=to_native(e), exception=traceback.format_exc())
else:
if host_all:
module.fail_json(msg="host_all parameter cannot be used when adding a user")
try:
changed = user_add(cursor, user, host, host_all, password, encrypted, priv, module.check_mode)
except (SQLParseError, InvalidPrivsError, MySQLdb.Error) as e:
except (SQLParseError, InvalidPrivsError, mysql_driver.Error) as e:
module.fail_json(msg=to_native(e), exception=traceback.format_exc())
elif state == "absent":
if user_exists(cursor, user, host, host_all):

View File

@ -50,16 +50,9 @@ import os
import warnings
from re import match
try:
import MySQLdb
except ImportError:
mysqldb_found = False
else:
mysqldb_found = True
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.database import SQLParseError, mysql_quote_identifier
from ansible.module_utils.mysql import mysql_connect, mysqldb_found
from ansible.module_utils.mysql import mysql_connect, mysql_driver, mysql_driver_fail_msg
from ansible.module_utils._text import to_native
@ -148,10 +141,10 @@ def main():
module.fail_json(msg="Cannot run without variable to operate with")
if match('^[0-9a-z_]+$', mysqlvar) is None:
module.fail_json(msg="invalid variable name \"%s\"" % mysqlvar)
if not mysqldb_found:
module.fail_json(msg="The MySQL-python module is required.")
if mysql_driver is None:
module.fail_json(msg=mysql_driver_fail_msg)
else:
warnings.filterwarnings('error', category=MySQLdb.Warning)
warnings.filterwarnings('error', category=mysql_driver.Warning)
try:
cursor = mysql_connect(module, user, password, config_file, ssl_cert, ssl_key, ssl_ca, db,

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