clone a specific branch from git through ansible playbook

时光怂恿深爱的人放手 提交于 2020-04-10 06:47:08

问题


I am using ansible to deploy my app. I am cloning the app from github using the following:

- name: Deploy site files from Github repository
  sudo: yes
  git: repo=git@github.com:xyz/abc.git dest=/home/{{deploy_user}}/{{app_name}} key_file=/home/ubuntu/.ssh/id_rsa accept_hostkey=yes force=yes

I want to clone a specific branch from the repository. I read the documentation of ansible but couldn't find any option to clone a specific branch. It has an option to clone a version but not branch.


回答1:


From the documentation:

version

What version of the repository to check out. This can be the full 40-character SHA-1 hash, the literal string HEAD, a branch name, or a tag name.

(emphasis mine)




回答2:


Use version, here's the example from the docs:

- git:
    repo: git://foosball.example.org/path/to/repo.git
    dest: /srv/checkout
    version: dev


来源:https://stackoverflow.com/questions/33450240/clone-a-specific-branch-from-git-through-ansible-playbook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!