summaryrefslogtreecommitdiff
path: root/ansible/radicle-other-node.yml
blob: 658fbc08eb7dd79bc64d96f0c85079a564e8623c (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
- hosts: radicle-other-node
  remote_user: debian
  become: yes
  roles:
    - role: sane_debian_system
    - role: sshd
    - role: unix_users
    - role: rust-rustup
    - role: liw
  tasks:
    - apt:
        name:
          - curl
          - git
          - jq
          - man-db
          - psmisc
          - rsync
          - screen
          - sqlite3
          - vim
          - w3m

    - name: "install radicle using installer"
      shell: |
        filename="/home/liw/.radicle/bin/rad"

        install=false
        if [ ! -e "$filename" ]; then
                install=true
        else
                weekago="$(date -d 'week ago' +%s)"
                mtime="$(stat -c %Y "$filename")"
                if [ "$mtime" -lt "$weekago" ]; then
                        install=true
                fi
        fi

        if $install; then
            curl -sSf https://radicle.xyz/install | sudo -u liw bash
        fi

    - name: "create liw/.radicle/keys"
      file:
        state: directory
        path: /home/liw/.radicle/keys
        owner: liw
        group: liw
        mode: 0755

    - name: "install radicle private key"
      copy:
        content: "{{ radicle_key }}"
        dest: /home/liw/.radicle/keys/radicle
        owner: liw
        group: liw
        mode: 0600

    - name: "install radicle public key"
      copy:
        content: "{{ radicle_pub }}"
        dest: /home/liw/.radicle/keys/radicle.pub
        owner: liw
        group: liw
        mode: 0644

    - name: "configure rad"
      copy:
        content: |
          {
              "publicExplorer": "https://app.radicle.xyz/nodes/$host/$rid$path",
              "preferredSeeds": [
              ],
              "web": {
                  "pinned": {
                      "repositories": []
                  }
              },
              "cli": {
                  "hints": true
              },
              "node": {
                  "alias": "liw-other-node",
                  "listen": [],
                  "peers": {
                      "type": "dynamic",
                      "target": 8
                  },
                  "connect": [
                      "z6MkfXa53s1ZSFy8rktvyXt5ADCojnxvjAoQpzajaXyLqG5n@radicle.liw.fi:8776"
                  ],
                  "externalAddresses": [],
                  "network": "main",
                  "relay": true,
                  "limits": {
                      "routingMaxSize": 1000,
                      "routingMaxAge": 604800,
                      "gossipMaxAge": 1209600,
                      "fetchConcurrency": 1,
                      "maxOpenFiles": 4096,
                      "rate": {
                          "inbound": {
                              "fillRate": 0.2,
                              "capacity": 32
                          },
                          "outbound": {
                              "fillRate": 1.0,
                              "capacity": 64
                          }
                      }
                  },
                  "policy": "block",
                  "scope": "followed"
              }
          }
        dest: /home/liw/.radicle/config.json
        owner: liw
        group: liw
        mode: 0644

    - name: "create /srv/http"
      file:
        state: directory
        path: /srv/http
        owner: liw
        group: liw
        mode: 0o755

  vars:
    sane_debian_system_version: 2
    sane_debian_system_hostname: "{{ inventory_hostname }}"
    sane_debian_system_codename: bookworm
    sane_debian_system_timezone: Europe/Helsinki
    sane_debian_system_sources_lists:
      - repo: |
          deb http://security.debian.org/debian-security bookworm-security main

      - repo: deb http://apt.liw.fi/debian unstable main
        signing_key: "{{ apt_liw_fi_signing_key }}"

    unix_users_version: 2
    unix_users:
      - username: liw

    sshd_version: 1

    radicle_key: "{{ lookup('pipe', 'pass radicle/radicle-other-node/key') }}"
    radicle_pub: "{{ lookup('pipe', 'pass radicle/radicle-other-node/key.pub') }}"