Define an extra vars path and copy into playbooks
[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     - name: Copy extra vars to releng and bifrost
46       synchronize:
47         src: "{{ XCI_EXTRA_VARS_PATH }}"
48         dest: "{{ item }}"
49       with_items:
50         - "{{ OPNFV_RELENG_PATH }}/prototypes/xci/playbooks"
51         - "{{ OPENSTACK_BIFROST_PATH }}/playbooks/inventory"
52       when:
53         - XCI_EXTRA_VARS_PATH != ""
54
55 - hosts: localhost
56   connection: local
57   gather_facts: false
58   vars_files:
59     - ../var/{{ ansible_os_family }}.yml
60     - ../var/opnfv.yml
61   tasks:
62     - name: combine opnfv/releng and openstack/bifrost scripts/playbooks
63       copy:
64         src: "{{ OPNFV_RELENG_PATH }}/prototypes/bifrost/"
65         dest: "{{ OPENSTACK_BIFROST_PATH }}"
66
67 - hosts: localhost
68   connection: local
69   become: yes
70   vars_files:
71     - ../var/{{ ansible_os_family }}.yml
72     - ../var/opnfv.yml
73   tasks:
74     - name: destroy VM nodes created by previous deployment
75       command: "/bin/bash ./scripts/destroy-env.sh"
76       args:
77         chdir: "{{ OPENSTACK_BIFROST_PATH }}"
78
79 - hosts: localhost
80   connection: local
81   vars_files:
82     - ../var/{{ ansible_os_family }}.yml
83     - ../var/opnfv.yml
84   tasks:
85     - name: create and provision VM nodes for the flavor {{ XCI_FLAVOR }}
86       command: "/bin/bash ./scripts/bifrost-provision.sh"
87       args:
88         chdir: "{{ OPENSTACK_BIFROST_PATH }}"