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
9 # http://www.apache.org/licenses/LICENSE-2.0
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.
17 # SPDX-License-Identifier: Apache-2.0
18 # ============LICENSE_END=========================================================
20 - name: Set deploy scenario
22 deploy_scenario: "{{ lookup('env', 'DEPLOY_SCENARIO') | default('k8-multus-plugins', true) }}"
24 - name: Log deploy scenario to console
26 msg: 'Set deploy scenario to {{ deploy_scenario }}'
28 - name: Fail if the deploy scenario is not valid for stack '{{ stack_type }}'
30 msg: "'{{ deploy_scenario }}' is not valid for stack '{{ stack_type }}'"
31 when: deploy_scenario not in scenarios
33 - name: Log distribution to console
35 msg: 'Set distribution to {{ distro }}'
37 - name: Fail if distribution is not valid for stack '{{ stack_type }}'
39 msg: "'{{ distro }}' is not a valid distribution for stack '{{ stack_type }}'"
40 when: distro not in distros
42 - name: Set provisioner type
44 provisioner_type: "{{ details.type is defined | ternary('bifrost', 'heat') }}"
46 - name: Log provisioner type to console
48 msg: 'Set provisioner type to {{ provisioner_type }}'
50 - name: Fail if the selected provisioner is not valid for stack '{{ stack_type }}'
52 msg: "'{{ provisioner_type }}' is not a valid provisioner for stack '{{ stack_type }}'"
53 when: provisioner_type not in provisioners
55 - name: Set installer type
57 installer_type: 'kubespray'
58 when: deploy_scenario is search('k8-')
60 - name: Log installer type to console
62 msg: 'Set installer type to {{ installer_type }}'
64 - name: Fail if the selected installer is not valid for stack '{{ stack_type }}'
66 msg: "'{{ installer_type }}' is not a valid installer for stack '{{ stack_type }}'"
67 when: installer_type not in installers
70 # NOTE (fdegir): as we determine things dynamically, we need to record variables in order
71 # for them to become available subsequent tasks, roles, playbooks
72 - name: Record deployment variables to deployment variables file
74 path: "{{ deployment_vars_file }}"
78 deploy_scenario: "{{ deploy_scenario }}"
79 provisioner_type: "{{ provisioner_type }}"
80 installer_type: "{{ installer_type }}"
81 marker: "# {mark} ANSIBLE MANAGED BLOCK engine-kubernetes"
83 - name: Reload deployment variables
84 include_vars: "{{ deployment_vars_file }}"
86 # NOTE (fdegir): Prepare provisioner and installer
87 - name: Prepare provisioner and installer for {{ execution_mode }}
88 include_tasks: "configure-{{ execution_mode }}.yaml"
90 # vim: set ts=2 sw=2 expandtab: