---
- name: Record useful files and variables to the deployment
hosts: localhost
tasks:
# Relative to the kubeinit folder
- name: Record deployment extra information
ara_record:
key: extra_information
value: "{{ lookup('file', './aux_info_file.txt') }}"
type: text
- name: Record useful files and variables to the deployment
hosts: localhost
tasks:
# Relative to the kubeinit folder
- name: Record deployment extra information
ara_record:
key: extra_information
value: "{{ lookup('file', './aux_info_file.txt') }}"
type: text
- name: Record useful files and variables to the deployment
hosts: localhost
tasks:
# Relative to the kubeinit folder
- name: Record deployment extra information
ara_record:
key: extra_information
value: "{{ lookup('file', './aux_info_file.txt') }}"
type: text
- name: Record useful files and variables to the deployment
hosts: localhost
tasks:
# Relative to the kubeinit folder
- name: Record deployment extra information
ara_record:
key: extra_information
value: "{{ lookup('file', './aux_info_file.txt') }}"
type: text
- name: Record useful files and variables to the deployment
hosts: localhost
tasks:
# Relative to the kubeinit folder
- name: Record deployment extra information
ara_record:
key: extra_information
value: "{{ lookup('file', './aux_info_file.txt') }}"
type: text
# Copyright kubeinit contributors
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
- name: Perform initial setup on ansible-controller host (localhost)
hosts: localhost
become: false
gather_subset: "!all,network"
gather_facts: true
pre_tasks:
- name: Check if Ansible meets version requirements.
tags: task_gather_facts
ansible.builtin.assert:
that: "ansible_version.full is version_compare('{{ kubeinit_ansible_min_version }}', '>=')"
msg: >
"You must update Ansible to at least {{ kubeinit_ansible_min_version }} to use KubeInit."
vars:
kubeinit_ansible_min_version: 2.9
tasks:
- name: Determine which hypervisor hosts will be used in this deployment
tags: task_gather_facts
delegate_facts: true
block:
- name: task-gather-facts
ansible.builtin.include_role:
name: kubeinit.kubeinit.kubeinit_prepare
tasks_from: build_hypervisors_group.yml
public: true
- name: Gather facts from the cluster hypervisor hosts
hosts: kubeinit_hypervisors
become: false
gather_subset: "!all,network"
gather_facts: true
tasks:
- name: Skip play if playbook_terminated
ansible.builtin.meta: end_play
when: hostvars['kubeinit-facts'].playbook_terminated | default(false)
tags:
- omit_from_grapher
- task_gather_facts
run_once: true
- name: Gather additional hypervisor facts kubeinit will use during deployment
tags: task_gather_facts
delegate_facts: true
block:
- name: Gather facts from each hypervisor in the deployment
ansible.builtin.include_role:
name: kubeinit.kubeinit.kubeinit_libvirt
tasks_from: gather_host_facts.yml
public: true
vars:
_param_gather_host: "{{ inventory_hostname }}"
- name: Determine facts needed to prepare all hypervisor hosts
hosts: localhost
become: false
gather_facts: false
tasks:
- name: Skip play if playbook_terminated
ansible.builtin.meta: end_play
when: hostvars['kubeinit-facts'].playbook_terminated | default(false)
tags: omit_from_grapher
- name: Gather kubeinit facts
tags: task_gather_facts
delegate_facts: true
block:
- name: Gather facts to prepare the cluster hypervisors
ansible.builtin.include_role:
name: kubeinit.kubeinit.kubeinit_prepare
tasks_from: gather_kubeinit_facts.yml
public: true
- name: Prepare the hypervisors
tags: task_prepare_hypervisors
block:
- name: task-prepare-hypervisors
ansible.builtin.include_role:
name: kubeinit.kubeinit.kubeinit_prepare
tasks_from: prepare_hypervisors.yml
public: true
- name: Prepare the infrastructure to deploy service and cluster nodes
hosts: kubeinit_hypervisors
gather_facts: false
tasks:
- name: Skip play if playbook_terminated
ansible.builtin.meta: end_play
when: hostvars['kubeinit-facts'].playbook_terminated | default(false)
tags: omit_from_grapher
run_once: true
- name: Prepare individual hypervisors
tags: task_prepare_hypervisors
block:
- name: Set kubeinit_cluster_name fact
ansible.builtin.set_fact:
kubeinit_cluster_name: "{{ hostvars['kubeinit-facts'].cluster_name }}"
kubeinit_ssh_keytype: "{{ hostvars['kubeinit-facts'].ssh_keytype }}"
delegate_facts: true
- name: Prepare each hypervisor in the deployment
ansible.builtin.include_role:
name: kubeinit.kubeinit.kubeinit_prepare
tasks_from: prepare_hypervisor.yml
public: true
- name: Run the deployment on the target infrastructure (OpenStack/libvirt hypervisors)
hosts: localhost
become: false
gather_facts: false
tasks:
- name: Skip play if playbook_terminated
ansible.builtin.meta: end_play
when: hostvars['kubeinit-facts'].playbook_terminated | default(false)
tags: omit_from_grapher
- name: Prepare the environment
tags: task_prepare_environment
block:
- name: task-prepare-environment
ansible.builtin.include_role:
name: kubeinit.kubeinit.kubeinit_prepare
public: true
- name: Cleanup hypervisors
tags: task_cleanup_hypervisors
block:
- name: task-cleanup-hypervisors
ansible.builtin.include_role:
name: kubeinit.kubeinit.kubeinit_libvirt
tasks_from: cleanup_hypervisors.yml
public: true
- name: Run validations on cluster resources
tags: task_run_validations
block:
- name: task-run-validations
ansible.builtin.include_role:
name: kubeinit.kubeinit.kubeinit_validations
public: true
- name: Create the cluster network resources
tags: task_create_network
block:
- name: task-create-network
ansible.builtin.include_role:
name: kubeinit.kubeinit.kubeinit_libvirt
tasks_from: create_network.yml
public: true
- name: Create services the cluster will need
tags: task_create_services
block:
- name: task-create-services
ansible.builtin.include_role:
name: kubeinit.kubeinit.kubeinit_services
public: true
- name: Prepare to deploy the cluster
tags: task_prepare_cluster
block:
- name: task-prepare-cluster
ansible.builtin.include_role:
name: kubeinit.kubeinit.kubeinit_prepare
tasks_from: prepare_cluster.yml
public: true
- name: Download cloud images
tags: task_download_images
block:
- name: task-download-images
ansible.builtin.include_role:
name: kubeinit.kubeinit.kubeinit_libvirt
tasks_from: download_cloud_images.yml
public: true
- name: Deploy the cluster
tags: task_deploy_cluster
block:
- name: task-deploy-cluster
ansible.builtin.include_role:
name: kubeinit.kubeinit.kubeinit_prepare
tasks_from: deploy_cluster.yml
public: true
- name: Run any post-deployment tasks
tags: task_post_deployment
block:
- name: task-post-deployment
ansible.builtin.include_role:
name: kubeinit.kubeinit.kubeinit_prepare
tasks_from: post_deployment.yml
public: true