对Azure存储库的Ansible克隆的交互式密码支持 [英] Interactive password support for Ansible clone of Azure Repository
本文介绍了对Azure存储库的Ansible克隆的交互式密码支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
需要什么特定的语法才能使Ansible从Azure存储库克隆git存储库?
存储库URL为 https://OrganizationName@dev.azure.com/OrganizationName/ProjectName/_git/RepositoryName
,我们可以通过提供请求的密码在交互式外壳中手动克隆它我们拥有如下:
The repository URL is https://OrganizationName@dev.azure.com/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://OrganizationName@dev.azure.com/OrganizationName/ProjectName/_git/RepositoryName
Password for 'https://OrganizationName@dev.azure.com':
但是,我们从Ansible官方文档中获得的Ansible示例任务不包括任何密码,如下所示:
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://OrganizationName@dev.azure.com/OrganizationName/ProjectName/_git/RepositoryName
dest: /src/RepositoryName
推荐答案
您的密码必须位于您的回购链接中,如下所示:
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://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
这篇关于对Azure存储库的Ansible克隆的交互式密码支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文