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
|
chmod 600 ~/.ssh/id_rsa
|
||||||
|
|
||||||
- name: Configure SSH to Disable Host Key Checking
|
- name: Configure SSH to Disable Host Key Checking
|
||||||
|
env:
|
||||||
|
TRUSTE_HOSTS: ${{ secrets.TRUSTED_HOSTS }}
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
touch ~/.ssh/config
|
for host in $TRUSTED_HOSTS; do
|
||||||
echo -e "Host *\n\tStrictHostKeyChecking no\n\tUserKnownHostsFile=/dev/null\n" >> ~/.ssh/config
|
ssh-keyscan -H $host >> ~/.ssh/known_hosts
|
||||||
chmod 600 ~/.ssh/config
|
done
|
||||||
|
|
||||||
- name: Apply Ansible Playbook
|
- name: Apply Ansible Playbook
|
||||||
env:
|
env:
|
||||||
|
|||||||
Reference in New Issue
Block a user