aboutsummaryrefslogtreecommitdiffstats
path: root/roles/setup_git/tasks/main.yml
blob: 2383a7c0c4a0e66257d0051fcd761b5ffb7f92a4 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88

# =========================================================================== #
#                   __                _ __ 
#       _________  / /__       ____ _(_) /_
#      / ___/ __ \/ / _ \     / __ `/ / __/
#     / /  / /_/ / /  __/    / /_/ / / /_  
#    /_/   \____/_/\___(_)   \__, /_/\__/  
#                           /____/
#
# =========================================================================== #

---
- name: Check installation of git
  package:
    name: git
    state: present

- name: Check installation of lighttpd
  package:
    name: lighttpd
    state: present

- name: Check installation of libcgi
  package:
    name: libcgi-pm-perl
    state: present

- name: Check installation of gamin
  package:
    name: gamin
    state: present

- name: Add group git
  user:
    name: "{{ git_group }}"
    state: present

- name: Add user git
  user:
    name: "{{ git_user }}"
    comment: "{{ git_user_comment }}"
    group: "{{ git_group }}"

- name: Set up multiple authorized keys
  authorized_key:
    user: "{{ git_user }}"
    state: present
    key: "{{ item }}"
  with_file:
    - "{{ playbook_dir }}/files/public_keys/WS-bentonite"
    - "{{ playbook_dir }}/files/public_keys/LP-graphite"

- name: Create git directory
  file:
    path: "{{ git_directory_path }}"
    state: directory
    owner: "{{ git_user }}"
    group: "{{ git_group }}"
    mode: 0755
    recurse: True

- name: Create default gitweb directory
  file:
    path: "{{ git_directory_path }}/{{ git_gitweb_default_repository }}"
    state: directory
    owner: "{{ git_user }}"
    group: "{{ git_group }}"
    mode: 0755

- name: Init gitweb repository
  command: git init "{{ git_directory_path }}/{{ git_gitweb_default_repository }}"
  become_user: "{{ git_user }}"

- name: Copy gitweb systemd unit
  template:
    src: "{{ git_gitweb_unit }}.service"
    dest: "{{ g_systemd_unit_directory }}"
    owner: root
    group: root
    mode: 0644

- name: Start gitweb systemd unit
  systemd:
    name: "{{ git_gitweb_unit }}"
    state: restarted
    daemon_reload: yes
    enabled: yes

remember that computers suck.