-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (97 loc) · 3.94 KB
/
Copy pathdeploy-manual.yaml
File metadata and controls
106 lines (97 loc) · 3.94 KB
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
name: Manual Deploy
on:
workflow_dispatch:
inputs:
environment:
description: Choose environment
options:
- staging
- production
default: staging
type: choice
required: true
targets:
description: Choose target type
options:
- all
- single_host
default: all
type: choice
required: true
host:
description: Host (optional)
type: string
host_ip:
description: Host IP (optional)
type: string
branch:
description: Choose branch (optional)
type: string
default: master
jobs:
deploy:
runs-on: runonflux
steps:
- name: Cancel if values not set
if: "${{ (github.event.inputs.targets == 'single_host') && ! github.event.inputs.host }}"
run: exit 1
- name: Checkout repository
uses: actions/checkout@v5
with:
ref: ${{ github.event.inputs.branch }}
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.13"
- name: Install Ansible
run: pip install ansible
# dev hosts should have dns entries
- name: Add temp dev host to /etc/hosts
run: >
sudo bash -c "echo \"${{ github.event.inputs.host_ip }}
${{ github.event.inputs.host }}.runonflux.io\" >>
/etc/hosts"
if: github.event.inputs.host && github.event.inputs.host_ip
- name: Set up SSH key
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
run: echo "$SSH_PRIVATE_KEY" > privatekey && chmod 0400 privatekey
- name: Run Deployment on all hosts
if: ${{ github.event.inputs.targets == 'all' }}
env:
MAXMIND_ACCOUNT_ID: ${{ secrets.MAXMIND_ACCOUNT_ID }}
MAXMIND_LICENSE_KEY: ${{ secrets.MAXMIND_LICENSE_KEY }}
TSIG_STAGING_ZONE_TRANSFER_KEY: ${{ secrets.TSIG_STAGING_ZONE_TRANSFER_KEY }}
TSIG_PRODUCTION_ZONE_TRANSFER_KEY: ${{ secrets.TSIG_PRODUCTION_ZONE_TRANSFER_KEY }}
PDNS_API_STAGING_KEY: ${{ secrets.PDNS_API_STAGING_KEY }}
PDNS_API_PRODUCTION_KEY: ${{ secrets.PDNS_API_PRODUCTION_KEY }}
run: |
ansible-playbook -i hosts.yaml \
-e "DEPLOY_ENV=${{ github.event.inputs.environment }}" \
-e "maxmind_account_id=$MAXMIND_ACCOUNT_ID" \
-e "maxmind_license_key=$MAXMIND_LICENSE_KEY" \
-e "tsig_staging_zone_transfer_key=$TSIG_STAGING_ZONE_TRANSFER_KEY" \
-e "tsig_production_zone_transfer_key=$TSIG_PRODUCTION_ZONE_TRANSFER_KEY" \
-e "pdns_api_staging_key=$PDNS_API_STAGING_KEY" \
-e "pdns_api_production_key=$PDNS_API_PRODUCTION_KEY" \
powerdns_setup.yaml
- name: Run Deployment on single host
if: ${{ github.event.inputs.targets == 'single_host' }}
env:
MAXMIND_ACCOUNT_ID: ${{ secrets.MAXMIND_ACCOUNT_ID }}
MAXMIND_LICENSE_KEY: ${{ secrets.MAXMIND_LICENSE_KEY }}
TSIG_STAGING_ZONE_TRANSFER_KEY: ${{ secrets.TSIG_STAGING_ZONE_TRANSFER_KEY }}
TSIG_PRODUCTION_ZONE_TRANSFER_KEY: ${{ secrets.TSIG_PRODUCTION_ZONE_TRANSFER_KEY }}
PDNS_API_STAGING_KEY: ${{ secrets.PDNS_API_STAGING_KEY }}
PDNS_API_PRODUCTION_KEY: ${{ secrets.PDNS_API_PRODUCTION_KEY }}
run: |
ansible-playbook -i hosts.yaml \
--limit ${{ github.event.inputs.host }} \
-e "DEPLOY_ENV=${{ github.event.inputs.environment }}" \
-e "maxmind_account_id=$MAXMIND_ACCOUNT_ID" \
-e "maxmind_license_key=$MAXMIND_LICENSE_KEY" \
-e "tsig_staging_zone_transfer_key=$TSIG_STAGING_ZONE_TRANSFER_KEY" \
-e "tsig_production_zone_transfer_key=$TSIG_PRODUCTION_ZONE_TRANSFER_KEY" \
-e "pdns_api_staging_key=$PDNS_API_STAGING_KEY" \
-e "pdns_api_production_key=$PDNS_API_PRODUCTION_KEY" \
powerdns_setup.yaml