diff options
author | Brian Coca <brian.coca+git@gmail.com> | 2015-10-26 21:09:35 +0100 |
---|---|---|
committer | Brian Coca <brian.coca+git@gmail.com> | 2015-10-26 21:10:13 +0100 |
commit | c271c0eb04f540bce8a4d6544cbcbc36dd2835a3 (patch) | |
tree | bbcf1a6c84aefeb812abbfb04a0033e8f0b90cb0 | |
parent | Merge pull request #12899 from bcoca/vault_fixes (diff) | |
download | ansible-c271c0eb04f540bce8a4d6544cbcbc36dd2835a3.tar.xz ansible-c271c0eb04f540bce8a4d6544cbcbc36dd2835a3.zip |
added setting of ansible_ssh_user to current user as backwards compatibilty issue
-rw-r--r-- | lib/ansible/playbook/play_context.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/ansible/playbook/play_context.py b/lib/ansible/playbook/play_context.py index b1a0e18e7f..465cb137e2 100644 --- a/lib/ansible/playbook/play_context.py +++ b/lib/ansible/playbook/play_context.py @@ -26,6 +26,9 @@ import random import re import string +from pwd import getpwuid +from os import geteuid + from ansible.compat.six import iteritems, string_types from ansible import constants as C from ansible.errors import AnsibleError @@ -479,3 +482,7 @@ class PlayContext(Base): for prop, varnames in MAGIC_VARIABLE_MAPPING.items(): if special_var in varnames: variables[special_var] = getattr(self, prop) + + # for backwards compat + if variables['ansible_ssh_user'] is None: + variables['ansible_ssh_user'] = getpwuid(geteuid())[0] |