diff --git a/defaults/main.yml b/defaults/main.yml index 34feb1a..452db12 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -54,13 +54,11 @@ rally_pip_packages: - pymysql - rally +# The inventory group where Rally will be installed. # This variable is used by the repo_build process to determine # which host group to check for members of before building the # pip packages required by this role. The value is picked up # by the py_pkgs lookup. rally_role_project_group: utility_all -# The inventory group where Rally will be installed -rally_host_group: rally_all - rally_config_overrides: {} diff --git a/tasks/database-setup.yml b/tasks/database-setup.yml index d6bfeaf..e3cc16a 100644 --- a/tasks/database-setup.yml +++ b/tasks/database-setup.yml @@ -22,3 +22,16 @@ command: "{{ rally_bin }}/rally-manage db create" when: - rally_deployment_list_result.stdout | search("Table 'rally.deployments' doesn't exist") + +- name: Check for existing Rally deployment + command: "{{ rally_bin }}/rally deployment list" + ignore_errors: true + register: rally_deployment_list_result + +- name: Setup the Rally deployment + shell: | + . /root/openrc + . {{ rally_bin }}/activate + {{ rally_bin }}/rally deployment create --fromenv --name=existing + when: + - rally_deployment_list_result.stdout | search("There are no deployments") diff --git a/tasks/main.yml b/tasks/main.yml index df3e51d..4ff33c9 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -37,6 +37,6 @@ - include: database-setup.yml when: - - inventory_hostname == groups[rally_host_group][0] + - inventory_hostname == groups[rally_role_project_group][0] tags: - rally-install diff --git a/tasks/post-install.yml b/tasks/post-install.yml index 50daedc..1babf06 100644 --- a/tasks/post-install.yml +++ b/tasks/post-install.yml @@ -22,15 +22,3 @@ mode: "0644" config_overrides: "{{ rally_config_overrides }}" config_type: "ini" - -- name: Check for existing Rally deployment - command: "{{ rally_bin }}/rally deployment list" - ignore_errors: true - register: rally_deployment_list_result - -- name: Setup the Rally deployment - shell: | - . /root/openrc - {{ rally_bin }}/rally deployment create --fromenv --name=existing - when: - - rally_deployment_list_result.stdout | search("There are no deployments") diff --git a/tests/inventory b/tests/inventory index 714078b..c9d52a8 100644 --- a/tests/inventory +++ b/tests/inventory @@ -20,5 +20,5 @@ galera_all [keystone_all] infra1 -[rally_all] +[utility_all] openstack1 \ No newline at end of file diff --git a/tests/test-functional-rally.yml b/tests/test-functional-rally.yml index 54a1b96..82c3982 100644 --- a/tests/test-functional-rally.yml +++ b/tests/test-functional-rally.yml @@ -14,15 +14,10 @@ # limitations under the License. - name: Run a Rally scenario to ensure proper install/config - hosts: rally_all + hosts: utility_all user: root gather_facts: false tasks: - - name: Create the deployment - shell: | - . /root/openrc - . {{ rally_bin }}/activate - {{ rally_bin }}/rally deployment create --fromenv --name=existing - name: Copy the rally scenario copy: src: "{{ playbook_dir }}/files/scenario.json" diff --git a/tests/test-install-rally.yml b/tests/test-install-rally.yml index 410266c..1710096 100644 --- a/tests/test-install-rally.yml +++ b/tests/test-install-rally.yml @@ -14,7 +14,7 @@ # limitations under the License. - name: Deploy Rally - hosts: rally_all + hosts: utility_all user: root gather_facts: true pre_tasks: @@ -26,7 +26,7 @@ name: "{{ rally_galera_database }}" state: "present" delegate_to: "10.100.100.2" - when: inventory_hostname == groups['rally_all'][0] + when: inventory_hostname == groups['utility_all'][0] - name: Grant access to the DB for the service mysql_user: login_user: "root" @@ -41,7 +41,7 @@ - "localhost" - "%" delegate_to: "10.100.100.2" - when: inventory_hostname == groups['rally_all'][0] + when: inventory_hostname == groups['utility_all'][0] roles: - role: "{{ rolename | basename }}" vars_files: