2
votes

Attempting to repetitively git clone deploy into a common directory, but getting errors "/www' already exists and is not an empty directory".

error: fatal: [35.162.216.10]: FAILED! => {"changed": false, "cmd": "/usr/bin/git clone --origin origin https://github.com/installtest/PHP-Algos.git /www", "failed": true, "msg": "fatal: destination path '/www' already exists and is not an empty directory.", "rc": 128, "stderr": "fatal: destination path '/www' already exists and is not an empty directory.\n", "stdout": "", "stdout_lines": []}

sections from playbook:

vars: 
    - website_dir: /www    
     - name: Deploy Code From Github
      git: 
        dest={{ website_dir }}/
        repo=https://github.com/installtest/PHP-Algos.git
    update=yes
    force=yes

perms for the deploy directory. The deploy is currently as ubuntu.

root@ip-172-30-0-219:~# ls -al /www
total 12
drwxrwxr-x  2 ubuntu www-data 4096 Nov 14 04:43 .
drwxr-xr-x 24 root   root     4096 Nov 14 04:33 ..
-rw-r--r--  1 ubuntu www-data   27 Nov 14 04:43 DATA_VARIABLES
1
I tried to apply formatting to your post, but the playbook you included is a mess. Please correct it.techraf
It tells you it's not an empty directory. And indeed, it isn't, because you have DATA_VARIABLES in there.Xiong Chiamiov

1 Answers

4
votes

dest parameter of git module is a destination directory, not the directory one step above:

Absolute path of where the repository should be checked out to.

You should use:

dest={{ website_dir }}/PHP-Algos