Skip to content

Add ansible_ssh_password as alias for ansible_ssh_pass variable #577

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions plugins/action/synchronize.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,9 @@ def run(self, tmp=None, task_vars=None):

# Determine if we need a user@ and a password
user = None
password = task_vars.get('ansible_ssh_pass', None) or task_vars.get('ansible_password', None)
password = (task_vars.get('ansible_ssh_password', None)
or task_vars.get('ansible_ssh_pass', None)
or task_vars.get('ansible_password', None))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This order is the password priority order. In this case, this logic is a first match, so how about this order based on the documents as follows: https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/connection/ssh.py#L61-L64

          vars:
              - name: ansible_password
              - name: ansible_ssh_pass
              - name: ansible_ssh_password

if not dest_is_local:
# Src and dest rsync "path" handling
if boolean(_tmp_args.get('set_remote_user', 'yes'), strict=False):
Expand Down Expand Up @@ -372,7 +374,9 @@ def run(self, tmp=None, task_vars=None):
src = self._process_origin(src_host, src, user)
dest = self._process_remote(_tmp_args, dest_host, dest, user, inv_port in localhost_ports)

password = dest_host_inventory_vars.get('ansible_ssh_pass', None) or dest_host_inventory_vars.get('ansible_password', None)
password = (dest_host_inventory_vars.get('ansible_ssh_password', None)
or dest_host_inventory_vars.get('ansible_ssh_pass', None)
or dest_host_inventory_vars.get('ansible_password', None))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here'

if self._templar is not None:
password = self._templar.template(password)
else:
Expand Down