Introduce stack setup script
[infra/stack/kubernetes.git] / playbooks / roles / bootstrap-swconfig / tasks / main.yaml
index 46db541181f2b863868479fd9b8f135750e5760f..5f64622930ed63605e0174d8312f2aac7304dbbe 100644 (file)
 # SPDX-License-Identifier: Apache-2.0
 # ============LICENSE_END=========================================================
 
-- name: Set distribution
+- name: Set deploy scenario
   set_fact:
-    distro: "{{ ansible_distribution | lower }}{{ ansible_distribution_version | replace('.','') }}"
+    deploy_scenario: "{{ lookup('env', 'DEPLOY_SCENARIO') | default('k8-multus-plugins', true) }}"
+
+- name: Log deploy scenario to console
+  debug:
+    msg: 'Set deploy scenario to {{ deploy_scenario }}'
+
+- name: Fail if the deploy scenario is not valid for stack '{{ stack_type }}'
+  fail:
+    msg: "'{{ deploy_scenario }}' is not valid for stack '{{ stack_type }}'"
+  when: deploy_scenario not in scenarios
 
 - name: Log distribution to console
   debug:
     msg: "'{{ installer_type }}' is not a valid installer for stack '{{ stack_type }}'"
   when: installer_type not in installers
 
-- name: Log deploy scenario to console
-  debug:
-    msg: 'Set deploy scenario to {{ deploy_scenario }}'
-
-- name: Fail if the deploy scenario is not valid for stack '{{ stack_type }}'
-  fail:
-    msg: "'{{ deploy_scenario }}' is not valid for stack '{{ stack_type }}'"
-  when: deploy_scenario not in scenarios
 
 # NOTE (fdegir): as we determine things dynamically, we need to record variables in order
 # for them to become available subsequent tasks, roles, playbooks
@@ -74,7 +75,7 @@
     state: present
     create: true
     block: |
-      distro: "{{ distro }}"
+      deploy_scenario: "{{ deploy_scenario }}"
       provisioner_type: "{{ provisioner_type }}"
       installer_type: "{{ installer_type }}"
     marker: "# {mark} ANSIBLE MANAGED BLOCK engine-kubernetes"