summaryrefslogtreecommitdiffstats
path: root/roles/gitolite/tasks/main.yml
blob: e017399d6be33e74b02294e973a9c7d27fccf117 (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
---
- name: "Load OS specific variables"
  include_vars: "{{ item }}"
  with_first_found:
    - files:
        - "{{ ansible_distribution|lower }}.yml"
        - "{{ ansible_os_family|lower }}.yml"
        - "{{ ansible_system|lower }}.yml"
      skip: true
      paths:
        - ../vars

- name: Add git user
  user:
    name: "{{ git_user }}"
    home: "{{ git_dir }}"
    system: yes
    shell: "/bin/bash"
    generate_ssh_key: yes
    state: present

- name: Install gitolite
  package:
    name: "{{ gitolite_pkg }}"
    state: present

- name: Check if this is a new installation
  stat:
    path: "{{ git_dir }}/.gitolite"
  register: gitolite_dir

- include: "init.yml"
  when: not gitolite_dir.stat.exists

- name: Copy configuration from template
  template:
    src: gitolite.rc.j2
    dest: "{{ git_dir }}/.gitolite.rc"
    mode: 0644
    owner: "{{ git_user }}"
    group: "{{ git_group }}"
    backup: yes

- name: Set permissions on {{ git_dir }}
  file:
    path: "{{ git_dir }}"
    recurse: yes
    mode: "g+rX"
    owner: "{{ git_user }}"
    group: "{{ git_group }}"