Commit 88c03914 authored by Ana Custura's avatar Ana Custura
Browse files

Add initial bootstrap script

parent 490a1375
Loading
Loading
Loading
Loading

ansible/bootstrap.sh

0 → 100755
+41 −0
Original line number Diff line number Diff line
#!/bin/sh
########################################################################
# bootstrap.sh - Bootstrap a new onionperf host for management with Ansible.
########################################################################

TARGET_OS=linux
LOGIN_USER=cloud

usage()
{
  echo "Usage: $0 [-u login_user] target"
  exit 2
}

bootstrap_linux()
{
    ssh $LOGIN_USER@$TARGET sudo apt install python3 sudo
    ansible-playbook \
      --limit $TARGET \
      --user $LOGIN_USER \
      --become-method sudo \
      --become-user root \
      --ask-become-pass \
      --ask-pass \
      -i hosts \
      onionperf-simple.yml
}

while getopts 'u:h' c
do
  case $c in
    u) LOGIN_USER=$OPTARG ;;
    h) usage ;;
  esac
done

shift $((OPTIND-1))

TARGET=$1

bootstrap_linux