Ansible role: dagos.git

CI Release Quality Downloads

A role for installing and configuring Git.

Requirements

None.

Role variables

The following variables are overridable by users to configure this role:

---
# By default we ensure that git is present and configured.
# Allowed values: present, install, configure
state: present

# The settings provided via this variable are applied to the global git config.
# They are combined with the default_git_settings variable.
git_settings: {}

The default Git configuration values are as follows:

---
# The following settings provide some sensible defaults to apply globally.
# Override or append to them via the 'git_settings' variable.
default_git_settings:
  core.autocrlf: "false"
  core.editor: vim
  core.longpaths: "true"
  pull.ff: only

See the official Git documentation for a list of available configuration values.

Dependencies

None.

Example playbook

The following playbook is tested regularly as part of the defined CI pipeline:

---
- name: Converge
  hosts: all
  pre_tasks:
    - name: Create a test user
      ansible.builtin.user:
        name: test
        state: present
        create_home: true
  roles:
    - role: dagos.git
      become: true
      become_user: test
      vars:
        state: present
        git_settings:
          user.name: Max Mustermann
          user.email: max.mustermann@gmx.de
          pull.ff: "false"

License

MIT

Author information

This role was created in 2022 by Lucas Resch.