* 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)
* fix a (forgotten?) change in moving createhome -> create_home
Fix for following bug on FreeBSD host whith user module:
```
fatal: [webssp]: FAILED! => {"changed": false, "module_stderr": "X11 forwarding request failed
Traceback (most recent call last):
File \"/tmp/ansible_2rmlBl/ansible_module_user.py\", line 2487, in <module>
main()\n File \"/tmp/ansible_2rmlBl/ansible_module_user.py\", line 2426, in main
(rc, out, err) = user.modify_user()
File \"/tmp/ansible_2rmlBl/ansible_module_user.py\", line 1011, in modify_user
if (info[5] != self.home and self.move_home) or (not os.path.exists(self.home) and self.createhome):
AttributeError: 'FreeBsdUser' object has no attribute 'createhome'
", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 1}
```
It happenned with 'createhome' AND with 'create_home' form, with python 2.7 AND python 3.6
* Add changelog
Co-authored-by: dgeo <dgeo@users.noreply.github.com>
(cherry picked from commit ae96ba0d4f)
* 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
* Fixed changelog Shippable errors
* Fix 2 for Shippable changelog errors
* Fix fetching old style facts in junos_facts module (#42336)
* Fix fetching old style facts in junos_facts module
Fixes#42298
* To fetch old style facts from junos device it requires
login credentials in provider, hence while using
connection=nectonf do not delete provider values
as it might not be ignored
* Add `ofacts` as one of the options in `gather_subset`
* Minor update in documentation
* Fix CI failure
(cherry picked from commit 31dd41e4c5)
* Update changelog
* Add warning when using an empty regexp in lineinfile (#42013)
* Revert "Account for empty string regexp in lineinfile (#41451)"
This reverts commit 4b5b4a760c.
* Use context managers for interacting with files
* Store line and regexp parameters in a variable
* Add warning when regexp is an empty string
* Remove '=' from error messages
* Update warning message and add changelog
* Add tests
* Improve warning message
Offer an equivalent regexp that won't trigger the warning.
Update tests to match new warning.
* Add porting guide entry for lineinfile change
# Conflicts:
# docs/docsite/rst/porting_guides/porting_guide_2.7.rst
# lib/ansible/modules/files/lineinfile.py
# test/integration/targets/lineinfile/tasks/main.yml
* Add porting guide info
* To fix the NoneType error raised in ios_l2_interface when Access Mode VLAN is unassigned (#42312)
* to fix the bug41657
* to fix review comment
(cherry picked from commit 828dd1a663)
* adding changelog
* renaming the changelog file name
* deleting the wrong changelog file name
* Refactor/fix win_group_membership to use SIDs for internal comparisons (#40725)
* refactor win_group_membership to use SIDs for comparisons instead of name parsing
* carry over previous doc cleanup changes
* remove trailing whitespace from docs
(cherry picked from commit bcb49f2575)
* Added changelog fragment
* ignore ansible.cfg in world writable cwd
* also added 'warnings' to config
* updated man page template
(cherry picked from commit b6f2aad)
Co-authored-by: Brian Coca <bcoca@users.noreply.github.com>
* Skip if insertbefore BOF until later (#41767)
If a line match is found in the file and no regexp is specified, insertbefore would improperly try to add a line if set to BOF.
Add tests for this scenario.
(cherry picked from commit eaae1318f8)
* Add changelog fragment
* Use inventory.get_host instead of direct access to inventory.hosts (#41860)
* Use inventory.get_host instead of direct access to inventory.hosts. Fixes#32152
* Prevent potential side effect, by using self._inventory.localhost directly instead of get_host
(cherry picked from commit 1a2ef0922f)
* Add changelog for #41860