I'm using the following role for Ansible in order to clone a project in my vagrant setup:
- name: Clone Repository
git:
repo: https://login:[email protected]/team/repo.git
dest: /home/vagrant/workspace/
accept_hostkey: true
The cloning is working as expected, but the main issue is that the directory workspace and all it's content is now owned by root:
drwxr-xr-x 7 root root 4096 Jun 10 12:35 workspace
I was thinking that those command were executed by 'vagrant' user as I defined in my playbook:
- hosts: vagrant
sudo: yes
remote_user: vagrant
roles:
- git
Can you guys help me with this issue?
Thank you.
remote_user: vagrant
means that it will ssh into the host as uservagrant
.sudo: yes
means that before executing each task it willsudo
, by default to root. You need to removesudo: yes
.