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 distribution
22 distro: "{{ ansible_distribution | lower }}{{ ansible_distribution_version | replace('.','') }}"
24 - name: Log distribution to console
26 msg: 'Set distribution to {{ distro }}'
28 - name: Fail if distribution is not valid for stack '{{ stack_type }}'
30 msg: "'{{ distro }}' is not a valid distribution for stack '{{ stack_type }}'"
31 when: distro not in distros
33 - name: Set provisioner type
35 provisioner_type: "{{ details.type is defined | ternary('bifrost', 'heat') }}"
37 - name: Log provisioner type to console
39 msg: 'Set provisioner type to {{ provisioner_type }}'
41 - name: Fail if the selected provisioner is not valid for stack '{{ stack_type }}'
43 msg: "'{{ provisioner_type }}' is not a valid provisioner for stack '{{ stack_type }}'"
44 when: provisioner_type not in provisioners
46 - name: Set installer type
48 installer_type: 'kubespray'
49 when: deploy_scenario is search('k8-')
51 - name: Log installer type to console
53 msg: 'Set installer type to {{ installer_type }}'
55 - name: Fail if the selected installer is not valid for stack '{{ stack_type }}'
57 msg: "'{{ installer_type }}' is not a valid installer for stack '{{ stack_type }}'"
58 when: installer_type not in installers
60 - name: Log deploy scenario to console
62 msg: 'Set deploy scenario to {{ deploy_scenario }}'
64 - name: Fail if the deploy scenario is not valid for stack '{{ stack_type }}'
66 msg: "'{{ deploy_scenario }}' is not valid for stack '{{ stack_type }}'"
67 when: deploy_scenario not in scenarios
69 # NOTE (fdegir): as we determine things dynamically, we need to record variables in order
70 # for them to become available subsequent tasks, roles, playbooks
71 - name: Record deployment variables to deployment variables file
73 path: "{{ deployment_vars_file }}"
77 distro: "{{ distro }}"
78 provisioner_type: "{{ provisioner_type }}"
79 installer_type: "{{ installer_type }}"
80 marker: "# {mark} ANSIBLE MANAGED BLOCK engine-kubernetes"
82 - name: Reload deployment variables
83 include_vars: "{{ deployment_vars_file }}"
85 # NOTE (fdegir): Prepare provisioner and installer
86 - name: Prepare provisioner and installer for '{{ execution_mode }}'
87 include_tasks: "configure-{{ execution_mode }}.yaml"
89 # vim: set ts=2 sw=2 expandtab: