From 1e9474824373f9d0709002eab1ea5fa50d7ef0d6 Mon Sep 17 00:00:00 2001 From: Alex Krzos Date: Tue, 22 Dec 2015 12:40:52 -0500 Subject: [PATCH] Break out installers. Change-Id: Ief31a62d72003a02c9291dd0125efb46cc730579 --- README.md | 58 ++++++++++----- ansible/README.md | 70 +++++++++++++------ .../neutron/tasks/{main.yaml => main.yml} | 0 .../roles/nova/tasks/{main.yaml => main.yml} | 0 ansible/install/browbeat.yml | 10 +++ ansible/install/{install.yml => connmon.yml} | 10 +-- ansible/install/group_vars/all | 2 - ansible/install/pbench.yml | 2 + ansible/install/roles/browbeat/tasks/main.yml | 60 ++++++++++++++++ ansible/install/roles/common/tasks/main.yml | 1 + ansible/install/roles/connmon/tasks/main.yml | 16 +++-- ansible/install/roles/keystone/tasks/main.yml | 3 +- ansible/install/roles/neutron/tasks/main.yml | 3 +- ansible/install/roles/nova/tasks/main.yml | 3 +- .../install/roles/undercloud/tasks/main.yml | 15 ---- ansible/install/setup.yml | 33 --------- ansible/install/shaker.yml | 12 ++++ requirements.txt | 1 + 18 files changed, 193 insertions(+), 106 deletions(-) rename ansible/check/roles/neutron/tasks/{main.yaml => main.yml} (100%) rename ansible/check/roles/nova/tasks/{main.yaml => main.yml} (100%) create mode 100644 ansible/install/browbeat.yml rename ansible/install/{install.yml => connmon.yml} (60%) create mode 100644 ansible/install/roles/browbeat/tasks/main.yml delete mode 100644 ansible/install/roles/undercloud/tasks/main.yml delete mode 100644 ansible/install/setup.yml create mode 100644 ansible/install/shaker.yml diff --git a/README.md b/README.md index f589f45f6..013361bd0 100644 --- a/README.md +++ b/README.md @@ -20,24 +20,50 @@ On the Red Hat OpenStack Director host, as the Stack user jump into a venv w/ Ra * 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). If you prefer to not use Ansible, the older versions (no longer maintained) of the browbeat.sh can be found here. -# Example Install and Run +# Example Install, Check and Run -On director (As stack user): +Installing Browbeat and running the performance checks can be performed either from your local machine or from the undercloud. The local machine install assumes you have ansible already installed. + +## Install Browbeat from your local machine ``` +$ ssh-copy-id stack@ $ git clone https://github.com/jtaleric/browbeat.git $ cd browbeat/ansible -$ ./gen_hostfile.sh localhost ~/.ssh/config -$ ansible-playbook -i hosts install/setup.yml -$ cd ~ -$ sudo yum install -y libffi-devel gmp-devel postgresql-devel -$ wget -q -O- https://raw.githubusercontent.com/openstack/rally/master/install_rally.sh | bash -$ . ~/rally/bin/activate -$ . ~stack/overcloudrc -$ rally deployment create --fromenv --name overcloud -$ . ~stack/stackrc -$ cd browbeat -$ sudo yum install -y freetype-devel libpng-devel -$ sudo pip install -Ur requirements.txt -$ ./browbeat.sh test01 +$ ./gen_hostfile.sh ~/.ssh/config +$ ansible-playbook -i hosts install/browbeat.yml +``` + +## (Optional) Install shaker: +``` +$ ansible-playbook -i hosts install/shaker.yml +``` + +## (Optional) Install connmon: +``` +$ ansible-playbook -i hosts install/connmon.yml +``` + +## (Optional) Install pbench: +``` +$ ansible-playbook -i hosts install/connmon.yml +``` +* pbench install is under improvement at this time and likely requires additional setup to complete install. + +## Next step is to run basic performance checks +``` +$ ansible-playbook -i hosts check/site.yml +``` +Your performance check output is located in check/bug_report.log + +## Last step is to run performance stress tests through browbeat on the undercloud: +``` +$ ssh undercloud-root +[root@ospd ~]# su - stack +[stack@ospd ~]$ screen -S browbeat +[stack@ospd ~]$ . browbeat-venv/bin/activate +(browbeat-venv)[stack@ospd ~]$ cd browbeat/ +(browbeat-venv)[stack@ospd browbeat]$ vi browbeat.cfg # Edit browbeat.cfg to control how many stress tests are run. +(browbeat-venv)[stack@ospd browbeat]$ ./browbeat.sh test01 +... +(browbeat-venv)[stack@ospd browbeat]$ ./graphing/rallyplot.py test01 ``` -Edit `browbeat-config` for desired tests before running `browbeat.sh` diff --git a/ansible/README.md b/ansible/README.md index 3c6534db8..84442b6f9 100644 --- a/ansible/README.md +++ b/ansible/README.md @@ -1,5 +1,15 @@ # Ansible for Browbeat -Playbooks to modify and performance check the overcloud + +Playbooks for: +* Install Browbeat +* Install connmon +* Install pbench +* Install shaker +* Check overcloud for performance issues +* Adjust number of workers for nova/keystone +* Deploy keystone in eventlet/httpd +* Switch keystone token type to UUID/Fernet + ## To use @@ -9,51 +19,65 @@ Install your public key into stack's authorized_keys ``` Then run gen_hosts.sh script to generate your overcloud's hosts file for ansible and generate a "jumpbox" ssh config: - ``` # ./gen_hostfile.sh ~/.ssh/config ``` **Review the hosts file the script generates. -To modify the number of workers each service is running: +## Ansible Installers: + +Install Browbeat +``` +# ansible-playbook -i hosts install/browbeat.yml +``` + +Install Connmon +``` +# ansible-playbook -i hosts install/connmon.yml +``` + +Install Pbench (Requires some knowledge of setting up pbench to have this functionality work completely) +``` +# ansible-playbook -i hosts install/pbench.yml +``` + +Install Shaker +``` +# ansible-playbook -i hosts install/shaker.yml +``` + +## Performance Checks: + +Run the check playbook to identify common performance issues: +``` +# ansible-playbook -i hosts check/site.yml +``` + +## Adjust your overcloud: + +To modify the number of workers each service is running: ``` # ansible-playbook -i hosts browbeat/adjustment.yml -e "workers=8" ``` Nova and Keystone will be running 8 workers per service. To modify number of workers each service is running and ensure Keystone is deployed in eventlet: - ``` # ansible-playbook -i hosts browbeat/adjustment.yml -e "workers=8 keystone_deployment=eventlet" ``` To run Keystone in httpd, change keystone_deployment to httpd: - ``` # ansible-playbook -i hosts browbeat/adjustment.yml -e "workers=8 keystone_deployment=httpd" ``` -## Performance Checks: - -Run the check playbook to identify common performance issues: - +To switch to fernet tokens: ``` -# ansible-playbook -i hosts check/site.yml +# ansible-playbook -i hosts browbeat/keystone_token_type.yml -e "token_provider=fernet" ``` -## Ansible Installers: - -Install connmon/shaker - +To switch to UUID tokens: ``` -# ansible-playbook -i hosts install/install.yml -e "connmon=true" -# ansible-playbook -i hosts install/install.yml -e "shaker=true" -# ansible-playbook -i hosts install/install.yml -e "connmon=true shaker=true" -``` - -Install pbench (Requires some knowledge of setting up pbench to have this functionality work completely) - -``` -# ansible-playbook -i hosts install/pbench.yml +# ansible-playbook -i hosts browbeat/keystone_token_type.yml -e "token_provider=uuid" ``` diff --git a/ansible/check/roles/neutron/tasks/main.yaml b/ansible/check/roles/neutron/tasks/main.yml similarity index 100% rename from ansible/check/roles/neutron/tasks/main.yaml rename to ansible/check/roles/neutron/tasks/main.yml diff --git a/ansible/check/roles/nova/tasks/main.yaml b/ansible/check/roles/nova/tasks/main.yml similarity index 100% rename from ansible/check/roles/nova/tasks/main.yaml rename to ansible/check/roles/nova/tasks/main.yml diff --git a/ansible/install/browbeat.yml b/ansible/install/browbeat.yml new file mode 100644 index 000000000..90a51a932 --- /dev/null +++ b/ansible/install/browbeat.yml @@ -0,0 +1,10 @@ +--- +# +# Playbook to install browbeat on undercloud +# + +- hosts: undercloud + remote_user: stack + roles: + - common + - browbeat diff --git a/ansible/install/install.yml b/ansible/install/connmon.yml similarity index 60% rename from ansible/install/install.yml rename to ansible/install/connmon.yml index ad4d6105d..cfdb2fc76 100644 --- a/ansible/install/install.yml +++ b/ansible/install/connmon.yml @@ -1,26 +1,22 @@ --- # -# Playbook to install connmon and shaker on undercloud/overcloud +# Playbook to install connmon on undercloud/overcloud # - hosts: undercloud remote_user: stack vars: - connmon: false + ansible_sudo: true undercloud: true - shaker: false roles: - common - - undercloud - connmon - - shaker - hosts: controller remote_user: heat-admin vars: - connmon: false + ansible_sudo: true undercloud: false - shaker: false roles: - common - connmon diff --git a/ansible/install/group_vars/all b/ansible/install/group_vars/all index 51d20be9f..6497fba3a 100644 --- a/ansible/install/group_vars/all +++ b/ansible/install/group_vars/all @@ -1,6 +1,4 @@ --- -ansible_sudo: yes - centos_image: http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2 connmon_host: 192.0.2.1 dns_server: 8.8.8.8 diff --git a/ansible/install/pbench.yml b/ansible/install/pbench.yml index f731c4dc7..336b16966 100644 --- a/ansible/install/pbench.yml +++ b/ansible/install/pbench.yml @@ -6,6 +6,7 @@ - hosts: undercloud remote_user: stack vars: + ansible_sudo: true undercloud: true roles: - common @@ -14,6 +15,7 @@ - hosts: controller remote_user: heat-admin vars: + ansible_sudo: true undercloud: false undercloud_root_ssh_key: "{{ lookup('file', 'roles/pbench/files/undercloud_root_id_rsa.pub') }}" undercloud_stack_ssh_key: "{{ lookup('file', 'roles/pbench/files/undercloud_stack_id_rsa.pub') }}" diff --git a/ansible/install/roles/browbeat/tasks/main.yml b/ansible/install/roles/browbeat/tasks/main.yml new file mode 100644 index 000000000..eed412945 --- /dev/null +++ b/ansible/install/roles/browbeat/tasks/main.yml @@ -0,0 +1,60 @@ +--- +# +# Browbeat Install +# + +- name: Install Browbeat dependencies + yum: name={{ item }} state=present + become: true + with_items: + - freetype-devel + - libpng-devel + +- name: Install pip + become: yes + easy_install: name=pip + +- name: Install virtualenv + become: true + pip: name=virtualenv + +- name: Create virtualenv + command: virtualenv /home/stack/browbeat-venv creates="/home/stack/browbeat-venv" + +- name: Clone Browbeat on undercloud + git: repo=https://github.com/jtaleric/browbeat.git dest=/home/stack/browbeat + when: "'localhost' not in '{{ inventory_hostname }}'" + +- name: Generate hosts and ~/.ssh/config on undercloud + shell: . /home/stack/stackrc; /home/stack/browbeat/ansible/gen_hostfile.sh localhost /home/stack/.ssh/config + when: "'localhost' not in '{{ inventory_hostname }}'" + +- name: Move hosts file to correct location + command: mv /home/stack/hosts /home/stack/browbeat/ansible/hosts + +- name: Install requirements.txt + become: true + pip: requirements=/home/stack/browbeat/requirements.txt virtualenv=/home/stack/browbeat-venv + +- name: Setup Rally database + shell: . /home/stack/browbeat-venv/bin/activate; rally-manage db recreate + +- name: Setup Rally deployment + shell: . /home/stack/browbeat-venv/bin/activate; . /home/stack/overcloudrc; rally deployment create --fromenv --name overcloud + +# +# Nova boot image tasks +# + +- name: Fetch centos7 image + get_url: url={{ centos_image }} dest=/home/stack/centos7.qcow2 + +- name: Determine is centos7 image exists + shell: . /home/stack/overcloudrc; glance image-list | grep "centos7" + register: centos7_image_exists + ignore_errors: true + changed_when: false + +- name: Upload centos7 image into cloud + shell: . /home/stack/overcloudrc; glance image-create --name centos7 --visibility public --disk-format=qcow2 --container-format=bare < /home/stack/centos7.qcow2 + when: "'centos7' not in '{{ centos7_image_exists.stdout }}'" diff --git a/ansible/install/roles/common/tasks/main.yml b/ansible/install/roles/common/tasks/main.yml index e87ac0e6a..9b2f60e2b 100644 --- a/ansible/install/roles/common/tasks/main.yml +++ b/ansible/install/roles/common/tasks/main.yml @@ -4,4 +4,5 @@ # - name: Add DNS record + become: true lineinfile: dest=/etc/resolv.conf state=present line="nameserver {{ dns_server }}" insertafter="^search" diff --git a/ansible/install/roles/connmon/tasks/main.yml b/ansible/install/roles/connmon/tasks/main.yml index e26b483fd..d9a956756 100644 --- a/ansible/install/roles/connmon/tasks/main.yml +++ b/ansible/install/roles/connmon/tasks/main.yml @@ -5,11 +5,9 @@ - name: Install pip easy_install: name=pip - when: connmon - name: Install connmon pip: name=connmon - when: connmon # # Connmon Setup @@ -24,10 +22,20 @@ mode=0644 with_items: - ip_address: "{{ connmon_host }}" - when: connmon # To remove the screen session: screen -X -S connmond kill - name: Run connmond in screen session on undercloud command: screen -d -S connmond -m connmond - when: connmon and undercloud + when: undercloud changed_when: false + +- name: check iptables + shell: iptables -nvL | grep -q "dpt:5800" + changed_when: false + when: undercloud + register: connmon_port + ignore_errors: true + +- name: open up iptables + shell: /usr/sbin/iptables -I INPUT 1 -p tcp --dport 5800 -j ACCEPT + when: undercloud and connmon_port.rc == 1 diff --git a/ansible/install/roles/keystone/tasks/main.yml b/ansible/install/roles/keystone/tasks/main.yml index 5d6014cfe..765fbdab2 100644 --- a/ansible/install/roles/keystone/tasks/main.yml +++ b/ansible/install/roles/keystone/tasks/main.yml @@ -23,14 +23,13 @@ - name: Check for connmon in keystone.conf shell: grep -Eq 'connection\s?=\s?mysql:' /etc/keystone/keystone.conf - when: connmon register: keystone_mysql ignore_errors: true changed_when: false - name: Enable connmon in keystone.conf shell: sed -i 's/mysql:/mysql+connmon:/g' /etc/keystone/keystone.conf - when: connmon and keystone_mysql.rc == 0 + when: keystone_mysql.rc == 0 notify: - restart httpd - unmanage keystone diff --git a/ansible/install/roles/neutron/tasks/main.yml b/ansible/install/roles/neutron/tasks/main.yml index cdf419a05..14b6e680d 100644 --- a/ansible/install/roles/neutron/tasks/main.yml +++ b/ansible/install/roles/neutron/tasks/main.yml @@ -6,13 +6,12 @@ - name: Check for connmon in neutron.conf shell: grep -Eq 'connection\s?=\s?mysql:' /etc/neutron/neutron.conf register: neutron_mysql - when: connmon ignore_errors: true changed_when: false - name: Enable Connmon in neutron.conf shell: sed -i 's/mysql:/mysql+connmon:/g' /etc/neutron/neutron.conf - when: connmon and neutron_mysql.rc == 0 + when: neutron_mysql.rc == 0 notify: - unmanage neutron-server - restart neutron-server diff --git a/ansible/install/roles/nova/tasks/main.yml b/ansible/install/roles/nova/tasks/main.yml index 13c1d8f50..7e31f1464 100644 --- a/ansible/install/roles/nova/tasks/main.yml +++ b/ansible/install/roles/nova/tasks/main.yml @@ -6,13 +6,12 @@ - name: Check for connmon in nova.conf shell: grep -Eq 'connection\s?=\s?mysql:' /etc/nova/nova.conf register: nova_mysql - when: connmon ignore_errors: true changed_when: false - name: Enable Connmon in nova.conf shell: sed -i 's/mysql:/mysql+connmon:/g' /etc/nova/nova.conf - when: connmon and nova_mysql.rc == 0 + when: nova_mysql.rc == 0 notify: - unmanage nova services - restart nova services diff --git a/ansible/install/roles/undercloud/tasks/main.yml b/ansible/install/roles/undercloud/tasks/main.yml deleted file mode 100644 index 768c78f1d..000000000 --- a/ansible/install/roles/undercloud/tasks/main.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# -# Tasks for undercloud to run browbeat with connmon -# - -- name: check iptables - shell: iptables -nvL | grep -q "dpt:5800" - changed_when: false - when: connmon - register: connmon_port - ignore_errors: true - -- name: open up iptables - shell: /usr/sbin/iptables -I INPUT 1 -p tcp --dport 5800 -j ACCEPT - when: connmon and connmon_port.rc == 1 diff --git a/ansible/install/setup.yml b/ansible/install/setup.yml deleted file mode 100644 index ae0cce379..000000000 --- a/ansible/install/setup.yml +++ /dev/null @@ -1,33 +0,0 @@ ---- -# -# Playbook to setup undercloud for browbeat -# - -- hosts: undercloud - remote_user: stack - vars: - undercloud: true - gather_facts: false - roles: - - common - tasks: - - name: Fetch centos7 image - get_url: url={{ centos_image }} dest=/home/stack/centos7.qcow2 - - - name: Determine is centos7 image exists - shell: . /home/stack/overcloudrc; glance image-list | grep "centos7" - register: centos7_image_exists - ignore_errors: true - changed_when: false - - - name: Upload centos7 image into cloud - shell: . /home/stack/overcloudrc; glance image-create --name centos7 --disk-format=qcow2 --container-format=bare < /home/stack/centos7.qcow2 - when: "'centos7' not in '{{ centos7_image_exists.stdout }}'" - - - name: Get centos7 image id - shell: . /home/stack/overcloudrc; glance image-list | grep "centos7" | awk '{print $2}' - register: centos7_image_id - changed_when: false - - - name: Set centos7 image public - shell: . /home/stack/overcloudrc; glance image-update --visibility public {{ centos7_image_id.stdout }} diff --git a/ansible/install/shaker.yml b/ansible/install/shaker.yml new file mode 100644 index 000000000..50d58ce40 --- /dev/null +++ b/ansible/install/shaker.yml @@ -0,0 +1,12 @@ +--- +# +# Playbook to install shaker on undercloud/overcloud +# + +- hosts: undercloud + remote_user: stack + vars: + ansible_sudo: true + roles: + - common + - shaker diff --git a/requirements.txt b/requirements.txt index e99c3ff14..126cf3d98 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ ansible matplotlib +rally # For pbench-agent compatibility: configtools