Don't hardcode Vagrant user
Change-Id: I4ef50359570a3d2fbfe06a0a4e5f9821c781a1b3
diff --git a/ansible/roles/common/tasks/main.yml b/ansible/roles/common/tasks/main.yml
index b66f3e4..3391255 100644
--- a/ansible/roles/common/tasks/main.yml
+++ b/ansible/roles/common/tasks/main.yml
@@ -28,13 +28,13 @@
- name: Ensure known_hosts file is absent
file:
- path: /home/vagrant/.ssh/known_hosts
+ path: "{{ ansible_env['PWD'] }}/.ssh/known_hosts"
state: absent
- name: Disable Known Host Checking
copy:
src: files/ssh_config
- dest: /home/vagrant/.ssh/config
- owner: vagrant
- group: vagrant
+ dest: "{{ ansible_env['PWD'] }}/.ssh/config"
+ owner: "{{ ansible_env['SUDO_USER'] }}"
+ group: "{{ ansible_env['SUDO_USER'] }}"
mode: 0600
diff --git a/ansible/roles/docker/tasks/debian.yml b/ansible/roles/docker/tasks/debian.yml
index aa10934..f3d8b7e 100644
--- a/ansible/roles/docker/tasks/debian.yml
+++ b/ansible/roles/docker/tasks/debian.yml
@@ -37,7 +37,7 @@
- name: vagrant user is added to the docker group
user:
- name: vagrant
+ name: "{{ ansible_env['SUDO_USER'] }}"
group: docker
register: user_result
tags: [docker]