I am trying to clone from git private repo. I have done all the other steps but when it reaches to pull sources from git, I suddenly got error that /var/www/ directory is not empty. I donot know how to tackle this issue. Here is the chunk of code where I am facing error:
- name: Pull sources from GitHub
git:
repo: “{{ item.github_repo }}”
version: “{{ item.github_branch }}”
dest: “{{ WEB_ROOT }}/{{ item.server_name }}”
key_file: “/home/brokergenius/.ssh/id_rsa”
force: yes
recursive: no
when: item.get(‘state’, ‘link’) == ‘link’
with_items: VIRTUAL_HOSTS
And error is:
TASK: [github | Pull sources from GitHub] *************************************
failed: [158.69.201.193] => (item={‘state’: ‘link’, ‘http_port’: 80, ‘github_branch’: ‘master’, ‘server_name’: ‘158.69.201.193’, ‘github_repo’: ‘git@github.com:davidandorf/pricecalculation_pos.git’}) => {“cmd”: “/usr/bin/git clone --origin origin --branch master ‘’ /var/www/158.69.201.193”, “failed”: true, “item”: {“github_branch”: “master”, “github_repo”: “git@github.com:davidandorf/pricecalculation_pos.git”, “http_port”: 80, “server_name”: “158.69.201.193”, “state”: “link”}, “rc”: 128}
stderr: fatal: destination path ‘/var/www/158.69.201.193’ already exists and is not an empty directory.
msg: fatal: destination path ‘/var/www/158.69.201.193’ already exists and is not an empty directory.
I have tried to empty that file manually and then i tried to run it again but i got the same error again.
Is there any solution to help me out guys??