Skip to content

Commit abb9ae9

Browse files
committed
task: (try to) pause UptimeRobot during deployment
Part of #1154
1 parent 2f309c4 commit abb9ae9

File tree

4 files changed

+28
-11
lines changed

4 files changed

+28
-11
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ infra/docker/mysql_backup_mystamps.sql.gz
4141

4242
# created by src/main/scripts/ci/deploy.sh
4343
vault-pass.txt
44+
prod_vars.yml
4445

4546
# maven-wrapper
4647
.mvn/wrapper/maven-wrapper.jar

src/main/scripts/ci/ansible/deploy.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
- hosts: all
44
gather_facts: no
55
remote_user: mystamps
6+
vars_files:
7+
- prod_vars.yml
68
vars:
79
local_war_dir: "{{ playbook_dir }}/../../../../../target"
810
remote_war_dir: /data/mystamps
9-
uptimerobot:
10-
monitorid: 'MyStamps'
11-
apikey: "{{ lookup('env', 'UPTIMEROBOT_APIKEY') }}"
1211
tasks:
1312

1413
- name: Getting info about WAR file
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
$ANSIBLE_VAULT;1.1;AES256
2+
37633135383264346165663932623034666631326537333763313133613037636239656538626166
3+
3732393862613738613264323061663336303036363033370a366133636534326133316362623962
4+
33323763643562343338616336663537663134646661326364313232643961366461353365353231
5+
3237623430313338640a666432323135643761643933613862356265346264313436333266626135
6+
63643432336631306333643465393565643933613333303261303034343839343234366663626263
7+
64323834626533393366623037623132646563623737616535303832313836666136363362323236
8+
65316538646331653366313762313835346462366164366336313066343131643763313639616639
9+
63363164393233613437373261383030326363656263313934663839623838343437316336623730
10+
33353035373939373231303066373537366432643335336230373361656533633634646166356639
11+
34613361346436663238383964383466333366646566393431656236356537366363336564646564
12+
63316232643163363834623835346361343761393836306364313239336137393133396166646438
13+
62613262623266626364613234353538636639666239343634616362626666383433356432376238
14+
6432

src/main/scripts/ci/deploy.sh

+11-8
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ CURRENT_DIR="$(dirname "${0:-.}")"
1414
INVENTORY="$CURRENT_DIR/ansible/mystamps.inventory"
1515
PLAYBOOK="$CURRENT_DIR/ansible/deploy.yml"
1616
PRIVATE_KEY="$CURRENT_DIR/ansible/mystamps_rsa"
17+
VARS_FILE="$CURRENT_DIR/ansible/prod_vars.yml"
1718
PASS_FILE="$CURRENT_DIR/vault-pass.txt"
1819

1920
cleanup() {
20-
rm -f "$PRIVATE_KEY" "$PASS_FILE"
21+
rm -f "$PRIVATE_KEY" "$PASS_FILE" "$VARS_FILE"
2122
exit
2223
}
2324
trap 'cleanup' EXIT SIGHUP SIGINT SIGTERM
@@ -35,15 +36,17 @@ if [ -z "${VAULT_PASSWORD:-}" ]; then
3536
exit 1
3637
fi
3738

38-
# Decrypt private key
3939
echo -n "$VAULT_PASSWORD" >"$PASS_FILE"
4040

41-
ansible-vault decrypt \
42-
--vault-password-file "$PASS_FILE" \
43-
--output "$PRIVATE_KEY" \
44-
"${PRIVATE_KEY}.enc"
45-
46-
chmod 600 "$PRIVATE_KEY"
41+
for FILE in "$PRIVATE_KEY" "$VARS_FILE"; do
42+
FILENAME="$(basename "$FILE")"
43+
echo "Decrypting ${FILENAME}.enc to $FILENAME"
44+
ansible-vault decrypt \
45+
--vault-password-file "$PASS_FILE" \
46+
--output "$FILE" \
47+
"${FILE}.enc"
48+
chmod 600 "$FILE"
49+
done
4750

4851
ansible-playbook \
4952
--inventory="$INVENTORY" \

0 commit comments

Comments
 (0)