Create workspace by ansible playbook 35/33535/3
authorYujun Zhang <zhang.yujunz@zte.com.cn>
Wed, 19 Apr 2017 14:03:52 +0000 (22:03 +0800)
committerYujun Zhang <zhang.yujunz@zte.com.cn>
Thu, 20 Apr 2017 03:50:52 +0000 (11:50 +0800)
Change-Id: Ia79353e686240c5915e40b8202d3fdc289df2158
Signed-off-by: Yujun Zhang <zhang.yujunz@zte.com.cn>
17 files changed:
.gitignore
resources/roles/qtip-bootstrap/defaults/main.yml [new file with mode: 0644]
resources/roles/qtip-bootstrap/files/fixtures/case.json [moved from tests/integration/fixtures/case.json with 100% similarity]
resources/roles/qtip-bootstrap/files/fixtures/pod.json [moved from tests/integration/fixtures/pod.json with 100% similarity]
resources/roles/qtip-bootstrap/files/fixtures/project.json [moved from tests/integration/fixtures/project.json with 100% similarity]
resources/roles/qtip-bootstrap/files/group_vars/all.yml [new file with mode: 0644]
resources/roles/qtip-bootstrap/files/host_vars/localhost.yml [new file with mode: 0644]
resources/roles/qtip-bootstrap/files/run.yml [moved from tests/integration/run.yaml with 100% similarity]
resources/roles/qtip-bootstrap/files/setup.yml [moved from tests/integration/setup.yaml with 100% similarity]
resources/roles/qtip-bootstrap/tasks/main.yml [new file with mode: 0644]
resources/roles/qtip-bootstrap/templates/ansible.cfg.j2 [new file with mode: 0644]
resources/roles/qtip-bootstrap/templates/hosts.j2 [moved from tests/integration/hosts.default with 62% similarity]
tests/integration/ansible.cfg
tests/integration/group_vars/all [deleted file]
tests/integration/host_vars/localhost [deleted file]
tests/integration/hosts [new file with mode: 0644]
tests/integration/workspace-create.yml [new file with mode: 0644]

index 298e4d8..fcd2894 100644 (file)
@@ -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 (file)
index 0000000..10e464e
--- /dev/null
@@ -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/resources/roles/qtip-bootstrap/files/group_vars/all.yml b/resources/roles/qtip-bootstrap/files/group_vars/all.yml
new file mode 100644 (file)
index 0000000..933cffe
--- /dev/null
@@ -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 (file)
index 0000000..66aa5d0
--- /dev/null
@@ -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/resources/roles/qtip-bootstrap/tasks/main.yml b/resources/roles/qtip-bootstrap/tasks/main.yml
new file mode 100644 (file)
index 0000000..96d6c7d
--- /dev/null
@@ -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 (file)
index 0000000..e7d76dd
--- /dev/null
@@ -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
similarity index 62%
rename from tests/integration/hosts.default
rename to resources/roles/qtip-bootstrap/templates/hosts.j2
index 6573972..c4b985b 100644 (file)
@@ -1,4 +1,3 @@
-fuel-master
-
-[local]
 localhost   ansible_connection=local
+
+{{ installer_master }}
index a94cad0..a11bd1a 100644 (file)
 
 # 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 (file)
index 251b142..0000000
+++ /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 (file)
index 76b53b7..0000000
+++ /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 (file)
index 0000000..2302eda
--- /dev/null
@@ -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 (file)
index 0000000..83e0fad
--- /dev/null
@@ -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 }