-
Notifications
You must be signed in to change notification settings - Fork 2
68 lines (58 loc) · 1.84 KB
/
deploy.yaml
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
name: Deploy
concurrency:
group: production
on:
workflow_dispatch:
jobs:
deployment:
runs-on: ubuntu-latest
environment:
name: production
url: https://pix.cloud.ut.ee/
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- name: Set up Ansible
run: |
sudo apt-get update
sudo apt-get install --only-upgrade openssl
sudo apt-get install -y python3-pip
pip3 install -U pip ansible pyyaml
ansible --version
docker --version
- name: Set known hosts
id: known_hosts
run: |
ssh-keyscan -t ed25519 193.40.11.243 > $GITHUB_OUTPUT
ssh-keyscan -t ed25519 193.40.11.123 >> $GITHUB_OUTPUT
ssh-keyscan -t ed25519 193.40.11.119 >> $GITHUB_OUTPUT
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
env:
KNOWN_HOSTS: ${{ join(steps.known_hosts.outputs.*, '\n') }}
with:
key: "${{ secrets.PIX_SSH_KEY }}"
name: "pix"
known_hosts: ${{ env.KNOWN_HOSTS }}
config: |
Host pix.cloud.ut.ee
HostName 193.40.11.243
User ubuntu
IdentityFile ~/.ssh/pix
Host pix-w1.cloud.ut.ee
HostName 193.40.11.123
User ubuntu
IdentityFile ~/.ssh/pix
Host pix-w2.cloud.ut.ee
HostName 193.40.11.119
User ubuntu
IdentityFile ~/.ssh/pix
- name: Unpack secrets to "./secrets/"
run: |
echo "${{ secrets.SECRETS_TAR_GZ_B64 }}" | base64 -d | tar xz
- name: Deploy with Ansible
run: |
ansible-playbook -i ansible/hosts.yaml --private-key ~/.ssh/pix ansible/deploy.yaml