https://github.com/papanito/ansible-role-git
This role is used for simplified git checkouts using a list of git repos.
https://github.com/papanito/ansible-role-git
ansible ansible-role git
Last synced: 2 months ago
JSON representation
This role is used for simplified git checkouts using a list of git repos.
- Host: GitHub
- URL: https://github.com/papanito/ansible-role-git
- Owner: papanito
- Created: 2021-01-01T12:50:16.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-08-05T10:59:57.000Z (almost 3 years ago)
- Last Synced: 2025-03-16T20:21:22.490Z (over 1 year ago)
- Topics: ansible, ansible-role, git
- Homepage:
- Size: 15.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# Ansbile role "papanito.git"
[](https://galaxy.ansible.com/papanito/git) [](https://galaxy.ansible.com/papanito/git) [](https://galaxy.ansible.com/papanito/git) [](https://github.com/papanito/ansible-role-git/issues) [](https://github.com/papanito/ansible-role-git/pulls)
This role is used for simplified git checkouts. The idea is to provide a list of git repos to clone to a common directory, which can be overridden.
## Requirements
[Ansible Collection 'kewlfft.aur'](https://github.com/kewlfft/ansible-aur)
## Role Variables
### General parameters
These are all variables
|Parameter|Description|Default Value|
|---------|-----------|-------------|
|`git_repos`|Dictionary of git repos, see [Parameters for `git_repos`](#parameters-for-git-repos)|-|
|`accept_hostkey`|if `yes`, ensure that `-o StrictHostKeyChecking=no` is present as an ssh option.|`No`|
|`install_packages`|if `no` git packages are not installed, otherwise you need to run the role with `--ask-become-pass`|`Yes`|
#### Parameters for `git_repos`
`git_repos` are always mounted with [type `cifs` and in state `mounted`](https://docs.ansible.com/ansible/latest/modules/mount_module.html). However there are some options to provide:
|Parameter|Description|Default Value|
|---------|-----------|-------------|
|`repo`|[Mandatory] git, SSH, or HTTP(S) protocol address of the git repository.|-|
|`dest`|Base dir of path of where the repository should be checked out. This parameter is required, unless `clone` is set to `no`
The final path where the git checkout happens is `{{ dest }}/{{ git_repos.key }}`|-|
|`remote`|Name of the remote.|`origin`|
|`bare`|if `yes`, repository will be created as a bare repo, otherwise it will be a standard repo with a workspace.|`No`|
|`clone`|If `no`, do not clone the repository even if it does not exist locally|`Yes`|
|`force`|If `yes`, any modified files in the working repository will be discarded. Prior to 0.7, this was always 'yes' and could not be disabled. Prior to 1.9, the default was `yes`|`No`|
|`recursive`|If `no` repository will be cloned without the `--recursive` option, skipping sub-modules.|`Yes`|
|`update`|If `no` do not retrieve new revisions from the origin repository|`Yes`|
|`dependencies`|List of packages (dependencies) to be installer. It suffices if providing the package name. However it supports additional package types if you add a list `{ name:PACKAGENAME, type:PACKAGETYPE}`, whereas `PACKAGETYPE` can be
- `aur`: Archlinux AUR
**Examples:**
Checkout repo `git@github.com:qeeqbox/social-analyzer.git` to `~/Workspace/social-analyzer-demo`.
```yml
vars:
git_repos:
social-analyzer-demo:
repo: git@github.com:qeeqbox/social-analyzer.git
dest: ~/Workspace
```
Checkout two repos to `~/Workspace/social-analyzer` and `~/Workspace/airgeddon`. In addition som packages are installed (which are required to run the `airgeddon` script)
```yml
vars:
git_repos:
social-analyzer:
repo: git@github.com:qeeqbox/social-analyzer.git
airgeddon:
repo: git@github.com:v1s1t0r1sh3r3/airgeddon.git
dependencies:
- { name: crunch, type: aur }
- aircrack-nge
```
## Dependencies
none
## Example Playbook
Run `ansible-playbook ./tests/test.yml -i ./tests/inventory -e "install_packages=No"`
```yaml
---
- hosts: localhost
vars:
default_workspace: "~/Workspace/demo"
git_repos:
social-analyzer:
repo: git@github.com:qeeqbox/social-analyzer.git
roles:
- papanito.git
```
## License
This is Free Software, released under the terms of the Apache v2 license.
## Author Information
Written by [Papanito](https://wyssmann.com) - [Gitlab](https://gitlab.com/papanito) / [Github](https://github.com/papanito)