ElaoInfra.git

Ansible 角色 平台 许可证

Ansible 角色: GIT

此角色将通过以下方式假设 git 的设置和配置:

  • 安装 GIT 包
  • 定义 gitconfig 文件
  • 允许设置 giconfig 文件

它是 ELAO Ansible 堆栈 的一部分,但也可以作为独立组件使用。

要求

  • Ansible 1.9.0+

依赖

无。

安装

Ansible 2+

使用 ansible galaxy 命令行:

ansible-galaxy install elao.git,2.0

使用 ansible galaxy 需求文件:

- src:     elao.git
  version: 2.0

Ansible 1(不再维护)

使用 ansible galaxy 命令行:

ansible-galaxy install elao.git,1.0

使用 ansible galaxy 需求文件:

- src:     elao.git
  version: 1.0

角色处理器

角色变量

名称 默认值 类型 描述
elao_git_config_file /etc/gitconfig 字符串(路径) 配置文件的路径
elao_git_config_template config/empty.j2 字符串(路径) 配置模板的路径
elao_git_config [] 数组 git 配置选项列表
elao_git_repositories [] 数组 要检出的仓库列表

GIT 配置

elao_git_config_file 键允许你指定配置文件的路径。

示例:

---

elao_git_config_file: "{{ playbook_dir }}/templates/git/config.j2"

elao_git_config_template 键将允许你使用不同的主要配置模板。该角色附带基本模板:

  • base(没有默认配置的简单模板)
  • dev(此配置为 Vagrant 虚拟机提供选项,例如 ohmyzsh)
  • test
  • prod(用于生产目的,轻量级配置模板)

有经验的 GIT 用户可以通过 elao_git_config_template 键提供自定义模板。

elao_git_config 键允许定义 git 配置键,如下所示:

示例:

---

elao_git_config:
  - user:
    - name:           "Guewen FAIVRE"
    - email:          "[email protected]"

  - core:
    - autocrlf:       input
    - compression:    9
    - excludesfile:   "~/.gitignore_global"
    - filemode:       false

  - remote "france":
    - url:            git://repohost/project1.git
    - fetch:          +refs/heads/*:refs/remotes/origin/*

  - color:
    - ui:             "true"

  - color:
    - option:         branch
    - current:        yellow reverse
    - local:          yellow
    - remote:         green

  - color:
    - option:         diff
    - meta:           yellow bold
    - frag:           magenta bold
    - old:            red bold
    - new:            green bold

  - color:
    - option:         status
    - added:          yellow
    - changed:        green
    - untracked:      red

  - alias:
    - br:             branch -av
    - ci:             commit

所需仓库的自动检出

elao_git_repositories 键是一个“特殊键”,旨在允许自动检出指定的仓库:

变量

名称 默认值 类型 描述
repo ~ (必需) 字符串 git、SSH 或 HTTP 协议地址
dest ~ (必需) 字符串 仓库检出到的绝对路径
version HEAD 字符串 检出的仓库版本
update true 布尔值 如果为 false,则不从源仓库检索新版本

示例:

---
elao_git_repositories:
  - repo:    https://github.com/symfony/symfony1.git
    dest:    /usr/share/symfony/symfony-1.4
    version: v1.4.20
    update:  false

示例剧本

- hosts: servers
  roles:
     - { role: elao.git }

许可证

MIT

作者信息

ELAO (http://www.elao.com/)

关于项目

This role will assume the setup and configuration of git - Installing GIT package - Define the gitconfig file - Allow setup of the giconfig file

安装
ansible-galaxy install ElaoInfra.git
许可证
Unknown
下载
518
拥有者
All of those roles aren't maintained anymore and we strongly encourage you to switch to our new (maintained and tested) Ansible stack: https://github.com/manala