Fix private key replacement

This commit is contained in:
Mangiang 2021-11-02 11:31:38 -04:00
parent 35a4f53125
commit fdf1d2e3ed
No known key found for this signature in database
GPG Key ID: DAE9B92A692CD55C
2 changed files with 21 additions and 21 deletions

View File

@ -4,7 +4,7 @@ all:
hosts:
sp-tarkov:
ansible_host: {{ DEPLOY_HOSTNAME }}
ansible_user: {{ DEPLOYMENT_USER }}
ansible_user: {{ DEPLOY_USER }}
ansible_connection: ssh
ansible_ssh_private_key_file: /drone/src/private.key
ansible_ssh_pass: {{ DEPLOYMENT_SSH_KEY_PASSPHRASE }}
ansible_ssh_pass: {{ DEPLOY_SSH_KEY_PASSPHRASE }}

View File

@ -21,31 +21,31 @@ steps:
from_secret: deploy_hostname
SPT_ITEMS_HOSTNAME:
from_secret: spt_items_hostname
DEPLOYMENT_USER:
DEPLOY_USER:
from_secret: deploy_username
DEPLOYMENT_SSH_KEY_PASSPHRASE:
DEPLOY_SSH_KEY_PASSPHRASE:
from_secret: deploy_ssh_key_passphrase
PRIVATE_KEY:
DEPLOY_PRIVATE_KEY:
from_secret: deploy_ssh_key
commands:
- sed -i 's/{{ SPT_ITEMS_HOSTNAME }}/'"$SPT_ITEMS_HOSTNAME"'/g' ./items/frontend/.env.example
- mv ./items/frontend/.env.example ./items/frontend/.env
- echo "{{ PRIVATE_KEY }}" > private.key && chmod 700 private.key
- echo "$DEPLOY_PRIVATE_KEY" > private.key && chmod 600 private.key
- sed -i 's/{{ DEPLOY_HOSTNAME }}/'"$DEPLOY_HOSTNAME"'/g' ./.ansible-items/inventory
- sed -i 's/{{ DEPLOYMENT_SSH_KEY_PASSPHRASE }}/'"$DEPLOYMENT_SSH_KEY_PASSPHRASE"'/g' ./.ansible-items/inventory
- sed -i 's/{{ DEPLOYMENT_USER }}/'"$DEPLOYMENT_USER"'/g' ./.ansible-items/inventory
- sed -i 's/{{ DEPLOY_SSH_KEY_PASSPHRASE }}/'"$DEPLOY_SSH_KEY_PASSPHRASE"'/g' ./.ansible-items/inventory
- sed -i 's/{{ DEPLOY_USER }}/'"$DEPLOY_USER"'/g' ./.ansible-items/inventory
- name: build frontend
image: node:lts-alpine3.14
commands:
- node -v
- npm -v
- yarn --version
- yarn --cwd ./items/frontend install
- yarn --cwd ./items/frontend build --pure-lockfile
- rm -rf ./items/api/public/static/*
- mv ./items/frontend/build/* ./items/api/public
- rm ./items/api/public/index.html
# - name: build frontend
# image: node:lts-alpine3.14
# commands:
# - node -v
# - npm -v
# - yarn --version
# - yarn --cwd ./items/frontend install
# - yarn --cwd ./items/frontend build --pure-lockfile
# - rm -rf ./items/api/public/static/*
# - mv ./items/frontend/build/* ./items/api/public
# - rm ./items/api/public/index.html
- name: check ansible syntax
image: plugins/ansible:3
@ -69,9 +69,9 @@ steps:
from_secret: deploy_hostname
SPT_ITEMS_HOSTNAME:
from_secret: spt_items_hostname
DEPLOYMENT_USER:
DEPLOY_USER:
from_secret: deploy_username
DEPLOYMENT_USER_GROUP:
DEPLOY_USER_GROUP:
from_secret: deploy_user_group
SPT_ITEMS_PATH:
from_secret: deploy_path