manala.git
#######################################################################################################
:exclamation: 废弃 :exclamation:
该仓库及其相关角色已废弃,推荐使用 Manala Ansible Collection
有关其使用的信息,请参阅 集合仓库
#######################################################################################################
Ansible 角色: Git 
:exclamation: 报告问题 和 提交 Pull 请求 到 主 Ansible 角色仓库 :exclamation:
该角色将处理 Git 的安装和配置,包括:
- 安装 GIT 包
- 定义 gitconfig 文件
- 允许配置 giconfig 文件
这是 Manala Ansible 堆栈 的一部分,但可以作为独立组件使用。
要求
无。
依赖
无。
安装
Ansible 2+
使用 ansible galaxy 命令行工具:
ansible-galaxy install manala.git
使用 ansible galaxy 需求文件:
- src: manala.git
角色处理程序
无
角色变量
名称 | 默认值 | 类型 | 说明 |
---|---|---|---|
manala_git_install_packages |
~ | 数组 | 要安装的依赖包 |
manala_git_install_packages_default |
['git'] | 数组 | 默认要安装的依赖包 |
manala_git_config_file |
'/etc/gitconfig' | 字符串 | 配置文件路径 |
manala_git_config_template |
'config/empty.j2' | 字符串 | 配置模板路径 |
manala_git_config |
~ | 数组/字符串 | Git 配置选项 |
manala_git_repositories |
[] | 数组 | 要检出的仓库列表 |
GIT 配置
manala_git_config_file
键允许您指定配置文件的路径。
有经验的 GIT 用户可以使用 manala_git_config_template
键提供自己的自定义模板。
使用模板:
manala_git_config_template: my/gitconfig.j2
manala_git_config:
foo: bar
使用字典参数:
manala_git_config:
user:
name: Foo Bar
email: [email protected]
core:
filemode: false
使用原始配置:
manala_git_config: |
[user]
name = Foo Bar
email = [email protected]
[core]
filemode = false
使用字典的数组参数(已废弃):
manala_git_config:
- user:
- name: Foo Bar
- email: [email protected]
- core:
- filemode: false
自动检出所需仓库
manala_git_repositories
键是一个“特殊的”键,旨在允许自动检出指定的仓库:
变量
名称 | 默认值 | 类型 | 说明 |
---|---|---|---|
repo |
~ (必填) | 字符串 | git、SSH 或 HTTP 协议的仓库地址 |
dest |
~ (必填) | 字符串 | 要将仓库检出到的绝对路径 |
version |
HEAD | 字符串 | 要检出的仓库版本 |
update |
true | 布尔值 | 如果为否,则不从原始仓库检索新修订 |
user |
~ | 字符串 | 以指定用户检出仓库 |
示例
manala_git_repositories:
- repo: https://github.com/symfony/symfony1.git
dest: /usr/share/symfony/symfony-1.4
version: v1.4.20
update: false
user: app
示例剧本
- hosts: servers
roles:
- role: manala.git
许可证
MIT
作者信息
Manala (http://www.manala.io/)