* 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>
* 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
* fixes#45941
* corrects regression introduced by #26104; when the resource group doesn't exist, the module exits prematurely with an error instead of creating it.
(cherry picked from commit 3b52d968e6)
* Support nested JSON decoding in AnsibleJSONDecoder
* Add tests for vault portion of AnsibleJSONDecoder
(cherry picked from commit c0915e2)
Co-authored-by: Matt Martz <matt@sivel.net>
* 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>
* fix tempating issues with no_log and loops (#44468)
* fix tempating issues with no_log and loops
- task is no log if any item is
- added test cases
fixes#43294
(cherry picked from commit bda074d34e)
* use play context to avoid bug when jinja2+py3
* Fix pkg_mgr_name fact finding for Fedora (#40922)
* Properly handle default package manager vs apt
For distros where apt might be installed but is not the default
package manager for the distro, properly identify the default distro
package manager during fact finding and re-use fact finding from
DistributionFactCollector and instead of reimplementing small
portions of it in PkgMgrFactCollector
Add unit test to always check the apt + Fedora combination to test
the new code.
Fixes#34014
Signed-off-by: Adam Miller <admiller@redhat.com>
* remove q debugging output I accidentally left behind
Signed-off-by: Adam Miller <admiller@redhat.com>
* add os_family to the conditional so we're only hitting that code path when needed
Signed-off-by: Adam Miller <admiller@redhat.com>
* setup for a _check* pattern for general os_family group pkg_mgr checking
Signed-off-by: Adam Miller <admiller@redhat.com>
* use Mock.patch decorator for os.path.exists in TestPkgMgrFactsAptFedora
Signed-off-by: Adam Miller <admiller@redhat.com>
* fix fedora version dnf fact, default pkg_mgr detection per distro family (#43261)
* fix fedora version dnf fact, default pkg_mgr detection per distro family
* loop over possible dnf/yum paths in case there are multiple canonical sources later in life
Signed-off-by: Adam Miller <admiller@redhat.com>
* pkg_mgr: fixed apt_rpm detection (#43769)
Instead of checking the distribution name (which apparently is tricky to find out)
check if /usr/bin/apt-get is managed by RPM.
Fixes#43539
* Ensure that apt is always chosen on debian/ubuntu
One can install alternate packages managers on debuntu machines.
However, doing so doesn't mean you want to suddenly start using them.
Add in a check similar to the fedora yum/dnf check that sets apt as the
pkg_mgr if the ansible_os_family is Debian.
* To resolve nios_network issue where vendor-encapsulated-options can not have a use_option flag (#43925)
* to resolve 43657
* fix shippable error
(cherry picked from commit 4e5dbb92dc)
* adding changelog
* 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)
Some distribtuions like SUSE has the rc%.d directories under /etc/init.d
Quote of /etc/rc.d.README on SLES11.
"Some people expect the system startup scripts in /etc/rc.d/.
We use a slightly different structure for better LSB compliance."
(cherry picked from commit c7d0e3b166)
* More consistent Docker unit parsing (#16748)
* Docker: Convert units for kernel_memory
Other memory arguments already use human_to_bytes to convert the
units. This change makes the behavior more consistent.
* Update Docker unit parsing documentation
This explains the units more precisely and makes the documentation
more consistent.
This fixes#16526.
* Add changelog entry.
* docker_container: allow arbitrary log_driver (#33579)
Docker supports logging plugin (see https://docs.docker.com/engine/admin/logging/plugins)
so it no longer makes sense to limit the log_driver option to a set of
fixed choices.
* Changelog entry.
When creating a new account, check to see if the expiration parameter is negative and pass in the appropriate parameter. Since the negative integer passed into expires is converted to time.struct_time which in turn gets converted to a formatted time string when passed to the underlying command, a -1 or large negative number would result in passing a date before 1970-01-01 to the underlying command.
This had the opposite effect of creating an account with no expiration account resulting in a newly created account that was already expired, or just throwing an error on certain systems.
(cherry picked from commit df335d91b0)
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>
* Fix win_domain_computer
Fixes#43653
- Change descrtiption parameter default to null.
When reading an empty description from AD, powershell returns a null.
- Convert after and before diff keys to ordered hashes.
Unordered state descriptions make --diff report equal values as
changes.
(cherry picked from commit f583656985)
* Add changelog
* fixes parameters via environment variables, issue #44163
(cherry picked from commit 2c84022b20)
* including test case using environment variables as per issue #44163
(cherry picked from commit eaaada25c7)
* including missing environment variable in shared documentation fragement, related to issue #44163
(cherry picked from commit e97d2e7ed1)
* added changelog
* yml fix
* docker_container: fix check mode for container creation (#42380)
* Create copy of HostConfig object before adding it to results.
* Create general sanitize function in docker_common. Using it for all return values of docker_container.
* Make Python 2.6 compatible.
* Added changelog.
* docker_container: improving idempotency (#44808)
* Only handle cpu_shares, volume_driver, auto_remove as in _host_config().
* Don't compare log_options (resp restart_retries) if log_driver (resp restart_policy) is not specified.
* Warn that log_options (resp restart_retries) is ignored if log_driver (resp restart_policy) is not specified.
* Added changelog.
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>
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>
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)
* Resolves bug where existing host_record was deleted when existing record name is used with different IP (#43235)
* resolves bug 42937
* resolves integration test failure
* resolves integration test failure
* resolves integration test failure
(cherry picked from commit fd4e774cec)
* changelogs
* 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)
* change column value to string. handle idempotency in no key case
* Fix 2 issues in sysvinit module (#42786)
* Do not compare result to unset parameter in sysvinit module
* Fix misformed command in sysvinit module
* Small None-comparison style fix in sysvinit module
(cherry picked from commit f26272a492)
* Update changelog
* Update openstack inventory script to keep basic functionality (#43432)
re-applies commit 6667ec4474 which
fixed the plugin to the script so that it will work with current
ansible-inventory.
Also redirect stdout before dumping the ouptput, because not doing
so will cause JSON parse errors in some cases.
(cherry picked from commit fa45c44026)
* fixed the plugin to the script so that it will work with current
* Correcting conditionals looping (#43331)
Empty conditionals would not break out of the loop, causing every command to be run for the same number of times as retries is defined (10 by default)
(cherry picked from commit e215f842ba)
* Update changelog
* Only report change when home directory is different
Add tests with home: parameter
Have to skip macOS for now since there is a bug when specifying the home directory path for an existing user that results in a module failure. That needs to be fixed in a separate PR.
(cherry picked from commit 0ca61e9d87)
* win_user: use different method to validate credentials that does not rely on SMB/RPC
* Use Add-Type as SetLastError on .net reflection not working on 2012 R2
(cherry picked from commit 04431216e7)
This adds scenario guide for removing VM using vmware_guest module.
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
(cherry picked from commit 6339e37abd)
* 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)
* Fix tmpdir on non root become
- also avoid exception if tmpdir and remote_tmp are None
- give 'None' on deescalation so tempfile will fallback to it's default behaviour
and use system dirs
- fix issue with bad tempdir (not existing/not createable/not writeable)
i.e nobody and ~/.ansible/tmp
- added tests for blockfile case
* Revert "Temporarily revert c119d54"
This reverts commit 5c614a59a6.
* changes based on PR feedback and changelog fragment
* changes based on the review
* Fix tmpdir when makedirs failed so we just use the system tmp
* Let missing remote_tmp fail
If remote_tmp is missing then there's something more basic wrong in the
communication from the controller to the module-side. It's better to
be alerted in this case than to silently ignore it.
jborean and I have independently checked what happens if the user sets
ansible_remote_tmp to empty string and !!null and both cases work fine.
(null is turned into a default value controller-side. empty string
triggers the warning because it is probably not a directory that the
become user is able to use).
(cherry picked from commit 8bdd04c147)
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)
* docker_container: fix init check requirements (#40839)
* docker_container: ensure 'init' is supported
Check docker-py version too.
Move API version check in docker_container module since 'init' module
parameter isn't defined by other docker modules.
docker-py supports 'init' since 2.2.0:
https://github.com/docker/docker-py/blob/2.2.0/docs/change-log.md
* docker_container: fix compat with docker-py<2.2
Exception was:
TypeError: create_host_config() got an unexpected keyword argument 'init'
fatal: [localhost]: FAILED! => {
"changed": false,
"module_stderr": "Traceback (most recent call last):
File ansible_module_docker_container.py, line 2089, in <module>
main()
File ansible_module_docker_container.py, line 2084, in main
cm = ContainerManager(client)
File ansible_module_docker_container.py, line 1704, in __init__
self.present(state)
File ansible_module_docker_container.py, line 1724, in present
new_container = self.container_create(self.parameters.image, self.parameters.create_parameters)
File ansible_module_docker_container.py, line 826, in create_parameters
host_config=self._host_config(),
File ansible_module_docker_container.py, line 932, in _host_config
return self.client.create_host_config(**params)
File lib/python3.6/site-packages/docker/api/container.py, line 157, in create_host_config
return utils.create_host_config(*args, **kwargs)
TypeError: create_host_config() got an unexpected keyword argument 'init'",
"module_stdout": "",
"msg": "MODULE FAILURE",
"rc": 1
}
(cherry picked from commit 3301a0b530)
* add changelog fragment
* win_reboot: fix 2.6 issues and better handle post reboot reboot
* changed winrm _reset to reset
* Add handler to reset calls when .reset() throws an AnsibleError on older hosts
* Moving back to _reset to get the issue fixed
(cherry picked from commit 940d4a0e89)