Add browbeat installation support for RHOSO

Change-Id: Ibbe80770445a59ff76a58715190e2f4daed1fec0
This commit is contained in:
rajeshP524 2024-04-26 22:10:09 +05:30 committed by Masco
parent 2324b47cac
commit f7a91aeca0
10 changed files with 207 additions and 73 deletions

View File

@ -1,26 +1,15 @@
---
#
# Playbook to install Browbeat (Rally + Shaker) on undercloud
#
- hosts: localhost
tasks:
- debug:
msg: "redirecting to browbeat installation based on deployment type"
- hosts: Browbeat
remote_user: "{{ browbeat_user }}"
roles:
- common
- osp_version
- browbeat
- stockpile
- { role: browbeat-results, when: browbeat_results_in_httpd|bool}
- firewall
- rally
- shaker
- { role: flavors, when: browbeat_create_flavors|bool}
- { role: images, when: browbeat_upload_guest_images|bool}
- { role: workloads, when: install_browbeat_workloads|bool}
- { role: e2e-benchmarking, when: install_e2e_benchmarking|bool}
environment: "{{proxy_env}}"
- name: Install browbeat
import_playbook: browbeat_rhoso.yaml
vars:
rally_undercloud_enabled: false
when: is_rhoso_deployment
- hosts: Controller*, Compute*
remote_user: "{{ host_remote_user }}"
roles:
- no-sshd-dns
- name: Install browbeat
import_playbook: browbeat_rhosp.yaml
when: not is_rhoso_deployment

View File

@ -0,0 +1,19 @@
---
#
# Playbook to install Browbeat(Rally) for RHOSO
#
- hosts: localhost
gather_facts: true
vars:
ansible_user: "{{ browbeat_user }}"
ansible_python_interpreter: "{{ python_interpreter }}"
roles:
- browbeat-rhoso-prep
- browbeat
- { role: browbeat-results, when: browbeat_results_in_httpd|bool}
- firewall
- rally
- { role: flavors, when: browbeat_create_flavors|bool}
- { role: images, when: browbeat_upload_guest_images|bool}
environment: "{{proxy_env}}"

View File

@ -0,0 +1,26 @@
---
#
# Playbook to install Browbeat (Rally + Shaker) on undercloud
#
- hosts: Browbeat
remote_user: "{{ browbeat_user }}"
roles:
- common
- osp_version
- browbeat
- stockpile
- { role: browbeat-results, when: browbeat_results_in_httpd|bool}
- firewall
- rally
- shaker
- { role: flavors, when: browbeat_create_flavors|bool}
- { role: images, when: browbeat_upload_guest_images|bool}
- { role: workloads, when: install_browbeat_workloads|bool}
- { role: e2e-benchmarking, when: install_e2e_benchmarking|bool}
environment: "{{proxy_env}}"
- hosts: Controller*, Compute*
remote_user: "{{ host_remote_user }}"
roles:
- no-sshd-dns

View File

@ -4,8 +4,9 @@
# Browbeat Install Configuration
########################################
# Adjust Browbeat user if you are deploying Browbeat on a different machine than the Undercloud
browbeat_user: stack
# Adjust Browbeat user if you are deploying Browbeat on a different machine
# other than kni provisoner host. use 'stack' if you deploying in undercloud
browbeat_user: kni
# Login user for the local/jump machine (Typically Undercloud)
local_remote_user: stack
# Login user for the Overcloud hosts

View File

@ -0,0 +1,85 @@
---
#
# we will be fixing all the gaps to run the browbeat from the provisioner host
# just preparing the provosioner host to run browbeat for rhoso
#
- name: copy the clouds.yaml from the ospclient pod
block:
- name: create the target folder for the clouds.yaml
file:
path: "{{home_dir}}/.config/openstack"
state: directory
mode: '0755'
- name: copy the clouds.yaml
shell: |
oc cp openstack/openstackclient:/home/cloud-admin/.config/openstack/{{item}} {{home_dir}}/.config/openstack/{{item}}
with_items:
- clouds.yaml
- secure.yaml
environment:
KUBECONFIG: "{{ kubeconfig_path }}"
- name: read the cloud yaml files
set_fact:
clouds_yaml: "{{ lookup('file', '{{home_dir}}/.config/openstack/clouds.yaml') | from_yaml }}"
secure_yaml: "{{ lookup('file', '{{home_dir}}/.config/openstack/secure.yaml') | from_yaml }}"
- name: create the environment file
copy:
dest: "{{ overcloudrc }}"
content: |
export OS_CLOUD=default
- name: update clouds.yaml content
set_fact:
clouds_yaml: >-
{{
clouds_yaml | combine({
'clouds': clouds_yaml.clouds | combine({
'default': clouds_yaml.clouds.default | combine({
'auth': clouds_yaml.clouds.default.auth | combine({'password': secure_yaml.clouds.default.auth.password}),
'insecure': True,
'identity_api_version': '3'
})
})
})
}}
- name: update clouds.yaml
copy:
dest: "{{home_dir}}/.config/openstack/clouds.yaml"
content: "{{ clouds_yaml | to_nice_yaml }}"
- name: create JSON content for keystone
set_fact:
keystone_content: |
{
"openstack": {
"auth_url": "{{ clouds_yaml.clouds.default.auth.auth_url }}",
"region_name": "{{ clouds_yaml.clouds.default.region_name }}",
"endpoint_type": "public",
"admin": {
"username": "{{ clouds_yaml.clouds.default.auth.username }}",
"password": "{{ clouds_yaml.clouds.default.auth.password }}",
"user_domain_name": "{{ clouds_yaml.clouds.default.auth.user_domain_name }}",
"project_name": "{{ clouds_yaml.clouds.default.auth.project_name }}",
"project_domain_name": "{{ clouds_yaml.clouds.default.auth.project_domain_name }}"
},
"https_insecure": {{ clouds_yaml.clouds.default.insecure | default(false) }}
}
}
- name: create keystone config file from clouds.yaml
copy:
dest: "{{home_dir}}/.config/openstack/keystone-v3.json"
content: "{{ keystone_content | to_nice_json }}"
- name: install openstack client
shell: |
sudo yum install "http://download.eng.bos.redhat.com/rcm-guest/puddles/OpenStack/rhos-release/rhos-release-latest.noarch.rpm" -y
sudo rhos-release 16.2
sudo yum install python3-openstackclient -y
ignore_errors: true
become: true

View File

@ -117,37 +117,40 @@
line: 'export REQUESTS_CA_BUNDLE={{ overcloud_ca_path }}'
when: overcloud_ca_path is defined
- name: Determine if generate_tripleo_hostfile has been run
stat:
path: "{{ browbeat_path }}/ansible/hosts"
register: hosts_file_exists
- block:
- name: Determine if generate_tripleo_hostfile has been run
stat:
path: "{{ browbeat_path }}/ansible/hosts"
register: hosts_file_exists
- name: Determine if generate_tripleo_inventory has been run
stat:
path: "{{ browbeat_path }}/ansible/hosts.yml"
register: hosts_yml_file_exists
- name: Determine if generate_tripleo_inventory has been run
stat:
path: "{{ browbeat_path }}/ansible/hosts.yml"
register: hosts_yml_file_exists
- name: set either of inventory file exists
set_fact:
inventry_file: "{{ (hosts_file_exists.stat.exists and hosts_file_exists.stat.isreg) or (hosts_yml_file_exists.stat.exists and hosts_yml_file_exists.stat.isreg) }}"
- name: set either of inventory file exists
set_fact:
inventry_file: "{{ (hosts_file_exists.stat.exists and hosts_file_exists.stat.isreg) or (hosts_yml_file_exists.stat.exists and hosts_yml_file_exists.stat.isreg) }}"
- debug: msg="Hosts file is already generated. {{ inventry_file }}"
when: inventry_file
- debug:
msg: "Hosts file is already generated. {{ inventry_file }}"
when: inventry_file
- name: Generate hosts and ssh-config on Browbeat Machine - Default(stack)
shell: . {{ home_dir }}/stackrc; {{ browbeat_path }}/ansible/generate_tripleo_inventory.sh -l --user stack
when: tripleo and (not inventry_file) and ansible_user!= "zuul"
- name: Generate hosts and ssh-config on Browbeat Machine - Default(stack)
shell: . {{ home_dir }}/stackrc; {{ browbeat_path }}/ansible/generate_tripleo_inventory.sh -l --user stack
when: tripleo and (not inventry_file) and ansible_user != "zuul"
- name: Generate hosts and ssh-config on Browbeat Machine - Zuul
shell: . {{ home_dir }}/stackrc; {{ browbeat_path }}/ansible/generate_tripleo_inventory.sh -l --user zuul
when: tripleo and (not inventry_file) and ansible_user== "zuul"
- name: Generate hosts and ssh-config on Browbeat Machine - Zuul
shell: . {{ home_dir }}/stackrc; {{ browbeat_path }}/ansible/generate_tripleo_inventory.sh -l --user zuul
when: tripleo and (not inventry_file) and ansible_user == "zuul"
- name: Move files to correct location
command: mv {{item}} {{ browbeat_path }}/ansible/{{item}}
with_items:
- hosts.yml
- heat-admin-id_rsa
when: "(tripleo and (not inventry_file))"
- name: Move files to correct location
command: mv {{ item }} {{ browbeat_path }}/ansible/{{ item }}
with_items:
- hosts.yml
- heat-admin-id_rsa
when: tripleo and (not inventry_file)
when: not is_rhoso_deployment
- name: Install requirements.txt into browbeat-venv
pip:
@ -180,4 +183,4 @@
insertafter: "hide"
line: " v.Optional('regex',default=''): v.All(str),"
when: collectd_prometheus
when: collectd_prometheus and not is_rhoso_deployment

View File

@ -5,6 +5,6 @@
# Ignore errors here incase the flavors already exist.
- name: Add flavors to overcloud
shell: . {{ overcloudrc }}; nova flavor-create {{item.name}} auto {{item.memory}} {{item.disk}} {{item.cpu}}
shell: . {{ overcloudrc }}; openstack flavor create --ram {{item.memory}} --disk {{item.disk}} --vcpus {{item.cpu}} {{item.name}}
with_items: "{{browbeat_flavors}}"
ignore_errors: true

View File

@ -32,13 +32,17 @@
with_items: "{{ browbeat_guest_images }}"
- name: Upload image into cloud (Newton and Ocata versions)
shell: . {{ overcloudrc }}; openstack image create --public --disk-format={{ browbeat_guest_images[item].type }} --container-format=bare {{ browbeat_guest_images[item].name }} < {{ home_dir }}/{{ browbeat_guest_images[item].name }}.{{ browbeat_guest_images[item].type }}
shell: |
. {{ overcloudrc }}
openstack image create --public --disk-format={{ browbeat_guest_images[item].type }} --container-format=bare {{ browbeat_guest_images[item].name }} < {{ home_dir }}/{{ browbeat_guest_images[item].name }}.{{ browbeat_guest_images[item].type }}
ignore_errors: true
when: "not browbeat_guest_images[item].convert_to_raw"
with_items: "{{ browbeat_guest_images }}"
- name: Upload raw image into cloud (Newton and Ocata versions)
shell: . {{ overcloudrc }}; openstack image create --public --disk-format=raw --container-format=bare {{ browbeat_guest_images[item].name }} < {{ home_dir }}/{{ browbeat_guest_images[item].name }}.raw
shell: |
. {{ overcloudrc }}
openstack image create --public --disk-format=raw --container-format=bare {{ browbeat_guest_images[item].name }} < {{ home_dir }}/{{ browbeat_guest_images[item].name }}.raw
ignore_errors: true
when: "browbeat_guest_images[item].convert_to_raw"
with_items: "{{ browbeat_guest_images }}"

View File

@ -15,13 +15,16 @@ from oslo_db import options as db_options
from browbeat_rally.db import models
from rally.common import cfg
from oslo_db.sqlalchemy import session as db_session
import os
CONF = cfg.CONF
# rally.conf always uses stack.sqlite database
username = os.getenv('USER')
# rally.conf always uses <username>.sqlite database
db_connection = "sqlite:///%s/%s.sqlite" % (tempfile.gettempdir(), username)
db_options.set_defaults(
CONF, connection="sqlite:///%s/stack.sqlite" % tempfile.gettempdir())
CONF, connection=db_connection)
def _create_facade_lazily():
@ -35,7 +38,7 @@ def get_engine():
# alternate way to create engine is
# from oslo_db.sqlalchemy import engines
# engine = engines.create_engine("sqlite:///%s/stack.sqlite" % tempfile.gettempdir())
# engine = engines.create_engine(db_connection)
def schema_create():
engine = get_engine()
metadata = schema.MetaData()

View File

@ -84,20 +84,20 @@
# as python package. This code can be used in browbeat rally plugins.
# Sqlalchemy giving errors when we run this extra DB code as rally plugin
# so we came up with this python package approach.
- name: install rally browbeat code
shell: |
source {{ rally_venv }}/bin/activate
pip install .
args:
executable: /bin/bash
chdir: "{{ role_path }}/files/browbeat-rally"
when: rhosp_version is version('13.0', '>=')
- block:
- name: Install rally browbeat code
shell: |
source {{ rally_venv }}/bin/activate
pip install .
args:
executable: /bin/bash
chdir: "{{ role_path }}/files/browbeat-rally"
- name: create lock table in rally db for dynamic workloads
shell: |
source {{ rally_venv }}/bin/activate
python {{ role_path }}/files/create_lock_table.py
when: rhosp_version is version('13.0', '>=')
- name: Create lock table in rally db for dynamic workloads
shell: |
source {{ rally_venv }}/bin/activate
python {{ role_path }}/files/create_lock_table.py
when: is_rhoso_deployment or rhosp_version is version('13.0', '>=')
- block:
- name: copy of stackrc
@ -140,13 +140,17 @@
- name: Setup rally deployment for overcloud
shell: . {{ rally_venv }}/bin/activate; . {{ overcloudrc }}; rally deployment create --fromenv --name overcloud
when: not is_rhoso_deployment
- name: Setup rally deployment for overcloud
shell: . {{ rally_venv }}/bin/activate; rally deployment create --file={{home_dir}}/.config/openstack/keystone-v3.json --name overcloud
when: is_rhoso_deployment
- name: Check Rally deployment for overcloud
shell: . {{ rally_venv }}/bin/activate; . {{ overcloudrc }}; rally deployment check
register: rally_deployment_check_overcloud
- name: Fail if Rally deployment cannot be verfied for overcloud
- name: Fail if Rally deployment cannot be verified for overcloud
fail:
msg: "Failed to verify that your deployment is ready to benchmark"
when: rally_deployment_check_overcloud.rc != 0