CORD-1183 Use local user for SSH key check

Change-Id: I4991b68a1a9d668535f0e771e891345db14e68be
(cherry picked from commit 46f1be40a9e3924c25d490807b75547b74c00121)
diff --git a/roles/head-node/tasks/main.yml b/roles/head-node/tasks/main.yml
index 2ace0af..a9103e9 100644
--- a/roles/head-node/tasks/main.yml
+++ b/roles/head-node/tasks/main.yml
@@ -1,7 +1,15 @@
+# Fetch local user rather than relying on (deprecated) ansible_user
+- name: Get the username running the deploy
+  local_action: command whoami
+  register: username_on_the_host
+  tags:
+    - establish_ssh_keys
+    - skip_ansible_lint
+
 # SSH Key access from the current machine to the target node is required for the
 # synchronize action to work.
 - name: Ensure User SSH Keys
-  local_action: user name='{{ ansible_user_id }}' generate_ssh_key=yes ssh_key_bits=2048
+  local_action: user name='{{ username_on_the_host.stdout }}' generate_ssh_key=yes ssh_key_bits=2048
   tags:
     - establish_ssh_keys