Search code examples
githubyamlansiblegit-clone

Ansible not pulling git repo


I'm trying to pull github repo using ansible, but it's giving me following error.

stderr: fatal: destination path '/var/www/server-ip' already exists and is not an empty directory.

msg: fatal: destination path '/var/www/server-ip' already exists and is not an empty directory.

Here is what I've done so far.

- name: Pull sources from GitHub git: repo: "{{ item.github_repo }}" version: "{{ item.github_branch }}" dest: "{{ WEB_ROOT }}/{{ item.server_name }}" key_file: "/home/username/.ssh/id_rsa" force: yes recursive: no when: item.get('state', 'link') == 'link' with_items: VIRTUAL_HOSTS


Solution

  • The error message already made it plain: the path you are cloning to is not an empty directory. Use another path or delete that directory.