added setting of ansible_ssh_user to current user as backwards compatibilty issue

pull/12926/head
Brian Coca 9 years ago
parent 4486e136ea
commit c271c0eb04

@ -26,6 +26,9 @@ import random
import re import re
import string import string
from pwd import getpwuid
from os import geteuid
from ansible.compat.six import iteritems, string_types from ansible.compat.six import iteritems, string_types
from ansible import constants as C from ansible import constants as C
from ansible.errors import AnsibleError from ansible.errors import AnsibleError
@ -479,3 +482,7 @@ class PlayContext(Base):
for prop, varnames in MAGIC_VARIABLE_MAPPING.items(): for prop, varnames in MAGIC_VARIABLE_MAPPING.items():
if special_var in varnames: if special_var in varnames:
variables[special_var] = getattr(self, prop) variables[special_var] = getattr(self, prop)
# for backwards compat
if variables['ansible_ssh_user'] is None:
variables['ansible_ssh_user'] = getpwuid(geteuid())[0]

Loading…
Cancel
Save