mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-09-16 07:16:04 +02:00
Optimized git-config role
This commit is contained in:
@@ -1,13 +1,24 @@
|
||||
# PC-Git Role
|
||||
# Git for Personal Computers
|
||||
|
||||
## Overview
|
||||
Welcome to the `pc-git` role documentation, part of the `cymais` repository. This role is focused on setting up Git, a widely-used version control system, on personal computers. The role includes tasks for installing Git and configuring global user details.
|
||||
## Description
|
||||
|
||||
## Purpose and Usage
|
||||
The `pc-git` role is essential for developers, IT professionals, and anyone who needs to utilize version control for their projects. It automates the installation of Git and the initial configuration of user identity, which is crucial for committing changes and collaborating on projects using Git.
|
||||
This role installs and configures Git on the target system using the Pacman package manager (via the community.general.pacman module). In addition, it configures Git for the user by installing a custom git configuration using the [git-configurator](https://github.com/kevinveenbirkenbach/git-configurator) tool. The role ensures that Git is installed and that the configuration tasks are run only once per host.
|
||||
|
||||
## Customization
|
||||
You can customize this role by modifying the variables for user email and name or by adding additional Git configuration tasks as needed.
|
||||
## Purpose
|
||||
|
||||
## Support and Contributions
|
||||
For support, feedback, or contributions to this role, such as adding more Git-related configurations or tools, please open an issue or submit a pull request in the `cymais` repository. Contributions that enhance Git setup and configuration are highly encouraged.
|
||||
The purpose of this role is to automate the installation and configuration of Git for personal computers. By leveraging a custom git-configurator, it sets up essential Git settings such as merge options, rebase preferences, user information, and GPG signing, ensuring a consistent environment for version control operations.
|
||||
|
||||
## Features
|
||||
|
||||
- **Automated Git Installation:** Installs Git using Pacman.
|
||||
- **Custom Git Configuration:** Invokes the git-configurator tool to merge user-specific configuration options.
|
||||
- **Idempotent Task Execution:** Uses host-level run-once artifacts to ensure that configuration tasks are executed only once per host.
|
||||
- **Integration:** Works alongside the package-manager role to streamline overall system setup.
|
||||
|
||||
## Credits
|
||||
|
||||
Developed and maintained by **Kevin Veen-Birkenbach**.
|
||||
Learn more at [www.veen.world](https://www.veen.world)
|
||||
For Git configuration details, see [git-configurator on GitHub](https://github.com/kevinveenbirkenbach/git-configurator).
|
||||
|
||||
License: [CyMaIS NonCommercial License (CNCL)](https://s.veen.world/cncl)
|
||||
|
22
roles/pc-git/meta/main.yml
Normal file
22
roles/pc-git/meta/main.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
galaxy_info:
|
||||
author: "Kevin Veen-Birkenbach"
|
||||
description: "Installs Git and configures it using a custom git-configurator for personal computers."
|
||||
license: "CyMaIS NonCommercial License (CNCL)"
|
||||
license_url: "https://s.veen.world/cncl"
|
||||
company: |
|
||||
Kevin Veen-Birkenbach
|
||||
Consulting & Coaching Solutions
|
||||
https://www.veen.world
|
||||
min_ansible_version: "2.9"
|
||||
platforms:
|
||||
- name: Archlinux
|
||||
versions:
|
||||
- rolling
|
||||
galaxy_tags:
|
||||
- git
|
||||
- configuration
|
||||
- pacman
|
||||
- personal-computer
|
||||
dependencies:
|
||||
- package-manager
|
@@ -1,8 +1,21 @@
|
||||
- name: Set git user email to {{user_email}}
|
||||
ansible.builtin.shell: git config --global user.email "{{user_email}}"
|
||||
- name: Set git user name to {{user_full_name}}
|
||||
ansible.builtin.shell: git config --global user.name "{{user_full_name}}"
|
||||
- name: install git
|
||||
community.general.pacman:
|
||||
name: git
|
||||
state: present
|
||||
state: present
|
||||
become: true
|
||||
|
||||
- name: install gitconfig
|
||||
command:
|
||||
cmd: "pkgmgr install gitconfig --clone-mode https"
|
||||
when: run_once_gitconfig is not defined
|
||||
become: true
|
||||
|
||||
- name: setup git
|
||||
command: gitconfig --merge-option rebase --name "{{users.client.full_name}}" --email "{{users.client.email}}" --website "{{users.client.website}}" --signing gpg --gpg-key "{{users.client.gpg}}"
|
||||
when: run_once_the gitconfig is not defined
|
||||
become: false
|
||||
|
||||
- name: run the gitconfig tasks once
|
||||
set_fact:
|
||||
run_once_gitconfig: true
|
||||
when: run_once_gitconfig is not defined
|
Reference in New Issue
Block a user