Azure 存储库 Ansible 克隆的交互式密码支持
Interactive password support for Ansible clone of Azure Repository
What specific syntax needs to be used to get Ansible to clone a git repository from Azure Repositories?
存储库 URL 是 https://OrganizationName@dev.azure.com/OrganizationName/ProjectName/_git/RepositoryName
,我们可以通过提供我们拥有的请求密码在交互式 shell 中手动克隆它,如下所示:
$ git clone https://OrganizationName@dev.azure.com/OrganizationName/ProjectName/_git/RepositoryName
Password for 'https://OrganizationName@dev.azure.com':
但是,我们从 Ansible 官方文档中获得的 Ansible 示例任务中并没有提到任何密码,如下所示:
- name: Clone a repo
git:
repo: https://OrganizationName@dev.azure.com/OrganizationName/ProjectName/_git/RepositoryName
dest: /src/RepositoryName
您的密码必须在您的存储库 link 中,如下所示
---
- 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://OrganizationName@dev.azure.com'"
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
What specific syntax needs to be used to get Ansible to clone a git repository from Azure Repositories?
存储库 URL 是 https://OrganizationName@dev.azure.com/OrganizationName/ProjectName/_git/RepositoryName
,我们可以通过提供我们拥有的请求密码在交互式 shell 中手动克隆它,如下所示:
$ git clone https://OrganizationName@dev.azure.com/OrganizationName/ProjectName/_git/RepositoryName
Password for 'https://OrganizationName@dev.azure.com':
但是,我们从 Ansible 官方文档中获得的 Ansible 示例任务中并没有提到任何密码,如下所示:
- name: Clone a repo
git:
repo: https://OrganizationName@dev.azure.com/OrganizationName/ProjectName/_git/RepositoryName
dest: /src/RepositoryName
您的密码必须在您的存储库 link 中,如下所示
---
- 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://OrganizationName@dev.azure.com'"
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