Reputation: 9201
What specific syntax needs to be used to get Ansible to clone a git repository from Azure Repositories?
The repository URL is https://[email protected]/OrganizationName/ProjectName/_git/RepositoryName
and we are able to clone it manually in an interactive shell by providing a requested password which we possess as follows:
$ git clone https://[email protected]/OrganizationName/ProjectName/_git/RepositoryName
Password for 'https://[email protected]':
However, the Ansible example task that we have from the official Ansible documentation does not include any mention of a password, as follows:
- name: Clone a repo
git:
repo: https://[email protected]/OrganizationName/ProjectName/_git/RepositoryName
dest: /src/RepositoryName
Upvotes: 0
Views: 757
Reputation: 1954
Your password must be in your repo link as below
---
- name: Clone repo playbook
hosts: dev
vars_prompt:
- name: "git_user"
prompt: "Enter your git username"
private: no
- name: "git_password"
prompt: "Password for 'https://[email protected]'"
private: yes
tasks:
- name: Clone a repo
git:
repo: https://{{ git_user | urlencode }}:{{ git_password | urlencode }}@dev.azure.com/OrganizationName/ProjectName/_git/RepositoryName
dest: /src/RepositoryName
Upvotes: 2