aboutsummaryrefslogtreecommitdiffstats
path: root/roles/git
diff options
context:
space:
mode:
authorRomain Gonçalves <me@rgoncalves.se>2021-07-29 17:00:20 +0200
committerRomain Gonçalves <me@rgoncalves.se>2021-07-29 17:00:20 +0200
commitb232b894c3cbe087c8d504e91637dcf62199eed1 (patch)
treeea72a7d1a7f63c6425ee46785e1cec924351b2c3 /roles/git
parent22126073344e60c405d086df37b64da0c6d3c086 (diff)
downloadinfrastructure-b232b894c3cbe087c8d504e91637dcf62199eed1.tar.gz
Bump to third revision of homelab
Diffstat (limited to 'roles/git')
-rw-r--r--roles/git/defaults/main.yml (renamed from roles/git/vars/main.yml)1
-rw-r--r--roles/git/tasks/main.yml53
-rw-r--r--roles/git/templates/gitconfig.j22
3 files changed, 28 insertions, 28 deletions
diff --git a/roles/git/vars/main.yml b/roles/git/defaults/main.yml
index 6f7ffb8..2128abb 100644
--- a/roles/git/vars/main.yml
+++ b/roles/git/defaults/main.yml
@@ -9,3 +9,4 @@ git_group: "git"
git_dir: "/data/git"
git_shell: "/bin/sh"
+git_default_branch: "trunk"
diff --git a/roles/git/tasks/main.yml b/roles/git/tasks/main.yml
index 5600e2d..a421ad0 100644
--- a/roles/git/tasks/main.yml
+++ b/roles/git/tasks/main.yml
@@ -5,7 +5,9 @@
---
- name: ensure git package is present
- package: name=git state=present
+ package:
+ name: git
+ state: present
- name: ensure git group exists
group:
@@ -17,43 +19,38 @@
name: "{{ git_user }}"
group: "{{ git_group }}"
shell: "{{ git_shell }}"
- home: "/home/{{ git_user }}"
+ home: "{{ git_dir }}"
create_home: false
-- name: ensure git home directory is not created
- file: path="/home/{{ git_user }}" state=absent
-
-- name: ensure git-only directory exists
- file:
- path: "{{ git_dir }}"
- owner: "{{ git_user }}"
- group: "{{ git_group }}"
- state: directory
- mode: 0755
-
-- name: link git user home directory with git root repository
- file:
- src: "{{ git_dir }}"
- dest: "/home/{{ git_user }}"
- owner: "{{ git_user }}"
- group: "{{ git_group }}"
- mode: 0750
- force: true
- state: link
-
-- name: ensure git-shell-commands directory exists
+- name: ensure git directories exist
file:
- path: "/home/{{ git_user }}/git-shell-commands"
+ path: "{{ item }}"
owner: "{{ git_user }}"
group: "{{ git_group }}"
state: directory
- mode: 0755
+ mode: "0755"
+ loop:
+ - "{{ git_dir }}"
+ - "{{ git_dir }}/git-shell-commands"
- name: generate git-shell no-login prompt
template:
src: no-interactive-login.j2
- dest: "/home/{{ git_user }}/git-shell-commands/no-interactive-login"
+ dest: "{{ git_dir }}/git-shell-commands/no-interactive-login"
owner: "{{ git_user }}"
group: "{{ git_group }}"
- mode: 0744
+ mode: "0744"
when: git_nologin is defined and git_nologin
+
+- name: generate gitconfig
+ template:
+ src: gitconfig.j2
+ dest: "{{ git_dir }}/.gitconfig"
+ owner: "{{ git_user }}"
+ group: "{{ git_group }}"
+ mode: "0644"
+
+- name: synchronize ssh key
+ include_role:
+ name: sshd
+ tasks_from: sync_keys
diff --git a/roles/git/templates/gitconfig.j2 b/roles/git/templates/gitconfig.j2
new file mode 100644
index 0000000..b9923a2
--- /dev/null
+++ b/roles/git/templates/gitconfig.j2
@@ -0,0 +1,2 @@
+[init]
+ defaultBranch = {{ git_default_branch }}
remember that computers suck.