Plug packaging into stack
[infra/stack/kubernetes.git] / playbooks / roles / package / tasks / prepare-packaging.yaml
1 ---
2 # ============LICENSE_START=======================================================
3 #  Copyright (C) 2019 The Nordix Foundation. All rights reserved.
4 # ================================================================================
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #      http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17 # SPDX-License-Identifier: Apache-2.0
18 # ============LICENSE_END=========================================================
19
20 - name: Ensure provisioner and installer folders exist and empty
21   file:
22     path: "{{ engine_path }}/engine/{{ item.path}}"
23     state: "{{ item.state }}"
24   with_items:
25     - {path: "{{ engine_path }}/engine/provisioner", state: absent}
26     - {path: "{{ engine_path }}/engine/provisioner", state: directory}
27     - {path: "{{ engine_path }}/engine/installer", state: absent}
28     - {path: "{{ engine_path }}/engine/installer", state: directory}
29
30 - name: Clone engine provisioner repositories
31   git:
32     repo: "{{ provisioners[provisioner.key].src }}"
33     dest: "{{ engine_path }}/engine/provisioner/{{ provisioner.key }}"
34     version: "{{ provisioners[provisioner.key].version }}"
35     refspec: "{{ provisioners[provisioner.key].refspec | default(omit) }}"
36     force: true
37   with_dict: "{{ provisioners }}"
38   loop_control:
39     loop_var: provisioner
40   environment:
41     http_proxy: "{{ lookup('env','http_proxy') }}"
42     https_proxy: "{{ lookup('env','https_proxy') }}"
43     no_proxy: "{{ lookup('env','no_proxy') }}"
44
45 - name: Copy engine provisioner vars file into group_vars
46   copy:
47     src: "{{ engine_path }}/engine/provisioner/{{ provisioner.key }}/vars/{{ provisioner.key }}.yaml"
48     dest: "{{ engine_path }}/engine/inventory/group_vars/all/{{ provisioner.key }}.yaml"
49     force: true
50   with_dict: "{{ provisioners }}"
51   loop_control:
52     loop_var: provisioner
53
54 - name: Clone engine installer repositories
55   git:
56     repo: "{{ installers[installer.key].src }}"
57     dest: "{{ engine_path }}/engine/installer/{{ installer.key }}"
58     version: "{{ installers[installer.key].version }}"
59     refspec: "{{ installers[installer.key].refspec | default(omit) }}"
60     force: true
61   with_dict: "{{ installers }}"
62   loop_control:
63     loop_var: installer
64   environment:
65     http_proxy: "{{ lookup('env','http_proxy') }}"
66     https_proxy: "{{ lookup('env','https_proxy') }}"
67     no_proxy: "{{ lookup('env','no_proxy') }}"
68
69 - name: Copy engine installer vars file into group_vars
70   copy:
71     src: "{{ engine_path }}/engine/installer/{{ installer.key }}/vars/{{ installer.key }}.yaml"
72     dest: "{{ engine_path }}/engine/inventory/group_vars/all/{{ installer.key }}.yaml"
73     force: true
74   with_dict: "{{ installers }}"
75   loop_control:
76     loop_var: installer
77
78 - name: Include vars from collected provisioners and installers vars files
79   include_vars:
80     dir: "{{ engine_path }}/engine/inventory/group_vars/all"
81
82 # vim: set ts=2 sw=2 expandtab: