A developer just finished making changes to some code on a Dev server that received a git clone
from an Azure git Repository using Ansible.
What specific syntax must be used in Ansible tasks to
add
,commit
, andpush
the developer's changed code from the Dev server back to the same Azure git Repository?
The following is the git clone
Ansible task that was contributed by @garylopez:
---
- name: Clone repo playbook
hosts: dev
vars_prompt:
- 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
We have examined the Ansible git
module's docs, but do not see a boilerplate example.
We imagine someone might resort to some sort of shell command solution in Ansible tasks if the Ansible git
module does not support this. But we are asking here hoping that a best practice type approach might be offered in an answer.