prototypes: xci: Add ability to use local repositories for testing
[releng.git] / prototypes / xci / playbooks / provision-vm-nodes.yml
1 ---
2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2017 Ericsson AB and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10 - hosts: localhost
11   connection: local
12   vars_files:
13     - ../var/{{ ansible_os_family }}.yml
14     - ../var/opnfv.yml
15   roles:
16     # using these roles here ensures that we can reuse this playbook in different context
17     - role: remove-folders
18     - { role: clone-repository, project: "opnfv/releng", repo: "{{ OPNFV_RELENG_GIT_URL }}", dest: "{{ OPNFV_RELENG_PATH }}", version: "{{ OPNFV_RELENG_VERSION }}" }
19     - { role: clone-repository, project: "opnfv/bifrost", repo: "{{ OPENSTACK_BIFROST_GIT_URL }}", dest: "{{ OPENSTACK_BIFROST_PATH }}", version: "{{ OPENSTACK_BIFROST_VERSION }}" }
20
21 - hosts: localhost
22   connection: local
23   gather_facts: false
24   vars_files:
25     - ../var/{{ ansible_os_family }}.yml
26     - ../var/opnfv.yml
27   tasks:
28     - name: Synchronize local development bifrost repository to XCI paths
29       # command module is much faster than the copy module
30       synchronize:
31         src: "{{ OPENSTACK_BIFROST_DEV_PATH }}"
32         dest: "{{ OPENSTACK_BIFROST_PATH }}"
33         recursive: yes
34         delete: yes
35       when:
36         - OPENSTACK_BIFROST_DEV_PATH != ""
37     - name: Synchronize local development releng repository to XCI paths
38       synchronize:
39         src: "{{ OPNFV_RELENG_DEV_PATH }}"
40         dest: "{{ OPNFV_RELENG_PATH }}"
41         recursive: yes
42         delete: yes
43       when:
44         - OPNFV_RELENG_DEV_PATH != ""
45
46 - hosts: localhost
47   connection: local
48   gather_facts: false
49   vars_files:
50     - ../var/{{ ansible_os_family }}.yml
51     - ../var/opnfv.yml
52   tasks:
53     - name: combine opnfv/releng and openstack/bifrost scripts/playbooks
54       copy:
55         src: "{{ OPNFV_RELENG_PATH }}/prototypes/bifrost/"
56         dest: "{{ OPENSTACK_BIFROST_PATH }}"
57
58 - hosts: localhost
59   connection: local
60   become: yes
61   vars_files:
62     - ../var/{{ ansible_os_family }}.yml
63     - ../var/opnfv.yml
64   tasks:
65     - name: destroy VM nodes created by previous deployment
66       command: "/bin/bash ./scripts/destroy-env.sh"
67       args:
68         chdir: "{{ OPENSTACK_BIFROST_PATH }}"
69
70 - hosts: localhost
71   connection: local
72   vars_files:
73     - ../var/{{ ansible_os_family }}.yml
74     - ../var/opnfv.yml
75   tasks:
76     - name: create and provision VM nodes for the flavor {{ XCI_FLAVOR }}
77       command: "/bin/bash ./scripts/bifrost-provision.sh"
78       args:
79         chdir: "{{ OPENSTACK_BIFROST_PATH }}"