-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eb8f79d
commit 3369a62
Showing
7 changed files
with
172 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,112 @@ | ||
--- | ||
# Install and launch a rally benchmark | ||
- name: Install rally result directory | ||
file: path=/root/rally_home state=directory owner=65500 | ||
- name: Install rally dependencies | ||
apt: name={{ item }} state=present | ||
with_items: | ||
- libpq-dev | ||
- libxml2-dev | ||
- libxslt1-dev | ||
# rally | ||
- build-essential | ||
- libssl-dev | ||
- libffi-dev | ||
# - python-virtualenv | ||
- python-netifaces | ||
- python-dev | ||
|
||
- name: Test whether the rally database has been initialized or not | ||
stat: path=/root/rally_home/.rally.sqlite | ||
register: sqlite | ||
# Note: apt: python-pymongo is too old for OSProfiler | ||
- name: Install python mongo client for OSProfiler | ||
pip: | ||
name: pymongo | ||
state: present | ||
|
||
# TODO: Do that in a virtualenv using ansible:pip virtualenv | ||
- name: Install custom Rally | ||
pip: | ||
name: "{{ rally_pip }}" | ||
state: present | ||
editable: false | ||
|
||
- name: Create Rally result directory | ||
file: path=/root/rally_home state=directory | ||
|
||
- name: Create Rally configuration directory | ||
file: path=/etc/rally state=directory | ||
|
||
- name: Build Rally configuration and set database to sqlite | ||
copy: | ||
content: "[database]\nconnection='sqlite:////root/rally_home/.rally.sqlite'" | ||
dest: /etc/rally/rally.conf | ||
|
||
- name: Initialize database | ||
when: not sqlite.stat.exists | ||
docker_container: | ||
name: "{{ 'database' | to_uuid }}" | ||
image: rallyforge/rally | ||
state: started | ||
volumes: | ||
- /root/rally_home:/home/rally | ||
command: rally-manage db create | ||
|
||
# NOTE(msimonin): without the pause | ||
# the file seems not to be synced in the next task. | ||
# Relaunching the play a second time is also a possible wokaround. | ||
- pause: seconds=1 | ||
command: rally-manage db recreate | ||
args: | ||
chdir: /root/rally_home | ||
|
||
- name: Test whether the rally deployment has been created or not | ||
command: docker run -v /root/rally_home:/home/rally rallyforge/rally rally deployment list | ||
register: deployment | ||
# NOTE: without the pause the file seems not to be synced in the next | ||
# task. Relaunching the play a second time is also a possible | ||
# wokaround. | ||
- pause: seconds=1 | ||
|
||
- name: Deploy discovery context | ||
when: "'discovery' not in deployment.stdout" | ||
docker_container: | ||
name: "{{ 'deployment' | to_uuid }}" | ||
image: rallyforge/rally | ||
state: started | ||
volumes: | ||
- /root/rally_home:/home/rally | ||
env: "{{ os_env }}" | ||
command: rally deployment create --fromenv --name=discovery | ||
command: rally deployment create --fromenv --name=discovery | ||
args: | ||
chdir: /root/rally_home | ||
environment: "{{ os_env }}" | ||
|
||
- name: Copy rally scenarios | ||
copy: src={{ bench.location }} dest=/root/rally_home/ owner=655500 | ||
copy: src="{{ bench.location }}" dest=/root/rally_home/ | ||
|
||
- name: debug | ||
debug: msg="rally task start {{ bench.location | basename }} --task-args '{{ bench.args }}'" | ||
|
||
# NOTE(msimonin): ansible 2.2.0 breaks the return value. | ||
# see https://github.com/BeyondTheClouds/enos/issues/41 | ||
- name: Run rally benchmark | ||
docker_container: | ||
name: "{{ bench.location | to_uuid }}" | ||
image: rallyforge/rally | ||
state: started | ||
volumes: | ||
- /root/rally_home:/home/rally | ||
command: rally task start {{ bench.location | basename }} --task-args '{{ bench.args }}' | ||
register: docker_output | ||
|
||
- name: Wait for the end of the test, this may take a while... | ||
command: "docker ps -q --filter id={{ docker_output.ansible_facts.ansible_docker_container.Id }}" | ||
register: finished | ||
until: finished.stdout == "" | ||
delay: 20 | ||
retries: 10000 | ||
|
||
- name: List available rally reports | ||
command: docker run -v /root/rally_home:/home/rally rallyforge/rally rally task list --uuids-only | ||
debug: msg="rally task start /root/rally_home/{{ bench.location | basename}} --task-args '{{ bench.args }}' {{ '--os-profile SECRET_KEY' if bench.osprofiler }}" | ||
|
||
- name: Run Rally benchmark | ||
command: rally task start {{ bench.location | basename }} --task-args '{{ bench.args }}' {{ '--os-profile SECRET_KEY' if bench.osprofiler }} | ||
args: | ||
chdir: /root/rally_home | ||
register: rally_output | ||
|
||
- name: Output of Rally execution | ||
debug: msg="{{ rally_output }}" | ||
|
||
- name: List available Rally reports | ||
command: rally task list --uuids-only | ||
args: | ||
chdir: /root/rally_home | ||
register: list | ||
|
||
# Download rally results only if there are some reports to get back | ||
- name: Generating rally reports (html) | ||
command: rally task report --tasks {{ list.stdout | replace('\n', ' ') }} --out rally-{{ bench.location | basename }}.html | ||
args: | ||
chdir: /root/rally_home | ||
when: list.stdout != "" | ||
|
||
- name: Generating rally reports | ||
command: docker run -v /root/rally_home:/home/rally rallyforge/rally rally task report --tasks {{ list.stdout | replace('\n', ' ') }} --out report.html | ||
- name: Generation rally reports (json) | ||
command: rally task report --tasks {{ list.stdout | replace('\n', ' ') }} --out rally-{{ bench.location | basename }}.json | ||
args: | ||
chdir: /root/rally_home | ||
when: list.stdout != "" | ||
|
||
- name: Get OSProfiler Trace Id | ||
shell: echo "{{ rally_output.stdout }}" | grep 'osprofiler trace show --html' | sed 's/osprofiler trace show --html //g' | ||
register: trace_id | ||
when: "{{ bench.osprofiler | bool }}" | ||
|
||
- name: Output of OSProfiler Trace ID | ||
debug: msg="OSProfiler Trace ID {{ trace_id.stdout_lines[0] }}" | ||
when: "{{ bench.osprofiler | bool }}" | ||
|
||
- name: Generating OSProfiler trace (json) | ||
command: osprofiler trace show --json --out trace-{{ bench.location | basename }}.json {{ trace_id.stdout_lines[0] }} | ||
args: | ||
chdir: /root/rally_home | ||
environment: "{{ os_env }}" | ||
when: "{{ bench.osprofiler | bool }}" | ||
|
||
- name: Generation OSprofiler trace (html) | ||
command: osprofiler trace show --html --out trace-{{ bench.location | basename }}.html {{ trace_id.stdout_lines[0] }} | ||
args: | ||
chdir: /root/rally_home | ||
environment: "{{ os_env }}" | ||
when: "{{ bench.osprofiler | bool }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,3 @@ | |
src: ips.txt.j2 | ||
dest: "{{ ips_file }}" | ||
delegate_to: localhost | ||
run_once: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.