When the ios_config module has 'defaults' param it runs in the device the command
'show running-config all' but 'all' may not be available in older devices.
This change makes introspection by using the help command and run 'full' in case
'all' is not available.
Fixes#22747
In old IOSXR versions, 'show commit changes diff' does not work.
Fall-back to 'show configuration' if that command fails so execution
can move forward.
Fixes#22235
This removes the requirement to configure look_for_keys=False and
restores the behavior to disable key lookup if no key was provided.
(cherry picked from commit 88ce6fd273)
The fix for leading junk in sudo output: fee6e29 causes problems with
ssh + sudo. On the initial connection using ControlPersist, the output
that we scan for the prompt contains both the command we're sending to
configure the prompt and the prompt itself. The code in fee6e29 ends up
sending the password when it sees the line configuring the prompt which
is too early.
Switch to a version that splits on lines and then checks whether the
first or last line starts with the prompt to decide if it's time to send
the password.
Fixes#23054
References #20858
(cherry picked from commit 6f77498700)
Virtuozzo Linux is based on CentOS sources. Thus OS family
should be recognized as 'RedHat'.
Signed-off-by: Pavel Glushchak <pglushchak@virtuozzo.com>
(cherry picked from commit 097173c6f5)
The pass prompt expects an answer and compares a `str` to a binary buffer, thus crashing.
It's an obvious fix to help transitioning towards Python3 and hopes it does not need a specific test.
(cherry picked from commit bc44175d8d)
When building in automated build systems, there are sometimes cases
where the user doing the building does not have a .ssh directory. In
this case, we need to mock out some os.path functions so that the
add_host_key() function we're testing won't complain or try to create
one.
(cherry picked from commit ade3fc2893)
When using state=latest with the package not being installled, Ansible complains that the package is not installed and fails the task.
Whereas the expected behaviour is to install the package when it is missing.
This PR fixes this behaviour.
(cherry picked from commit 521fa9b458)
* Fix a couple issues in synchronize with docker
* Make the rsync_opts parse as a list using the same criteria as
module_utils argumentspec parsing
* Do not quote arguments in the action plugin. The module will quote as
it knows whether it will invoke rsync with a shell or via exec.
Fixes#23046
(cherry picked from commit d3a1aea7c5)
The cron module forces changed=True when there was no real change,
but the original crontab did not contain a final newline, which is
mandatory.
When the user has no crontab or the user does not exist at all,
crontab -l exits with 1 and the cron module correctly interprets
this as "no crontab" and stores the old crontab as "".
However this triggers changed=True, even if we're not going to
change anything, e.g. when removing a crontab entry from a user
who has no crontabs at all.
Let's special-case the fact that the old crontab is empty and not
force changed=True in that case.
(cherry picked from commit 61579aebb2)
Network module docs 2.3 (#22454)
Cherry pick of https://github.com/ansible/ansible/pull/22454 into stable-2.3
* Tidy up docs for network 2.3 modules
* Use suboptions
* Correct indentation
* more tidyup
* bulk updates
* more tidyup
* Bulk changes
* nxos_mtu is dead
* revert
* NXOS_mtu is dead, also better layout
* rebase
* rebase
(cherry picked from commit f82239e1f7)
* metadata_version - merge error
* fixes action handlers for sros
* fixes sros_config module execution to use AnsibleModule
* fixes sros_command module to use socket connection
* adds sros to constants
(cherry picked from commit 3169cbd493)
This allows junos_package to use junos_pyez directly instead of the
persistent connection. This is a workaround fix for 2.3
(cherry picked from commit 33624fe96f)
Updates nxos action handler to handle deleting provider key if exists or
silently continuing if a KeyError is raised.
(cherry picked from commit 6a414371a1)
When ansible-connection forks the process, it changed the working
directory to /. This patch will prevent ansible-connection from
changing the working directory in the forked process.
(cherry picked from commit 77ce83fe22)
* synchronize: Convert cmd to list and fix handling of the copy_links argument
Converting cmd from str to list stops the pain of argument quoting/escaping.
* synchronize: Update imports according to #pullrequestreview-28758614
(cherry picked from commit f7c9f44aab)
The base64 stdlib functions require byte strings. So we have to
transform the strings into bytes before handing to the stdlib and then
transform them back into text before handing back to ansible.
Fixes#22873
(cherry picked from commit 589e217278)
* fixes#15770
* When running under the UTF-8 codepage, Powershell subprocesses will fail (eg, Start-Job, others) if the input encoding is using the default BOM preamble. This fix forces it to use no preamble in leaf_exec and win_shell, and includes tests to verify that Start-Job works.
(cherry picked from commit e084e8809e)
* updates command runs to return warning if command fails
* fixes variable issues from recent refactoring
* removes provider from return of module
(cherry picked from commit 866f67e213)
* fixes#22441
* fixes#22655
* moves all env handling into the exec wrapper; this should work for everything but raw, which is consistent with non-Windows.
(cherry picked from commit cc68212612)
The junos action handler was not honoring the host value in the provider
argument. This patch will now use the provider host entry if it exists
and falls back to the inventory hostname
(cherry picked from commit cda3e001c6)
- Add support for module_utils packages for better organization.
- Add support for "virtual" module_utils packages such as `six`.
(cherry picked from commit 4fdeade389)
Otherwise the executable for the destination is also used on the local
machine and this might not exist.
Fixes: #22867
(cherry picked from commit 7a00f28804)
purge_subnets|routes were introduced recently.
ensure_subnet_associations now takes purge_subnets as a parameter. A
call to this function was missed when introducing this feature. With
out, results in a "got 5 expected 6" error.
(cherry picked from commit cd24bbbc9c)