summaryrefslogtreecommitdiff
path: root/ansible/mirror-git.yml
blob: e1e9cb72f43a373b88286dee380ed1d34ec9563b (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
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
- hosts: mirror-git
  remote_user: debian
  become: yes
  roles:
    - role: sane_debian_system
    - role: unix_users
    - role: self-updating-system
    - role: mail-client
  tasks:
    - name: "configure ssh client"
      copy:
        src: mirror_ssh_config
        dest: /home/liw/.ssh/config
        owner: liw
        group: liw
        mode: 0644

    - name: "install git and more"
      apt:
        state: present
        name:
          - git
          - moreutils
          - psmisc

    - name: "configure git"
      copy:
        src: mirror_git_config
        dest: /home/liw/.gitconfig
        owner: liw
        group: liw

    - name: "install list of repositories to mirror"
      copy:
        src: mirror-list
        dest: /etc/mirror-git.list

    - name: "install script to mirror gitlab to git.liw.fi"
      copy:
        src: mirror-git.sh
        dest: /usr/local/bin/gitlab-to-git.liw.fi
        mode: 0755

    - name: "set up cron job to mirror git"
      cron:
        name: "mirror git"
        user: liw
        hour: "*"
        minute: "0"
        job: |
          chronic /usr/local/bin/gitlab-to-git.liw.fi
  vars:
    ansible_python_interpreter: /usr/bin/python3

    sane_debian_system_version: 2
    sane_debian_system_hostname: mirror-git
    sane_debian_system_codename: bullseye

    unix_users_version: 2
    unix_users:
      - username: root
        authorized_keys: |
          {{ liw_personal_ssh_pub }}
      - username: debian
        authorized_keys: |
          {{ liw_personal_ssh_pub }}
      - username: liw
        comment: Lars Wirzenius
        sudo: true
        authorized_keys: |
          {{ liw_personal_ssh_pub }}
        ssh_key: |
          {{ lookup('pipe', 'pass show ssh/liw@mirror-git') }}
        ssh_key_pub: |
          {{ lookup('pipe', 'pass show ssh/liw@mirror-git.pub') }}

    mailname: mirror-git.vm.liw.fi

    hostname: "{{ sane_debian_system_hostname }}"
    relayhost: pieni.net:587
    smarthost: pieni.net
    smarthost_user: pienirelay
    smarthost_password: "{{ lookup('pipe', 'pass show pieni.net/pienirelay') }}"