server_init/scripts/03_run_playbook.sh

10 lines
576 B
Bash
Raw Permalink Normal View History

#!/bin/bash
set -e
echo "=== Phase 3: Copying files and running playbook ==="
rsync -az --exclude '.git' "$SCRIPT_DIR/" "$NEW_USER@pangolin.$HOST:~/server_init/"
ssh -t "$NEW_USER@pangolin.$HOST" \
"bash -c 'sudo locale-gen en_US.UTF-8 && if ! command -v ansible &>/dev/null; then echo \"Installing Ansible...\"; sudo apt-get update && sudo apt-get install -y ansible-core python3-pip; fi && echo \"Running Ansible playbook...\" && cd ~/server_init && LC_ALL=en_US.UTF-8 ansible-playbook -i localhost, -c local playbook.yml -e base_domain=\"$HOST\" --ask-become-pass'"