ElaoInfra.git

Ansible Role Platforms License

Ansible Role: GIT

This role sets up and configures Git by:

  • Installing the Git package.
  • Defining the gitconfig file.
  • Allowing the setup of the gitconfig file.

It is part of the ELAO Ansible stack, but can also be used on its own.

Requirements

  • Ansible 1.9.0 or newer

Dependencies

None.

Installation

Ansible 2+

Using ansible galaxy command line:

ansible-galaxy install elao.git,2.0

Using an ansible galaxy requirements file:

- src:     elao.git
  version: 2.0

Ansible 1 (no longer maintained)

Using ansible galaxy command line:

ansible-galaxy install elao.git,1.0

Using an ansible galaxy requirements file:

- src:     elao.git
  version: 1.0

Role Handlers

None

Role Variables

Name Default Type Description
elao_git_config_file /etc/gitconfig String (path) Path to the configuration file
elao_git_config_template config/empty.j2 String (path) Path to the template for config
elao_git_config [] Array List of Git configuration options
elao_git_repositories [] Array List of repositories to check out

GIT Configuration

The elao_git_config_file key lets you specify the path to the config file.

Example:

---

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

The elao_git_config_template key allows you to use different main configuration templates. The role comes with basic templates:

  • base (Simple template with no default settings)
  • dev (Configuration for Vagrant VM, like ohmyzsh)
  • test
  • prod (Light configuration for production)

Experienced Git users can provide their own custom template using the elao_git_config_template key.

The elao_git_config key allows you to define Git config options like this:

Example:

---

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

Auto-checkout of Required Repositories

The elao_git_repositories key is special; it allows automatic checkout of specified repositories:

Variables

Name Default Type Description
repo ~ (required) String Address of the Git repository (git, SSH, or HTTP)
dest ~ (required) String Path where the repository should be checked out to
version HEAD String Version of the repository to check out
update true Boolean If false, do not retrieve new updates from the original repository

Example:

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

Example Playbook

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

License

MIT

Author Information

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

Informazioni sul progetto

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

Installa
ansible-galaxy install ElaoInfra.git
Licenza
Unknown
Download
518
Proprietario
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