Refactor SSH configuration in ansible-apply.yaml and add trusted hosts
This commit is contained in:
@@ -35,11 +35,13 @@ jobs:
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
|
||||
- name: Configure SSH to Disable Host Key Checking
|
||||
env:
|
||||
TRUSTE_HOSTS: ${{ secrets.TRUSTED_HOSTS }}
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
touch ~/.ssh/config
|
||||
echo -e "Host *\n\tStrictHostKeyChecking no\n\tUserKnownHostsFile=/dev/null\n" >> ~/.ssh/config
|
||||
chmod 600 ~/.ssh/config
|
||||
for host in $TRUSTED_HOSTS; do
|
||||
ssh-keyscan -H $host >> ~/.ssh/known_hosts
|
||||
done
|
||||
|
||||
- name: Apply Ansible Playbook
|
||||
env:
|
||||
|
||||
Reference in New Issue
Block a user