]> git.somenet.org - root/pub/somesible.git/blob - roles/server/git-server/tasks/main.yml
roles/base/backup/files
[root/pub/somesible.git] / roles / server / git-server / tasks / main.yml
1 #####################################
2 ### someone"s ansible provisioner ###
3 #####################################
4 # Part of: https://git.somenet.org/root/pub/somesible.git
5 # 2017-2024 by someone <someone@somenet.org>
6 #
7 ---
8 - name: install gitolite3
9   apt:
10     pkg:
11     - markdown
12     - gitolite3
13     state: present
14     policy_rc_d: 101
15   tags: "online"
16   ignore_errors: "{{ignore_online_errors | bool}}"
17
18
19 - name: create git user
20   user:
21     name: "git"
22     home: "/srv/gitolite"
23     shell: "/bin/bash"
24     system: yes
25     state: present
26
27
28 - name: create gitolite homedir
29   file:
30     path: "/srv/gitolite"
31     state: directory
32     mode: 0710
33     owner: "git"
34     group: "git"
35
36
37 - name: create gitolite .ssh dir
38   file:
39     path: "/srv/gitolite/.ssh"
40     state: directory
41     mode: 0700
42     owner: "git"
43     group: "git"
44
45
46 - name: copy gitconfig
47   copy:
48     src: "{{item}}"
49     dest: "/srv/gitolite/.gitconfig"
50     mode: 0640
51     owner: "git"
52     group: "git"
53   with_first_found:
54     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/gitconfig"
55     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/gitconfig"
56     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/gitconfig"
57     - "default/gitconfig"
58
59
60 - name: copy gitolite.rc
61   copy:
62     src: "{{item}}"
63     dest: "/srv/gitolite/.gitolite.rc"
64     mode: 0640
65     owner: "git"
66     group: "git"
67   with_first_found:
68     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/gitolite.rc"
69     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/gitolite.rc"
70     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/gitolite.rc"
71     - "default/gitolite.rc"
72
73
74 - name: setup gitolite
75   command: "gitolite setup -a gitolite"
76   become: true
77   become_user: "git"
78
79
80 - name: fix project.list permissions
81   file:
82     path: "/srv/gitolite/projects.list"
83     state: file
84     mode: 0640
85     owner: "git"
86     group: "git"
87
88
89 - name: fix repositories permissions
90   file:
91     path: "/srv/gitolite/repositories/"
92     state: directory
93     recurse: yes
94     mode: "u=rwX,g=rX,o-rwx"
95     owner: "git"
96     group: "git"
97
98
99 - name: copy compact_gitolite_repos.sh
100   copy:
101     src: "{{item}}"
102     dest: "/srv/gitolite/compact_gitolite_repos.sh"
103     mode: 0750
104     owner: "git"
105     group: "git"
106   with_first_found:
107     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/compact_gitolite_repos.sh"
108     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/compact_gitolite_repos.sh"
109     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/compact_gitolite_repos.sh"
110     - "default/compact_gitolite_repos.sh"
111
112
113 - name: copy compact_gitolite_repos.service to /etc/systemd/system/
114   copy:
115     src: "{{item}}"
116     dest: "/etc/systemd/system/compact_gitolite_repos.service"
117     mode: 0644
118     owner: "root"
119     group: "root"
120   with_first_found:
121     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/compact_gitolite_repos.service"
122     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/compact_gitolite_repos.service"
123     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/compact_gitolite_repos.service"
124     - "default/compact_gitolite_repos.service"
125
126
127 - name: copy compact_gitolite_repos.timer to /etc/systemd/system/
128   copy:
129     src: "{{item}}"
130     dest: "/etc/systemd/system/compact_gitolite_repos.timer"
131     mode: 0644
132     owner: "root"
133     group: "root"
134   with_first_found:
135     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/compact_gitolite_repos.timer"
136     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/compact_gitolite_repos.timer"
137     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/compact_gitolite_repos.timer"
138     - "default/compact_gitolite_repos.timer"
139
140
141 - name: enable and start compact_gitolite_repos.timer
142   include_role: name="base/systemd/enable-and-start"
143   vars:
144     service_name: compact_gitolite_repos.timer