This ansible role is used to manage git on specified local folder.
It can init (not as bare at this time) ; config options and remotes ; launch actions.
Usefull if you use a "work machine" and you wan to deploy on somes others.
I use it to add/commit/push all my work git folders on my local gitea and gitlab as backup.
I also use it on particular nodes to deploy new certs files.
This playbooks just manage git, it's not designed to run any others pre/post tasks.
Platform | Versions |
---|---|
Debian | all |
EL | all |
Fedora | all |
Ubuntu | all |
Ansible >= 2.13
None.
ansible-galaxy install dginhoux.git_repos
git clone https://github.com/dginhoux/ansible_role.git_repos dginhoux.git_repos
- name: Playbook
hosts: all
tasks:
- name: Start role dginhoux.git_repos
ansible.builtin.include_role:
name: dginhoux.git_repos
Defaults variables defined in defaults/main.yml
git_repos_install_binary: true
git_repos:
- name: ansible_role_dginhoux.sysctl
path: "/data/roles-infra/dginhoux.sysctl"
state: present
make_init: true
make_conf_options: true
make_conf_remotes: true
make_actions: true
ignores: ""
configs:
- { state: present, name: user.name, value: git }
- { state: present, name: user.email, value: git@ginhoux.net }
- { state: present, name: core.compression, value: 9 }
- { state: present, name: core.sharedrepository, value: all }
- { state: present, name: core.editor, value: vim }
- { state: present, name: color.ui, value: "true" }
- { state: present, name: format.pretty, value: oneline }
- { state: absent, name: core.autocrlf, value: input }
- { state: absent, name: core.logallrefupdates, value: "true" }
remotes:
- name: gitea
url: "https://XXXXXXXXXXXXXXXXXXXXX@git-system.ginhoux.net/ansible/dginhoux.sysctl.git"
state: present
- name: github
url: "https://AAAAAAAAAAAAAAAAAAAAA@github.com/dginhoux/ansible_role.sysctl.git"
state: present
actions:
- # { action: command, command: "rm -r --cached .", ignore_error: true }
- { action: add, content: "." }
- { action: commit, message: "{{ git_repos_commit_msg }}" }
- { action: command, command: "tag v1.2.0", ignore_error: true }
- { action: push, to: gitea master, extra_params: "--tags" }
- { action: push, to: github master, extra_params: "--tags", ignore_error: true }
Those variables files are located in vars/*.yml
are used to handle OS differences.
One of theses is loaded dynamically during role runtime using the include_vars
module and set OS specifics variable's.
NOT USED BY THIS ROLE
Dany GINHOUX - https://github.com/dginhoux
MIT