Refactor ansible-apply.yaml and inventory/hosts, add ANSIBLE_USER and SSH_AUTH_SOCK environment variables, and update Terraform Apply script to handle multiple hosts
This commit is contained in:
@@ -89,6 +89,14 @@ jobs:
|
||||
- name: Terraform Apply
|
||||
env:
|
||||
VAULT_MASTER_PASSWORD: ${{ secrets.VAULT_MASTER_PASSWORD }}
|
||||
ANSIBLE_USER: ${{ secrets.ANSIBLE_USER }}
|
||||
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
|
||||
run: |
|
||||
for HOST in $TRUSTED_HOSTS; do
|
||||
ssh -f -N -L 16443:localhost:16443 $ANSIBLE_USER@$HOST
|
||||
# override hosts address in kube config
|
||||
sed -i "s/server: https:\/\/$HOST:16443/server: https:\/\/localhost:16443/g" ~/.kube/config
|
||||
cd terraform/k8sapps
|
||||
sectool exec terraform apply --auto-approve
|
||||
pkill -f "ssh -f -N -L 16443:localhost:16443 $ANSIBLE_USER@$HOST"
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user