Skip to content

Commit 42e3206

Browse files
committed
workflow improvement
1 parent e8070ff commit 42e3206

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

.github/workflows/deploy.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616
uses: actions/checkout@v4
1717

1818
- name: Set up SSH key
19-
run: |
20-
mkdir -p ~/.ssh
21-
echo "${{ secrets.EC2_SSH_KEY }}" > ~/.ssh/id_rsa
22-
chmod 600 ~/.ssh/id_rsa
19+
uses: kielabokkie/ssh-key-and-known-hosts-action@v1
20+
with:
21+
ssh-private-key: ${{ secrets.EC2_SSH_KEY }}
22+
ssh-host: ${{ vars.SSH_PROXY_HOST }}
2323

2424
- name: Add SSH config
2525
run: |
@@ -57,6 +57,4 @@ jobs:
5757
- name: Run Ansible Playbook
5858
run: |
5959
ansible-playbook ansible/deploy.yml \
60-
-i ansible/inventory.ini \
61-
--private-key ~/.ssh/id_rsa \
62-
-u ubuntu
60+
-i ansible/inventory.ini

ansible/inventory.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[web]
2-
ec2-instance ansible_host=172.31.20.60 ansible_user=ubuntu
2+
ec2-instance ansible_host=ec2-docker ansible_user=ubuntu

0 commit comments

Comments
 (0)