#!/bin/bash set -eux LXD_HOSTNAME="$1" # generate the custom cloud-init file. Cloud init installs and configures sshd SSH_AUTHORIZED_KEY=$(<"$SSH_HOME/id_rsa.pub") eval "$(ssh-agent -s)" ssh-add "$SSH_HOME/id_rsa" export SSH_AUTHORIZED_KEY="$SSH_AUTHORIZED_KEY" export FILENAME="$LXD_HOSTNAME.yml" mkdir -p "$PROJECT_PATH/cloud-init" YAML_PATH="$PROJECT_PATH/cloud-init/$FILENAME" # If we are deploying the www, we attach the vm to the underlay via macvlan. cat > "$YAML_PATH" <> "$YAML_PATH" <> /home/ubuntu/.bash_profile - sudo curl -s -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose - sudo chmod +x /usr/local/bin/docker-compose - sudo apt-get install -y openssh-server EOF else # all other machines. cat >> "$YAML_PATH" <> "$YAML_PATH" <> "$YAML_PATH" <> "$YAML_PATH" <> "$YAML_PATH" <> "$YAML_PATH" <