Skip to content

Commit

Permalink
fix: ssh to server
Browse files Browse the repository at this point in the history
  • Loading branch information
jkellerer committed Jan 31, 2024
1 parent 0d6c07e commit 4ea5083
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions .github/workflows/ansibleOnServer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@ jobs:
- name: Check out repository code
uses: actions/checkout@v2

- name: Set up SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SERVER_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H ${{ secrets.SERVER_IP_ADDRESS }} >> ~/.ssh/known_hosts
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
- name: Test SSH connection
run: |
ssh -o StrictHostKeyChecking=no ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP_ADDRESS }} exit
- name: Set up Python
uses: actions/setup-python@v2
with:
Expand All @@ -46,15 +59,6 @@ jobs:
python -m pip install --upgrade pip
pip install -r server/provision/requirements.txt
- name: Set up SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SERVER_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H ${{ secrets.SERVER_IP_ADDRESS }} >> ~/.ssh/known_hosts
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
- name: Run Ansible
run: |
ansible-playbook --inventory server/provision/inventory_for_ci.yml --extra-vars "remote_server_user=${{ secrets.SERVER_USER }} remote_server_password=${{ secrets.SERVER_USER_PASSWORD }}" ${{ inputs.ansible_file }}

0 comments on commit 4ea5083

Please sign in to comment.