summaryrefslogtreecommitdiff
path: root/roles/repo_service/tasks/as_repo_service.yaml
blob: b9a99ab6ea061a48ac159f51c6dea9e276b5470c (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
43
44
45
---
- name: Clone repo_service git
  git:
    repo=https://github.com/cfra/repo_service.git
    dest=/var/lib/repo_service/src
  notify:
  - Restart repo_service

- name: Create .ssh dir
  file:
    path="/var/lib/repo_service/.ssh"
    state=directory
    mode=0700

- name: Add repo_service ssh privkey
  copy:
    dest="/var/lib/repo_service/.ssh/id_rsa"
    content="{{repo_service_privkey}}"
    mode=0600

- name: Add repo_service ssh pubkey
  copy:
    dest="/var/lib/repo_service/.ssh/id_rsa.pub"
    content="{{repo_service_pubkey}}"
    mode=0644

- name: Read Gitserver Hostkey
  slurp: src=/etc/ssh/ssh_host_ecdsa_key.pub
  register: gitserver_host_key

- name: Put Gitserver Hostkey into knownhosts
  lineinfile: dest=/var/lib/repo_service/.ssh/known_hosts
              create=yes
              owner=repo_service
              group=repo_service
              mode=0644
              line="127.0.0.1 {{gitserver_host_key.content|b64decode}}"

# Configure git
- name: Configure git push for repo service
  command: git config --global push.default simple
- name: Configure git name
  command: git config --global user.name "Repo Service {{ansible_hostname}}"
- name:
  command: git config --global user.email "nobody@nowhere.ws"