diff options
author | Lars Wirzenius <liw@liw.fi> | 2023-12-20 14:18:13 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2023-12-20 14:18:13 +0200 |
commit | f09773771101ac4c3ab64f9693b8d9b1e7fd9399 (patch) | |
tree | b1ca7b9a77e5d8153a1830e3dd34bea1eafe72c5 /ansible/radicle-liw3.yaml | |
parent | d6e4bf3dc6da6b74ba6f93aba3d8481800046419 (diff) | |
download | ansibleness-f09773771101ac4c3ab64f9693b8d9b1e7fd9399.tar.gz |
radicle-liw3: install and start CI broker
Signed-off-by: Lars Wirzenius <liw@liw.fi>
Sponsored-by: author
Diffstat (limited to 'ansible/radicle-liw3.yaml')
-rw-r--r-- | ansible/radicle-liw3.yaml | 115 |
1 files changed, 90 insertions, 25 deletions
diff --git a/ansible/radicle-liw3.yaml b/ansible/radicle-liw3.yaml index 7dadc1c..0ad8a4e 100644 --- a/ansible/radicle-liw3.yaml +++ b/ansible/radicle-liw3.yaml @@ -45,6 +45,40 @@ group: liw mode: 0644 + - name: "install script to install Radicle CI stuff" + copy: + content: | + #!/bin/bash + set -xeuo pipefail + + clone_install() { + local url dir root + url="$1" + dir="$2" + root="$3" + + if [ ! -e "$dir" ]; then + git clone "$url" "$dir" + else + (cd "$dir" && git pull) + fi + + (cd "$dir" && cargo install --path=. --root="$root") + } + + clone_install https://radicle.liw.fi/zwTxygwuz5LDGBq255RA2CbNGrz8.git radicle-ci-broker "$(pwd)/root" + clone_install https://radicle.liw.fi/z3qg5TKmN83afz2fj9z3fQjU8vaYE.git radicle-native-ci "$(pwd)/root" + + install root/bin/* $HOME/bin + dest: /home/liw/install-radicle-ci + owner: liw + group: liw + mode: 0755 + + - name: "install Radicle CI stuff" + shell: | + sudo -i -u liw bash -c 'cd /home/liw && install -d bin && ./install-radicle-ci' + - name: "install systemd unit for Radicle node" copy: content: | @@ -74,39 +108,70 @@ enabled: yes daemon_reload: yes - - name: "install script to install Radicle CI stuff" + - name: "install Radicle CI broker config" copy: content: | - #!/bin/bash - set -xeuo pipefail + default_adapter: native + adapters: + native: + command: /home/liw/bin/radicle-native-ci + env: + RADICLE_NATIVE_CI: /home/liw/native-ci.yaml + filters: + - !And + - !Repository "rad:zZnk3hS8C3WAhnv7mWcCUToCqpBs" + - !AnyPatch + dest: /home/liw/ci-broker.yaml + owner: liw + group: liw + mode: 0644 - clone_install() { - local url dir root - url="$1" - dir="$2" - root="$3" + - name: "create state directory for Radicle native CI" + file: + state: directory + path: /home/liw/native-ci.state + owner: liw + group: liw + mode: 0755 - if [ ! -e "$dir" ]; then - git clone "$url" "$dir" - else - (cd "$dir" && git pull) - fi + - name: "install Radicle native CI config" + copy: + content: | + state: /home/liw/native-ci.state + dest: /home/liw/native-ci.yaml + owner: liw + group: liw + mode: 0644 - (cd "$dir" && cargo install --path=. --root="$root") - } + - name: "install systemd unit for Radicle CI broker" + copy: + content: | + [Unit] + After=radicle-node.service + Description=Radicle CI broker - clone_install https://radicle.liw.fi/zwTxygwuz5LDGBq255RA2CbNGrz8.git radicle-ci-broker "$(pwd)/root" - clone_install https://radicle.liw.fi/z3qg5TKmN83afz2fj9z3fQjU8vaYE.git radicle-native-ci "$(pwd)/root" + [Service] + Type=simple + Environment=RAD_HOME=/home/liw/.radicle + Environment=RUST_LOG=trace + ExecStart=bash -c '/home/liw/bin/ci-broker /home/liw/ci-broker.yaml >> /home/liw/broker.log' + KillMode=process + Restart=never + RestartSec=1 + User=liw + Group=liw - install root/bin/* $HOME/bin - dest: /home/liw/install-radicle-ci - owner: liw - group: liw - mode: 0755 + [Install] + WantedBy=default.target + dest: /lib/systemd/system/radicle-ci-broker.service - - name: "install Radicle CI stuff" - shell: | - sudo -i -u liw bash -c 'cd /home/liw && install -d bin && ./install-radicle-ci' + - name: "enable systemd unit for Radicle CI broker" + systemd: + name: radicle-ci-broker + state: restarted + masked: no + enabled: yes + daemon_reload: yes vars: ansible_python_interpreter: /usr/bin/python3 |