kayobe/deploy-seed.sh
Mark Goddard cbd6fcc522 Make SSH keys configurable
Defaults to using stack/.ssh/id_rsa on the control host
2017-02-16 10:44:31 +00:00

71 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
set -e
function run_playbook {
KAYOBE_CONFIG_PATH=${KAYOBE_CONFIG_PATH:-/etc/kayobe}
# Ansible fails silently if the inventory does not exist.
test -e ${KAYOBE_CONFIG_PATH}/inventory
ansible-playbook \
-i ${KAYOBE_CONFIG_PATH}/inventory \
-e @${KAYOBE_CONFIG_PATH}/bifrost.yml \
-e @${KAYOBE_CONFIG_PATH}/dns.yml \
-e @${KAYOBE_CONFIG_PATH}/globals.yml \
-e @${KAYOBE_CONFIG_PATH}/kolla.yml \
-e @${KAYOBE_CONFIG_PATH}/networks.yml \
-e @${KAYOBE_CONFIG_PATH}/network-allocation.yml \
-e @${KAYOBE_CONFIG_PATH}/ntp.yml \
-e @${KAYOBE_CONFIG_PATH}/seed-vm.yml \
-e @${KAYOBE_CONFIG_PATH}/ssh.yml \
-e @${KAYOBE_CONFIG_PATH}/swift.yml \
$@
}
function run_kolla_ansible {
export KOLLA_CONFIG_PATH=${KOLLA_CONFIG_PATH:-/etc/kolla}
# Ansible fails silently if the inventory does not exist.
test -e ${KOLLA_CONFIG_PATH}/inventory/seed
KOLLA_VENV=$(pwd)/ansible/kolla-venv
source ${KOLLA_VENV}/bin/activate
kolla-ansible \
--configdir ${KOLLA_CONFIG_PATH} \
--passwords ${KOLLA_CONFIG_PATH}/passwords.yml \
-i ${KOLLA_CONFIG_PATH}/inventory/seed \
$@
deactivate
}
function configure_os {
run_playbook ansible/ip-allocation.yml -l seed
run_playbook ansible/ssh-known-host.yml -l seed
run_playbook ansible/disable-selinux.yml -l seed
run_playbook ansible/network.yml -l seed
run_playbook ansible/ntp.yml -l seed
run_kolla_ansible bootstrap-servers -e ansible_user=${USER}
run_playbook ansible/kolla-host.yml -l seed
run_playbook ansible/docker.yml -l seed
}
function deploy_bifrost {
# Use a pre-built bifrost image in the stackhpc repository.
# The image was built via kolla-build -t source bifrost-deploy.
run_playbook ansible/kolla-bifrost.yml
run_kolla_ansible deploy-bifrost \
-e kolla_install_type=source \
-e docker_namespace=stackhpc
}
function deploy_seed_node {
configure_os
deploy_bifrost
}
###########################################################
# Main
function main {
deploy_seed_node
}
main $*