summaryrefslogtreecommitdiffstats
path: root/xci/playbooks/get-opnfv-scenario-requirements.yml
diff options
context:
space:
mode:
authorMarkos Chandras <mchandras@suse.de>2017-10-12 09:11:59 +0100
committerMarkos Chandras <mchandras@suse.de>2017-10-19 13:58:28 +0100
commit4c1be188401e8cf3aa7ff818f1e285756f2a4d7c (patch)
tree5f8f669b562700a59fc594cde28e80ccb97967ee /xci/playbooks/get-opnfv-scenario-requirements.yml
parenta3b26d9b48c04c51b15807184ace868294dbe7f9 (diff)
xci: Clone all XCI scenarios in advance similar to a-r-r
In order to plug the scenarios' roles properly, we need to have all roles physically present in advance. As such, add a opnfv-scenario-requirements.yml file which can be used to populate the roles directory with all the scenarios. Change-Id: I0cdadb63849e4565c31559817660d23217879053 Signed-off-by: Markos Chandras <mchandras@suse.de>
Diffstat (limited to 'xci/playbooks/get-opnfv-scenario-requirements.yml')
-rw-r--r--xci/playbooks/get-opnfv-scenario-requirements.yml61
1 files changed, 61 insertions, 0 deletions
diff --git a/xci/playbooks/get-opnfv-scenario-requirements.yml b/xci/playbooks/get-opnfv-scenario-requirements.yml
new file mode 100644
index 00000000..23aa1d41
--- /dev/null
+++ b/xci/playbooks/get-opnfv-scenario-requirements.yml
@@ -0,0 +1,61 @@
+---
+# Copyright 2016, Rackspace US, Inc.
+# Copyright 2017, SUSE LINUX GmbH.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+- name: Clone the scenario requirements
+ hosts: localhost
+ connection: local
+ gather_facts: true
+ tasks:
+ - name: Remove target directory
+ file:
+ path: "{{ item.path | default(scenario_path_default) + '/' + item.scenario }}"
+ state: absent
+ when:
+ - item.scm == "git" or item.scm is undefined
+ with_items: "{{ scenarios }}"
+
+ - name: Clone git repos (with git)
+ git:
+ repo: "{{ item.src }}"
+ dest: "{{ item.path | default(scenario_path_default) }}/{{ item.scenario | default(item.src | basename) }}"
+ version: "{{ item.version | default('master') }}"
+ refspec: "{{ item.refspec | default(omit) }}"
+ update: true
+ force: true
+ when:
+ - item.scm == "git" or item.scm is undefined
+ with_items: "{{ scenarios }}"
+ register: git_clone
+ until: git_clone | success
+ retries: "{{ git_clone_retries }}"
+ delay: "{{ git_clone_retry_delay }}"
+
+ - name: Plug in the roles to XCI
+ file:
+ state: link
+ src: "{{ item.path | default(scenario_path_default) }}/{{ item.scenario | default(item.src | basename) }}/{{ item.role }}"
+ dest: "{{ role_path_default }}/{{ item.scenario }}"
+ force: yes
+ with_items: "{{ scenarios }}"
+
+ vars:
+ ansible_python_interpreter: "/usr/bin/python"
+ scenarios: "{{ lookup('file', scenario_file) | from_yaml }}"
+ scenario_file: '../opnfv-scenario-requirements.yml'
+ scenario_path_default: "{{ lookup('env', 'XCI_PATH') }}/.cache/repos/scenarios"
+ role_path_default: "{{ playbook_dir }}/roles"
+ git_clone_retries: 2
+ git_clone_retry_delay: 5