From 8277747a04367a82c65d7c377e61199c66874dcc Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Mon, 12 Oct 2015 15:50:23 -0700 Subject: [PATCH] Fix password lookup when password file exists and the password is not encrypted --- lib/ansible/plugins/lookup/password.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/ansible/plugins/lookup/password.py b/lib/ansible/plugins/lookup/password.py index cf09a7e302..9806788165 100644 --- a/lib/ansible/plugins/lookup/password.py +++ b/lib/ansible/plugins/lookup/password.py @@ -135,20 +135,19 @@ class LookupModule(LookupBase): else: content = open(path).read().rstrip() + password = content + salt = None if params['encrypt'] is not None: try: sep = content.rindex(' ') except ValueError: - password = content - salt = None + # No salt + pass else: salt_field = content[sep + 1:] if salt_field.startswith('salt='): password = content[:sep] salt = salt_field[len('salt='):] - else: - password = content - salt = None # crypt requested, add salt if missing if not salt: