Merge "Make Browbeat multi-cloud friendly."

This commit is contained in:
Jenkins 2016-08-31 16:31:18 +00:00 committed by Gerrit Code Review
commit 3c2a37dac3
5 changed files with 44 additions and 12 deletions

4
.gitignore vendored
View File

@ -3,6 +3,10 @@
# Ansible files
*.retry
# Prevent ssh files from sneaking into the git repo
ansible/ssh-config
ansible/heat-admin-id_rsa
# Prevent hosts files from sneaking into the git repo
ansible/hosts

View File

@ -31,6 +31,7 @@ Table of Contents
browbeat <#run-performance-stress-tests-through-browbeat>`__
- `Running PerfKitBenchmarker <#running-perfkitbenchmarker>`__
- `Working with Multiple Clouds <#working-with-multiple-clouds>`__
- `Contributing <#contributing>`__
- `Adding Functionality <#adding-functionality>`__
@ -94,7 +95,7 @@ From your local machine
$ ssh-copy-id stack@<undercloud-ip>
$ git clone https://github.com/openstack/browbeat.git
$ cd browbeat/ansible
$ ./generate_tripleo_hostfile.sh <undercloud-ip> ~/.ssh/config
$ ./generate_tripleo_hostfile.sh <undercloud-ip>
$ vi install/group_vars/all.yml # Make sure to edit the dns_server to the correct ip address
$ ansible-playbook -i hosts install/browbeat.yml
$ vi install/group_vars/all.yml # Edit browbeat network settings
@ -158,7 +159,7 @@ From your undercloud
[root@ospd ~]# su - stack
[stack@ospd ~]$ git clone https://github.com/openstack/browbeat.git
[stack@ospd ~]$ cd browbeat/ansible
[stack@ospd ansible]$ ./generate_tripleo_hostfile.sh localhost ~/.ssh/config
[stack@ospd ansible]$ ./generate_tripleo_hostfile.sh localhost
[stack@ospd ansible]$ sudo easy_install pip
[stack@ospd ansible]$ sudo pip install ansible
[stack@ospd ansible]$ vi install/group_vars/all.yml # Make sure to edit the dns_server to the correct ip address
@ -238,6 +239,25 @@ browbeat-config.yaml:
(browbeat-venv)[stack@ospd browbeat]$ ./browbeat.py perfkit -s browbeat-config.yaml
Working with Multiple Clouds
============================
If you are running playbooks from your local machine you can run against more
than one cloud at the same time. To do this, you should create a directory
per-cloud and clone browbeat into that specific directory:
::
[browbeat@laptop ~]$ mkdir cloud01; cd cloud01
[browbeat@laptop cloud01]$ git clone git@github.com:openstack/browbeat.git
...
[browbeat@laptop cloud01]$ cd browbeat/ansible
[browbeat@laptop ansible]$ ./generate_tripleo_hostfile.sh <cloud01-ip-address>
[browbeat@laptop ansible]$ ansible-playbook -i hosts (Your playbook you wish to run...)
[browbeat@laptop ansible]$ ssh -F ssh-config overcloud-controller-0 # Takes you to first controller
Repeat the above steps for as many clouds as you have to run playbooks against your clouds.
Contributing
============

View File

@ -3,3 +3,7 @@ gathering = smart
fact_caching_timeout = 86400
fact_caching = jsonfile
fact_caching_connection = /tmp/browbeat_fact_cache
[ssh_connection]
# Load the specific ssh config file in this directory
ssh_args = -F ssh-config

View File

@ -1,12 +1,12 @@
#!/bin/bash
if [ ! $# -ge 2 ]; then
echo "Usage: ./generate_tripleo_hostfiles.sh <tripleo_ip_address> <ssh_config_file> "
if [ ! $# -ge 1 ]; then
echo "Usage: ./generate_tripleo_hostfiles.sh <tripleo_ip_address>"
echo "Generates ssh config file to use with an TripleO undercloud host as a jumpbox and creates ansible inventory file."
exit
fi
tripleo_ip_address=$1
ansible_inventory_file='hosts'
ssh_config_file=$2
ssh_config_file='ssh-config'
# "Hackish" copy ssh key to self if we are on directly on the undercloud machine:
if [[ "${tripleo_ip_address}" == "localhost" ]]; then
@ -107,9 +107,9 @@ for line in $nodes; do
fi
echo "" | tee -a ${ssh_config_file}
echo "Host ${host}" | tee -a ${ssh_config_file}
echo " ProxyCommand ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ConnectTimeout=60 -i ~/.ssh/id_rsa undercloud-stack -W ${IP}:22" | tee -a ${ssh_config_file}
echo " ProxyCommand ssh -F ssh-config -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ConnectTimeout=60 -i ~/.ssh/id_rsa stack@${tripleo_ip_address} -W ${IP}:22" | tee -a ${ssh_config_file}
echo " User heat-admin" | tee -a ${ssh_config_file}
echo " IdentityFile ~/.ssh/heat-admin-id_rsa" | tee -a ${ssh_config_file}
echo " IdentityFile heat-admin-id_rsa" | tee -a ${ssh_config_file}
echo " StrictHostKeyChecking no" | tee -a ${ssh_config_file}
echo " UserKnownHostsFile=/dev/null" | tee -a ${ssh_config_file}
done
@ -180,4 +180,4 @@ echo "---------------------------"
echo "Copying heat-admin key to local machine(~/.ssh/heat-admin-id_rsa) to for use with ssh config file"
echo "---------------------------"
echo ""
scp -o "UserKnownHostsFile /dev/null" -o "StrictHostKeyChecking no" "stack@${tripleo_ip_address}":/home/stack/.ssh/id_rsa ~/.ssh/heat-admin-id_rsa
scp -o "UserKnownHostsFile /dev/null" -o "StrictHostKeyChecking no" "stack@${tripleo_ip_address}":/home/stack/.ssh/id_rsa heat-admin-id_rsa

View File

@ -81,12 +81,16 @@
git: repo=https://github.com/openstack/browbeat.git dest={{ browbeat_path }} version=master
when: browbeat_exists.stat.isdir is undefined
- name: Generate hosts and ~/.ssh/config on undercloud
shell: . {{ home_dir }}/stackrc; {{ browbeat_path }}/ansible/generate_tripleo_hostfile.sh localhost {{ home_dir }}/.ssh/config
- name: Generate hosts and ssh-config on undercloud
shell: . {{ home_dir }}/stackrc; {{ browbeat_path }}/ansible/generate_tripleo_hostfile.sh localhost
when: tripleo
- name: Move hosts file to correct location
command: mv {{ home_dir }}/hosts {{ browbeat_path }}/ansible/hosts
- name: Move files to correct location
command: mv {{ home_dir }}/{{item}} {{ browbeat_path }}/ansible/{{item}}
with_items:
- hosts
- ssh-config
- heat-admin-id_rsa
- name: Install requirements.txt into browbeat-venv
pip: requirements={{ browbeat_path }}/requirements.txt virtualenv={{ browbeat_venv }}