File tree 3 files changed +14
-4
lines changed
3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,9 @@ infra/terraform/terraform.tfstate.backup
39
39
infra /docker /application-prod.properties
40
40
infra /docker /mysql_backup_mystamps.sql.gz
41
41
42
+ # created by src/main/scripts/ci/deploy.sh
43
+ vault-pass.txt
44
+
42
45
# maven-wrapper
43
46
.mvn /wrapper /maven-wrapper.jar
44
47
Original file line number Diff line number Diff line change @@ -14,9 +14,10 @@ CURRENT_DIR="$(dirname "${0:-.}")"
14
14
INVENTORY=" $CURRENT_DIR /ansible/mystamps.inventory"
15
15
PLAYBOOK=" $CURRENT_DIR /ansible/deploy.yml"
16
16
PRIVATE_KEY=" $CURRENT_DIR /ansible/mystamps_rsa"
17
+ PASS_FILE=" $CURRENT_DIR /vault-pass.txt"
17
18
18
19
cleanup () {
19
- rm -f " $PRIVATE_KEY "
20
+ rm -f " $PRIVATE_KEY " " $PASS_FILE "
20
21
exit
21
22
}
22
23
trap ' cleanup' EXIT SIGHUP SIGINT SIGTERM
@@ -29,13 +30,19 @@ export ANSIBLE_HOST_KEY_CHECKING=False
29
30
# See: https://docs.ansible.com/ansible/2.9/reference_appendices/config.html#envvar-ANSIBLE_STDOUT_CALLBACK
30
31
export ANSIBLE_STDOUT_CALLBACK=debug
31
32
32
- if [ -z " ${encrypted_bf07cb25089f_key :- } " ] || [ -z " ${encrypted_bf07cb25089f_iv :- } " ] ; then
33
- echo >&2 ' ERROR: encrypted_bf07cb25089f_key or encrypted_bf07cb25089f_iv were not defined! '
33
+ if [ -z " $VAULT_PASSWORD " ]; then
34
+ echo >&2 " ERROR: env variable VAULT_PASSWORD is empty! "
34
35
exit 1
35
36
fi
36
37
37
38
# Decrypt private key
38
- openssl aes-256-cbc -K " $encrypted_bf07cb25089f_key " -iv " $encrypted_bf07cb25089f_iv " -in " $PRIVATE_KEY .enc" -out " $PRIVATE_KEY " -d
39
+ echo -n " $VAULT_PASSWORD " > " $PASS_FILE "
40
+
41
+ ansible-vault decrypt \
42
+ --vault-password-file " $PASS_FILE " \
43
+ --output " $PRIVATE_KEY " \
44
+ " ${PRIVATE_KEY} .enc"
45
+
39
46
chmod 600 " $PRIVATE_KEY "
40
47
41
48
ansible-playbook \
You can’t perform that action at this time.
0 commit comments