Iva*_*nin 4 git git-bare ansible
我想问一下,如何使用 Ansible 来实现这样的情况。
\n\n我的主要目标是 nit git bare 存储库并将其克隆到同一台计算机 (/var/www)。\n我通常的步骤是:
\n\n1) git init \xe2\x80\x94bare (在 /git/project-name 中运行)
\n\n2) git clone /git/project-name \xe2\x80\x94no-hardlinks (在 \xd0\xb2 /var/www 中运行)
\n\n当我愿意使用 Ansible 来完成这种情况时,我无法实现第一步——如果是空的 git bare 存储库则初始化。
\n\nAnsible git 模块要求“repo”参数应填写存储库地址,但如果我只是创建一个,我如何定义它?
\n\ngit: 回购=?? dest=/git/项目名称 bare=yes
\n这是一个使用新的裸存储库设置 git 服务器的示例手册:
---
- hosts: git.example.org
become: true
tasks:
- user:
name: git
shell: /usr/bin/git-shell
home: /srv/git
- authorized_key:
user: git
state: present
key: https://github.com/myuser.keys
- command: git init --bare /srv/git/myrepo.git
args:
creates: /srv/git/myrepo.git/HEAD
become_user: git
Run Code Online (Sandbox Code Playgroud)
如果您已经git在服务器上设置了用户,那么您只需专注于该command任务。享受!
| 归档时间: |
|
| 查看次数: |
8930 次 |
| 最近记录: |