Need help with ansible-playbook "git" module

I have to clone a git repository in 10 remote servers. Firstly, I want to know that do I need to install git on all the 10 servers or only on local system. Second is I am getting this error - “stderr”: “fatal: could not create leading directories of ‘/opt/rahul/nemp-scripts’: Permission denied\n” when I am trying to clone a repo in a remote server in which git is already installed.

My code looks like below -

tasks:

  • name: Clone bitbucket repo
    git:
    repo: ssh://git@git.xyz.git
    dest: /opt/rahul/nemp-scripts
    version: master
    accept_hostkey: yes
    key_file: /home/rahul/.ssh/id_rsa

Any help is appreciated

Thanks

You have a permissions issue. Check the user has permissions to write to the path you have chosen.