Make Browbeat multi-cloud friendly.
This commit "localizes" ssh-config and heat-admin-id_rsa to your local Browbeat directory. This allows one to simply cd into the directory of the cloud they are working with Browbeat against and ensure they do not incorrectly run playbooks against the wrong hosts. Example: [akrzos@bithead ansible]$ ./generate_tripleo_hostfile.sh x.x.x.x ... [akrzos@bithead ansible]$ ls -la ... -rwxrwxr-x. 1 akrzos akrzos 9461 Aug 25 16:18 generate_tripleo_hostfile.sh -rw-------. 1 akrzos akrzos 1675 Aug 27 14:16 heat-admin-id_rsa -rw-rw-r--. 1 akrzos akrzos 338 Aug 27 14:16 hosts -rw-------. 1 akrzos akrzos 2013 Aug 27 14:16 ssh-config ... [akrzos@bithead ansible]$ ssh -F ssh-config root@undercloud [root@gprfc007 ~]# exit logout [akrzos@bithead ansible]$ ssh -F ssh-config undercloud-stack [stack@gprfc007 ~]$ exit logout [akrzos@bithead ansible]$ ssh -F ssh-config undercloud-root [root@gprfc007 ~]# exit logout [akrzos@bithead ansible]$ ssh -F ssh-config overcloud-controller-0 Warning: Permanently added '10.16.154.18' (ECDSA) to the list of known hosts. Warning: Permanently added 'overcloud-controller-0' (ECDSA) to the list of known hosts. [heat-admin@overcloud-controller-0 ~]$ exit logout [akrzos@bithead ansible]$ ssh -F ssh-config overcloud-controller-1 [heat-admin@overcloud-controller-1 ~]$ exit logout [akrzos@bithead ansible]$ ssh -F ssh-config overcloud-controller-2 [heat-admin@overcloud-controller-2 ~]$ exit logout [akrzos@bithead ansible]$ ssh -F ssh-config overcloud-novacompute-0 [heat-admin@overcloud-novacompute-0 ~]$ exit logout [akrzos@bithead ansible]$ ansible-playbook -i hosts install/collectd-openstack.yml ... Tested against the collectd-openstack and grafana-dashboards playbooks Potential issues: CI? (Does CI execute any playbooks from the ansible directory? If so we shouldn't have an issue here.) lib/{ansible/adjustments} - Can we make sure to pass the either the correct ssh-config or use the ansible.cfg inside ansible/? Change-Id: I4764490e5164f7d4d896cbe5bd26e6a59d770df4
This commit is contained in:
parent
b93c7f0355
commit
b95cbeda49
4
.gitignore
vendored
4
.gitignore
vendored
@ -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
|
||||
|
||||
|
24
README.rst
24
README.rst
@ -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
|
||||
============
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 }}
|
||||
|
Loading…
Reference in New Issue
Block a user