diff options
author | Yujun Zhang <zhang.yujunz@zte.com.cn> | 2017-04-19 22:03:52 +0800 |
---|---|---|
committer | Yujun Zhang <zhang.yujunz@zte.com.cn> | 2017-04-20 11:50:52 +0800 |
commit | 7455eb762165d336e81ca901885dc9b45fa7cced (patch) | |
tree | 0e605b59fc1b5cdc48d891636602139e663747f1 | |
parent | 5da68bf0911e12237a3484e4160f959933f26c9a (diff) |
Create workspace by ansible playbook
Change-Id: Ia79353e686240c5915e40b8202d3fdc289df2158
Signed-off-by: Yujun Zhang <zhang.yujunz@zte.com.cn>
17 files changed, 117 insertions, 41 deletions
@@ -76,8 +76,4 @@ ChangeLog # integration data /tests/integration/*.retry -/tests/integration/.cache -/tests/integration/dump -/tests/integration/hosts -/tests/integration/reports -/tests/integration/ssh.cfg +/tests/integration/*-workspace diff --git a/resources/roles/qtip-bootstrap/defaults/main.yml b/resources/roles/qtip-bootstrap/defaults/main.yml new file mode 100644 index 00000000..10e464e4 --- /dev/null +++ b/resources/roles/qtip-bootstrap/defaults/main.yml @@ -0,0 +1,14 @@ +############################################################################## +# Copyright (c) 2017 ZTE Corporation and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +installer: fuel +installer_master: fuel-master + +workspace: "./{{ installer }}-workspace" +qtip_package: ../.. diff --git a/tests/integration/fixtures/case.json b/resources/roles/qtip-bootstrap/files/fixtures/case.json index 22abc40f..22abc40f 100644 --- a/tests/integration/fixtures/case.json +++ b/resources/roles/qtip-bootstrap/files/fixtures/case.json diff --git a/tests/integration/fixtures/pod.json b/resources/roles/qtip-bootstrap/files/fixtures/pod.json index 654b5828..654b5828 100644 --- a/tests/integration/fixtures/pod.json +++ b/resources/roles/qtip-bootstrap/files/fixtures/pod.json diff --git a/tests/integration/fixtures/project.json b/resources/roles/qtip-bootstrap/files/fixtures/project.json index ecd03e83..ecd03e83 100644 --- a/tests/integration/fixtures/project.json +++ b/resources/roles/qtip-bootstrap/files/fixtures/project.json diff --git a/resources/roles/qtip-bootstrap/files/group_vars/all.yml b/resources/roles/qtip-bootstrap/files/group_vars/all.yml new file mode 100644 index 00000000..933cffe5 --- /dev/null +++ b/resources/roles/qtip-bootstrap/files/group_vars/all.yml @@ -0,0 +1,13 @@ +############################################################################## +# Copyright (c) 2017 ZTE Corporation and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +qtip_resources: ../../resources +qtip_reports: ./reports +qtip_fixtures: ./fixtures +qtip_dump: ./dump diff --git a/resources/roles/qtip-bootstrap/files/host_vars/localhost.yml b/resources/roles/qtip-bootstrap/files/host_vars/localhost.yml new file mode 100644 index 00000000..66aa5d0e --- /dev/null +++ b/resources/roles/qtip-bootstrap/files/host_vars/localhost.yml @@ -0,0 +1,16 @@ +############################################################################## +# Copyright (c) 2017 ZTE Corporation and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +testapi_url: http://localhost:8000/api/v1 +project_name: qtip +case_name: compute +pod_name: qtip-pod +installer: fuel +version: master +scenario: demo diff --git a/tests/integration/run.yaml b/resources/roles/qtip-bootstrap/files/run.yml index 696235c2..696235c2 100644 --- a/tests/integration/run.yaml +++ b/resources/roles/qtip-bootstrap/files/run.yml diff --git a/tests/integration/setup.yaml b/resources/roles/qtip-bootstrap/files/setup.yml index fed5e9d9..fed5e9d9 100644 --- a/tests/integration/setup.yaml +++ b/resources/roles/qtip-bootstrap/files/setup.yml diff --git a/resources/roles/qtip-bootstrap/tasks/main.yml b/resources/roles/qtip-bootstrap/tasks/main.yml new file mode 100644 index 00000000..96d6c7d8 --- /dev/null +++ b/resources/roles/qtip-bootstrap/tasks/main.yml @@ -0,0 +1,25 @@ +############################################################################## +# Copyright (c) 2017 ZTE Corporation and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +- name: copy initial files + synchronize: + src: "{{ item }}" + dest: "{{ workspace }}" + with_items: + - group_vars + - host_vars + - fixtures + +- name: generate default configuration + template: + src: "{{ item }}.j2" + dest: "{{ workspace }}/{{ item }}" + with_items: + - ansible.cfg + - hosts diff --git a/resources/roles/qtip-bootstrap/templates/ansible.cfg.j2 b/resources/roles/qtip-bootstrap/templates/ansible.cfg.j2 new file mode 100644 index 00000000..e7d76dd0 --- /dev/null +++ b/resources/roles/qtip-bootstrap/templates/ansible.cfg.j2 @@ -0,0 +1,30 @@ +# config file for ansible -- https://ansible.com/ +# =============================================== + +# nearly all parameters can be overridden in ansible-playbook +# or with command line flags. ansible will read ANSIBLE_CONFIG, +# ansible.cfg in the current working directory, .ansible.cfg in +# the home directory or /etc/ansible/ansible.cfg, whichever it +# finds first + +[defaults] + +# some basic default values... + +inventory = ./hosts +library = {{ qtip_package }}/qtip/ansible_library/ + +# set plugin path directories here, separate with colons +action_plugins = {{ qtip_package }}/qtip/ansible_library/plugins/action +#cache_plugins = /usr/share/ansible/plugins/cache +#callback_plugins = /usr/share/ansible/plugins/callback +#connection_plugins = /usr/share/ansible/plugins/connection +#lookup_plugins = /usr/share/ansible/plugins/lookup +#inventory_plugins = /usr/share/ansible/plugins/inventory +#vars_plugins = /usr/share/ansible/plugins/vars +filter_plugins = {{ qtip_package }}/qtip/ansible_library/plugins/filter +#test_plugins = /usr/share/ansible/plugins/test +#terminal_plugins = /usr/share/ansible/plugins/terminal +#strategy_plugins = /usr/share/ansible/plugins/strategy + +callback_whitelist = profile_tasks diff --git a/tests/integration/hosts.default b/resources/roles/qtip-bootstrap/templates/hosts.j2 index 65739726..c4b985b3 100644 --- a/tests/integration/hosts.default +++ b/resources/roles/qtip-bootstrap/templates/hosts.j2 @@ -1,4 +1,3 @@ -fuel-master - -[local] localhost ansible_connection=local + +{{ installer_master }} diff --git a/tests/integration/ansible.cfg b/tests/integration/ansible.cfg index a94cad0d..a11bd1af 100644 --- a/tests/integration/ansible.cfg +++ b/tests/integration/ansible.cfg @@ -11,24 +11,5 @@ # some basic default values... -inventory = ./hosts -library = ../../qtip/ansible_library/ - -# set plugin path directories here, separate with colons -action_plugins = ../../qtip/ansible_library/plugins/action -#cache_plugins = /usr/share/ansible/plugins/cache -#callback_plugins = /usr/share/ansible/plugins/callback -#connection_plugins = /usr/share/ansible/plugins/connection -#lookup_plugins = /usr/share/ansible/plugins/lookup -#inventory_plugins = /usr/share/ansible/plugins/inventory -#vars_plugins = /usr/share/ansible/plugins/vars -filter_plugins = ../../qtip/ansible_library/plugins/filter -#test_plugins = /usr/share/ansible/plugins/test -#terminal_plugins = /usr/share/ansible/plugins/terminal -#strategy_plugins = /usr/share/ansible/plugins/strategy - -callback_whitelist = profile_tasks - -[ssh_connection] - -ssh_args = -F ./ssh.cfg
\ No newline at end of file +inventory = hosts +roles_path = ../../resources/roles diff --git a/tests/integration/group_vars/all b/tests/integration/group_vars/all deleted file mode 100644 index 251b1420..00000000 --- a/tests/integration/group_vars/all +++ /dev/null @@ -1,5 +0,0 @@ -qtip_resources: ../../resources -qtip_reports: ./reports -qtip_fixtures: ./fixtures -qtip_dump: ./dump -qtip_cache: ./.cache diff --git a/tests/integration/host_vars/localhost b/tests/integration/host_vars/localhost deleted file mode 100644 index 76b53b79..00000000 --- a/tests/integration/host_vars/localhost +++ /dev/null @@ -1,7 +0,0 @@ -testapi_url: http://10.62.105.17:8711/api/v1 -project_name: qtip -case_name: compute -pod_name: qtip-pod -installer: fuel -version: master -scenario: demo diff --git a/tests/integration/hosts b/tests/integration/hosts new file mode 100644 index 00000000..2302edae --- /dev/null +++ b/tests/integration/hosts @@ -0,0 +1 @@ +localhost ansible_connection=local diff --git a/tests/integration/workspace-create.yml b/tests/integration/workspace-create.yml new file mode 100644 index 00000000..83e0fadd --- /dev/null +++ b/tests/integration/workspace-create.yml @@ -0,0 +1,13 @@ +############################################################################## +# Copyright (c) 2017 ZTE Corporation and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +--- +- hosts: localhost + roles: + - { role: qtip-bootstrap, installer: fuel } |