From bbaaa772c283e3d0b23ebd9ca42205e0cc40792c Mon Sep 17 00:00:00 2001 From: Joe Talerico Date: Wed, 15 Jun 2016 10:08:04 -0400 Subject: [PATCH] Rename gen_hostfile.sh Renaming to make it represent what it is generating + Fixing Ansible + Adding Installer field in groupvars + Fix READMEs Change-Id: I0218c0822f50c4c263ad31358cbac5bc195e6c0f --- README.rst | 18 +++++++---- ansible/README.md | 4 +-- ...stfile.sh => generate_tripleo_hostfile.sh} | 32 +++++++++---------- ansible/install/group_vars/all.yml | 3 ++ ansible/install/roles/browbeat/tasks/main.yml | 3 +- 5 files changed, 34 insertions(+), 26 deletions(-) rename ansible/{gen_hostfile.sh => generate_tripleo_hostfile.sh} (77%) diff --git a/README.rst b/README.rst index caf591c65..23f41edd5 100644 --- a/README.rst +++ b/README.rst @@ -46,7 +46,7 @@ change parameters of the overcloud. Before running browbeat ======================= -- Execute the ansible/gen_hostfile.sh script (builds the ssh config) +- Execute the ansible/generate_tripleo_hostfile.sh script (builds the ssh config) - Configure browbeat-config.yaml to match your tests How to run Browbeat Stress Tests? @@ -66,11 +66,14 @@ DEtailed install and run instructions are presented in a section below. What is necessary? ================== -- TripleO -- Why? We use passwordless ssh to reach each controller instance and +- TripleO** + + Why? We use passwordless ssh to reach each controller instance and compute instance. + - Ansible -- Why? We started with using bash to make changes to the Overcloud, + + Why? We started with using bash to make changes to the Overcloud, creating complex sed/awks that we get for free with Ansible (for the most part). Other monitoring and stress test tools are installed by the respective playbooks when run. @@ -78,6 +81,8 @@ What is necessary? If you prefer to not use Ansible, the older versions (no longer maintained) of the browbeat.sh can be found in a older commit. +** If you are interested in contributing a connector for your OpenStack Distribution, please review the Contributing section. + Detailed Install, Check and Run =============================== @@ -96,7 +101,7 @@ From your local machine $ ssh-copy-id stack@ $ git clone https://github.com/openstack/browbeat.git $ cd browbeat/ansible - $ ./gen_hostfile.sh ~/.ssh/config + $ ./generate_tripleo_hostfile.sh ~/.ssh/config $ 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 @@ -160,7 +165,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]$ ./gen_hostfile.sh localhost ~/.ssh/config + [stack@ospd ansible]$ ./generate_tripleo_hostfile.sh localhost ~/.ssh/config [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 @@ -349,4 +354,3 @@ Resources * `Code Review `_ * `Git Web `_ * `IRC `_ -- **#openstack-browbeat** (irc.freenode.net) - diff --git a/ansible/README.md b/ansible/README.md index 25f0f9e38..29c3dea02 100644 --- a/ansible/README.md +++ b/ansible/README.md @@ -30,9 +30,9 @@ Install your public key into stack's authorized_keys # ssh-copy-id stack@ ``` -Then run gen_hosts.sh script to generate your overcloud's hosts file for ansible and generate a "jumpbox" ssh config: +Then run generate_tripleo_hosts.sh script to generate your overcloud's hosts file for ansible and generate a "jumpbox" ssh config: ``` -# ./gen_hostfile.sh ~/.ssh/config +# ./generate_tripleo_hostfile.sh ~/.ssh/config ``` *Review the hosts file the script generates. diff --git a/ansible/gen_hostfile.sh b/ansible/generate_tripleo_hostfile.sh similarity index 77% rename from ansible/gen_hostfile.sh rename to ansible/generate_tripleo_hostfile.sh index c2317fac9..2240b33ff 100755 --- a/ansible/gen_hostfile.sh +++ b/ansible/generate_tripleo_hostfile.sh @@ -1,42 +1,42 @@ #!/bin/bash if [ ! $# -ge 2 ]; then - echo "Usage: ./gen_hostfiles.sh " - echo "Generates ssh config file to use OSP undercloud host as a jumpbox and creates ansible inventory file." + echo "Usage: ./generate_tripleo_hostfiles.sh " + echo "Generates ssh config file to use with an TripleO undercloud host as a jumpbox and creates ansible inventory file." exit fi -ospd_ip_address=$1 +tripleo_ip_address=$1 ansible_inventory_file='hosts' ssh_config_file=$2 # "Hackish" copy ssh key to self if we are on directly on the undercloud machine: -if [[ "${ospd_ip_address}" == "localhost" ]]; then +if [[ "${tripleo_ip_address}" == "localhost" ]]; then cat ~stack/.ssh/id_rsa.pub >> ~stack/.ssh/authorized_keys chmod 0600 ~stack/.ssh/authorized_keys sudo bash -c "cat ~stack/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys" sudo bash -c "chmod 0600 /root/.ssh/authorized_keys" fi -nodes=$(ssh -tt -o "StrictHostKeyChecking no" stack@${ospd_ip_address} ". ~/stackrc; nova list | grep -i -E 'active|running'") +nodes=$(ssh -tt -o "StrictHostKeyChecking no" stack@${tripleo_ip_address} ". ~/stackrc; nova list | grep -i -E 'active|running'") if [ ${#nodes} -lt 1 ]; then echo "ERROR: nova list failed to execute properly, please check the openstack-nova-api on the undercloud." exit 1 fi -controller_id=$(ssh -tt -o "StrictHostKeyChecking no" stack@${ospd_ip_address} ". ~/stackrc; heat resource-show overcloud Controller | grep physical_resource_id" | awk '{print $4}') +controller_id=$(ssh -tt -o "StrictHostKeyChecking no" stack@${tripleo_ip_address} ". ~/stackrc; heat resource-show overcloud Controller | grep physical_resource_id" | awk '{print $4}') if [ ${#controller_id} -lt 1 ]; then echo "Error: Controller ID is not reporting correctly. Please see check the openstack-heat-api on the undercloud." exit 1 fi -compute_id=$(ssh -tt -o "StrictHostKeyChecking no" stack@${ospd_ip_address} ". ~/stackrc; heat resource-show overcloud Compute | grep physical_resource_id" | awk '{print $4}') +compute_id=$(ssh -tt -o "StrictHostKeyChecking no" stack@${tripleo_ip_address} ". ~/stackrc; heat resource-show overcloud Compute | grep physical_resource_id" | awk '{print $4}') if [ ${#controller_id} -lt 1 ]; then echo "Error: Compute ID is not reporting correctly. Please see check the openstack-heat-api on the undercloud." exit 1 fi -controller_ids=$(ssh -tt -o "StrictHostKeyChecking no" stack@${ospd_ip_address} ". ~/stackrc; heat resource-list ${controller_id} | grep -i controller" | awk '{print $2}') +controller_ids=$(ssh -tt -o "StrictHostKeyChecking no" stack@${tripleo_ip_address} ". ~/stackrc; heat resource-list ${controller_id} | grep -i controller" | awk '{print $2}') if [ ${#controller_id} -lt 1 ]; then echo "Error: Controller IDs is not reporting correctly. Please see check the openstack-heat-api on the undercloud." exit 1 fi -compute_ids=$(ssh -tt -o "StrictHostKeyChecking no" stack@${ospd_ip_address} ". ~/stackrc; heat resource-list ${compute_id} | grep -i compute" | awk '{print $2}') +compute_ids=$(ssh -tt -o "StrictHostKeyChecking no" stack@${tripleo_ip_address} ". ~/stackrc; heat resource-list ${compute_id} | grep -i compute" | awk '{print $2}') if [ ${#controller_id} -lt 1 ]; then echo "Error: Compute IDs is not reporting correctly. Please see check the openstack-heat-api on the undercloud." exit 1 @@ -46,12 +46,12 @@ fi controller_uuids=() for controller in ${controller_ids} do - controller_uuids+=$(ssh -tt -o "StrictHostKeyChecking no" stack@${ospd_ip_address} ". ~/stackrc; heat resource-show ${controller_id} ${controller} | grep -i nova_server_resource" | awk '{print $4}') + controller_uuids+=$(ssh -tt -o "StrictHostKeyChecking no" stack@${tripleo_ip_address} ". ~/stackrc; heat resource-show ${controller_id} ${controller} | grep -i nova_server_resource" | awk '{print $4}') done compute_uuids=() for compute in ${compute_ids} do - compute_uuids+=$(ssh -tt -o "StrictHostKeyChecking no" stack@${ospd_ip_address} ". ~/stackrc; heat resource-show ${compute_id} ${compute} | grep -i nova_server_resource" | awk '{print $4}') + compute_uuids+=$(ssh -tt -o "StrictHostKeyChecking no" stack@${tripleo_ip_address} ". ~/stackrc; heat resource-show ${compute_id} ${compute} | grep -i nova_server_resource" | awk '{print $4}') done echo "" @@ -60,23 +60,23 @@ echo "Creating ssh config file:" echo "---------------------------" echo "" -echo "# Generated by gen_hostfile.sh from browbeat" | tee ${ssh_config_file} +echo "# Generated by generate_tripleo_hostfile.sh from browbeat" | tee ${ssh_config_file} echo "" | tee -a ${ssh_config_file} echo "Host undercloud" | tee -a ${ssh_config_file} -echo " Hostname ${ospd_ip_address}" | tee -a ${ssh_config_file} +echo " Hostname ${tripleo_ip_address}" | tee -a ${ssh_config_file} echo " IdentityFile ~/.ssh/id_rsa" | tee -a ${ssh_config_file} echo " StrictHostKeyChecking no" | tee -a ${ssh_config_file} echo " UserKnownHostsFile=/dev/null" | tee -a ${ssh_config_file} echo "" | tee -a ${ssh_config_file} echo "Host undercloud-root" | tee -a ${ssh_config_file} -echo " Hostname ${ospd_ip_address}" | tee -a ${ssh_config_file} +echo " Hostname ${tripleo_ip_address}" | tee -a ${ssh_config_file} echo " User root" | tee -a ${ssh_config_file} echo " IdentityFile ~/.ssh/id_rsa" | tee -a ${ssh_config_file} echo " StrictHostKeyChecking no" | tee -a ${ssh_config_file} echo " UserKnownHostsFile=/dev/null" | tee -a ${ssh_config_file} echo "" | tee -a ${ssh_config_file} echo "Host undercloud-stack" | tee -a ${ssh_config_file} -echo " Hostname ${ospd_ip_address}" | tee -a ${ssh_config_file} +echo " Hostname ${tripleo_ip_address}" | tee -a ${ssh_config_file} echo " User stack" | tee -a ${ssh_config_file} echo " IdentityFile ~/.ssh/id_rsa" | tee -a ${ssh_config_file} echo " StrictHostKeyChecking no" | tee -a ${ssh_config_file} @@ -172,4 +172,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 "stack@${ospd_ip_address}":/home/stack/.ssh/id_rsa ~/.ssh/heat-admin-id_rsa +scp "stack@${tripleo_ip_address}":/home/stack/.ssh/id_rsa ~/.ssh/heat-admin-id_rsa diff --git a/ansible/install/group_vars/all.yml b/ansible/install/group_vars/all.yml index 258cddaa4..11c5368ec 100644 --- a/ansible/install/group_vars/all.yml +++ b/ansible/install/group_vars/all.yml @@ -1,5 +1,8 @@ --- +# OpenStack Installer +tripleo: true + browbeat_path: /home/stack/browbeat home_dir: /home/stack diff --git a/ansible/install/roles/browbeat/tasks/main.yml b/ansible/install/roles/browbeat/tasks/main.yml index 8d7ce1215..4a45a8bc8 100644 --- a/ansible/install/roles/browbeat/tasks/main.yml +++ b/ansible/install/roles/browbeat/tasks/main.yml @@ -49,7 +49,8 @@ when: browbeat_exists.stat.isdir is undefined - name: Generate hosts and ~/.ssh/config on undercloud - shell: . {{ home_dir }}/stackrc; {{ home_dir }}/browbeat/ansible/gen_hostfile.sh localhost {{ home_dir }}/.ssh/config + shell: . {{ home_dir }}/stackrc; {{ home_dir }}/browbeat/ansible/generate_tripleo_hostfile.sh localhost {{ home_dir }}/.ssh/config + when: tripleo - name: Move hosts file to correct location command: mv {{ home_dir }}/hosts {{ home_dir }}/browbeat/ansible/hosts