Skip to content

Commit 3dbfd9e

Browse files
committed
task: commit a private key for server provisioning
Part of #1631 [skip ci]
1 parent 8ced7c2 commit 3dbfd9e

File tree

5 files changed

+98
-4
lines changed

5 files changed

+98
-4
lines changed

.github/workflows/provision-by-ansible.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
run: |
4545
printf '%s' "$VAULT_PASSWORD" >vault-pass.txt
4646
47-
for FILENAME in provisioning/vars/prod.yml; do
47+
for FILENAME in provisioning/vars/prod.yml provisioning/coder_rsa; do
4848
echo "Decrypting ${FILENAME}.enc to $FILENAME"
4949
ansible-vault decrypt \
5050
--vault-password-file vault-pass.txt \
@@ -66,12 +66,14 @@ jobs:
6666
# Disable host key checking to suppress interactive prompt.
6767
# See: https://docs.ansible.com/ansible/2.10/user_guide/connection_details.html#managing-host-key-checking
6868
ANSIBLE_HOST_KEY_CHECKING: 'False'
69+
# See: https://docs.ansible.com/ansible/2.10/reference_appendices/config.html#envvar-ANSIBLE_PRIVATE_KEY_FILE
70+
ANSIBLE_PRIVATE_KEY_FILE: 'provisioning/coder_rsa'
6971
run: ansible-playbook provisioning/prod.yml -i provisioning/prod.inventory
7072

7173
- name: Cleanup
7274
if: always()
7375
working-directory: infra/vagrant
7476
run: |
75-
for FILE in vault-pass.txt provisioning/vars/prod.yml; do
77+
for FILE in vault-pass.txt provisioning/vars/prod.yml provisioning/coder_rsa; do
7678
[ ! -f "$FILE" ] || rm -fv "$FILE"
7779
done

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ infra/docker/mysql_backup_mystamps.sql.gz
4444
# .github/workflows/provision-by-terraform.yml
4545
vault-pass.txt
4646

47+
# created by .github/workflows/provision-by-ansible.yml
48+
coder_rsa
49+
4750
# created by src/main/scripts/ci/deploy.sh
4851
mystamps_rsa
4952
prod_vars.yml
+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
$ANSIBLE_VAULT;1.1;AES256
2+
37353262383730363737326662386135303332343861366338663434306237313233643965326630
3+
3338633834633638376562333632313165643832396162660a373932666338363763636265636530
4+
38616433633330333533396331366661396430633133396433303437656566376436306530396136
5+
3861386163323565360a353636613036343430643166356361353037306264303761343766383035
6+
30373834393361666630656136343735363465386366623138346639626164663934353064616133
7+
37633331383038393865623639303431393431653737336334643339303036346236323031633562
8+
66326638393564663036343864393130633939313236323837613864303365333165626166383663
9+
32663530323365643038303566626165336138613330623766633837343436353334333335303636
10+
39333065663831626161663930383430343364376137333862656437306264383732343830363862
11+
64623863643064646538643966326436643137313933636138383134326661383036663139613562
12+
34313536333166376562656132653538303561623734313334383139336637626436633666653030
13+
66633166656137663566313861623530333565343731656161396539623235656437656365643965
14+
65333236333164316366643234633331306132623564396163336232663163656162303836303434
15+
66383363633533383933643664613932396661343734386439343861383364656532633965383962
16+
63626537613934333635386538653462626531336230613062323362306638663839636639313534
17+
62306565343237653535393333313663313536316163666131316665383532393335353930643066
18+
35663862376138636633303566633263396636373031613539373831616563336133386237326163
19+
37353134633266666233373430383638346532663134393434343138666466633135333166363964
20+
31613065313037353337636439636664376438653732383838633463343662313137636238316234
21+
37356136616265616364306530633433643863323535346165393738666366336664326134653164
22+
30313962363465623631316534303530333534623663326130393764653966306431633166366430
23+
62363663623663353732666365626562643632376336363266376632386639653231343237373032
24+
35643733313161356535616539623061663165373437653564633636306336313131303533646433
25+
63336264373162316139386263343635636636303732366433623738383039653437326563346232
26+
30656432386164323239663465633732326535636533646661663934303266316331356662386361
27+
35613335626436346263376162323936396465633333373164343532623137643665303563663536
28+
64396633663831653264323336666165326134386363313632346335623732646136303662356337
29+
39653031356633376337356436333762333636373961666564653138303865323437373933623261
30+
32383762663665383132326333343430343433663334626334313462373162366261646530646166
31+
62343864643539343335353836396630383937623538646338663466353933613035656135316138
32+
63633264653333313165663264613535623231616164646636653166613132343636363032316638
33+
61643962373563376562366263366231356466613931623639656135323635386563383532343066
34+
36646133653733353737633836316162376132386539393366383763656162333737363763393630
35+
34336563353564313062373132313138653330303238633164623561376238653032613566343731
36+
34363164626230316438653363393936373136366261336236303033643437366139396365393230
37+
38366539616233363062393233363230363739643838393739666533623433643565376231623536
38+
32346361386334636361613936663362383534646338656338393330356262323934333334316135
39+
62636666373564346238346364363931393561396465623232336534383431633430323466396334
40+
32346663623030653266316566373635373332663238616666643865616232616661396133306461
41+
62336538303236323461363439313638376264636136613936333538616662303833326466356435
42+
61616466383839303938616533303431303839613934373236333765633664666364323231616265
43+
38383730386166616430613930356431306465383135656633353931323737393861396661623661
44+
34313338363931376136303865326665326439376665613538303036663262656539623666383838
45+
35653666313861386439346235383466636639383737366164353535653565626133656439343361
46+
65656166363336626438626233653366623966356230636364633531623735353364306539626533
47+
35623436396434373565393434633061323739353562313064623238666632613264646436663565
48+
39346163363661346266393638323865383032646135653639333931656634343137353063373563
49+
66326461616464643935383636383135343361376465646230623064306163613763633237353065
50+
31386330623338336239356132303766383064633139613663353232623265623436373538376635
51+
32653833643138366161623263316163343139346438393166623934313163656661623137653363
52+
32356364663032373237313464333734356133306536376135653235663835653934363836386333
53+
32303863373137646531373065366138613739366261613336343539633662363964613864356136
54+
39313266313735623866313031336664633063613732343634623263393634633366393434383938
55+
62366632626561613865396564326363346263616662633862626365356632363237336162363737
56+
64376639636239396565643138633632343562373437653661373730633261663331633965623665
57+
34656664666661313931373562383132363431633034303831663166366632333062393535366534
58+
62313537376133363435346538393365656365656162346530633837653938333563303561653462
59+
37323661613535336134663139393033306661636363613537613533663032326238383231383739
60+
65663063663465333036316437616639303262386330353164663938633961626638323432623164
61+
36373338646530363438346438393536383335646433636238353561656139343032383765323931
62+
66373932666166386265396365346464353832326462316333333432323761343731373162623961
63+
32626138316164666639323561643430306333363561333965616461663164373730663263643834
64+
32333436396238323734343364613966376336616362666266653230373034636534636634636538
65+
31346539623435363163633563626136363833346132636532356636343663373562313439313765
66+
65623665373336393862643032643163366331313466663565376433613338393964633036613063
67+
66333334643231313737666166646262366133303938666331616435376662396334336561613538
68+
36616463626634626662343538376238393761363464636233656463616566396434623832336462
69+
65386436366165343231383830326330366435643065303730313762353736353561666230613337
70+
64633231623731336533373366623863643430653637333766373365316266336461666430336137
71+
34393963313839373936633633373730643330333031656565363530383762616233373937343230
72+
31356334313866623234306632656439333062323934626238393237626662356363626465376436
73+
30356133653634326638303965633735663236626132353037653131616339613230336434626666
74+
33363836643036383730303864303663356632306332646635646263313564363230313566643163
75+
63633439633032626563353536616139613534343335656666393364336330363064646366636537
76+
64653164653534393530363637663134343564356430386238336365613837346439656665623164
77+
35303136326164343766623939343862653865646532306563646631396639396631303062323436
78+
38383665316265643233366563663339346332333462393039613134646138313134326532666632
79+
37636136363534376632633230616365323966653937663436353531353138636439323133633632
80+
33626439313434613237626231633237393266323666666334333062653236636339663461336631
81+
38346162616235623833306166373733623564316235616331316166383962333337326666653962
82+
36616536633966393537343261303932383062636661333962346430353432663438623039303961
83+
64383837303237343337623962326261313162376534323661666333393133376439393566303938
84+
66623231333338666638383836386165643636306165386466653437363661386463336462643736
85+
37303331393162623833343533623839636565363064393931366362396164353738636662386337
86+
32303735653865316663316539343463653632386339653961326233366664303764386236643864
87+
63306462613232656336623161646136333536396632363264633539303538636635663865636165
88+
31316537613036306465623938623634316365636535613630363162653665366237613262313039
89+
37386462663336323265

infra/vagrant/provisioning/prod.inventory

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
my-stamps.ru ansible_host=46.101.232.167
66

77
[all:vars]
8-
ansible_ssh_private_key_file=/Users/coder/.ssh/mystamps_rsa
9-
108
# https://docs.ansible.com/ansible/2.10/reference_appendices/python_3_support.html#using-python-3-on-the-managed-machines-with-commands-and-playbooks
119
# https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html
1210
ansible_python_interpreter=/usr/bin/python3

src/main/scripts/ci/deploy.sh

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ fi
3838

3939
printf '%s' "$VAULT_PASSWORD" >"$PASS_FILE"
4040

41+
# LATER: consider specifying private key via env variable
42+
# https://docs.ansible.com/ansible/2.10/reference_appendices/config.html#envvar-ANSIBLE_PRIVATE_KEY_FILE
4143
for FILE in "$PRIVATE_KEY" "$VARS_FILE"; do
4244
FILENAME="$(basename "$FILE")"
4345
echo "Decrypting ${FILENAME}.enc to $FILENAME"

0 commit comments

Comments
 (0)