aboutsummaryrefslogtreecommitdiffstats
path: root/roles/git/tasks/main.yml
blob: 5600e2db2fb717652972f23985d20089f5f8c5fa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

# git ~~ roles/git/tasks/main.yml
# Init git user and settings

---

- name: ensure git package is present
  package: name=git state=present

- name: ensure git group exists
  group:
    name: "{{ git_group }}"
    state: present

- name: ensure git user exists
  user:
    name: "{{ git_user }}"
    group: "{{ git_group }}"
    shell: "{{ git_shell }}"
    home: "/home/{{ git_user }}"
    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
  file:
    path: "/home/{{ git_user }}/git-shell-commands"
    owner: "{{ git_user }}"
    group: "{{ git_group }}"
    state: directory
    mode: 0755

- name: generate git-shell no-login prompt
  template:
    src: no-interactive-login.j2
    dest: "/home/{{ git_user }}/git-shell-commands/no-interactive-login"
    owner: "{{ git_user }}"
    group: "{{ git_group }}"
    mode: 0744
  when: git_nologin is defined and git_nologin
remember that computers suck.