summaryrefslogtreecommitdiffstats
path: root/roles/git_repositories/tasks/main.yml
blob: 21f75133c9ccf223c664ee34805ff3e3bb176c3b (plain)
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
---
- yum: name={{ item }} state=installed
  with_items:
  - git

- command: semanage fcontext -t git_user_content_t -a '{{ git_repositories_dir }}(/.*)?'

- file: path={{ git_repositories_dir }} state=directory

- group:
    name: "{{ item.group | default(git_default_group) }}"
    state: present
  with_items: git_repositories

- file:
    path: "{{ git_repositories_dir }}/{{ item.name }}"
    state: directory
    mode: "{% if item.private is defined and item.private %}2770{% else %}2775{% endif %}"
    group: "{{ item.group | default(git_default_group) }}"
  with_items: git_repositories

- shell: creates={{ git_repositories_dir }}/{{ item.name }}/config chdir={{ git_repositories_dir }}/{{ item.name }} git init --bare -q --shared=group
  with_items: git_repositories

# refactor this one and the next if https://github.com/ansible/ansible-modules-core/pull/520 is merged
- file:
    path: "{{ git_repositories_dir }}/{{ item.name }}/git-daemon-export-ok"
    state: absent
  when: item.private is defined and item.private
  with_items: git_repositories

- copy:
    dest: "{{ git_repositories_dir }}/{{ item.name }}/git-daemon-export-ok"
    content: ""
  when: item.private is not defined or not item.private
  with_items: git_repositories

- copy:
    dest: "{{ git_repositories_dir }}/{{ item.name }}/description"
    content: "{{ item.desc }}"
  with_items: git_repositories