---
# 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: Prepare services and stop the deployment if required
block:
- name: Prepare services if needed
ansible.builtin.include_role:
name: kubeinit.kubeinit.kubeinit_services
tasks_from: prepare_services.yml
public: true
vars:
services_prepared: "{{ 'kubeinit_facts' in groups }}"
when: not services_prepared
- name: Stop the deployment if required
block:
- name: "Stop before 'task-post-deployment' when requested"
ansible.builtin.add_host:
name: "kubeinit-facts"
playbook_terminated: true
- name: End play
ansible.builtin.meta: end_play
when: kubeinit_stop_before_task is defined and kubeinit_stop_before_task == 'task-post-deployment'
tags: omit_from_grapher
- name: Delegate to distro role to run post-deployment tasks
ansible.builtin.include_role:
name: "kubeinit.kubeinit.{{ kubeinit_cluster_distro_role }}"
tasks_from: post_deployment_tasks.yml
public: true
- name: Gather hosts facts and stop the deployment if required
block:
- name: Add task-post-deployment to tasks_completed
ansible.builtin.add_host:
name: "kubeinit-facts"
tasks_completed: "{{ kubeinit_facts_hostvars.tasks_completed | union(['task-post-deployment']) }}"
- name: Update kubeinit_facts_hostvars
ansible.builtin.set_fact:
kubeinit_facts_hostvars: "{{ hostvars['kubeinit-facts'] }}"
- name: Stop the deployment if required
block:
- name: Stop after 'task-post-deployment' when requested
ansible.builtin.add_host:
name: "kubeinit-facts"
playbook_terminated: true
- name: End play
ansible.builtin.meta: end_play
when: kubeinit_stop_after_task is defined and kubeinit_stop_after_task in kubeinit_facts_hostvars.tasks_completed
tags: omit_from_grapher