---
# 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: Deploy the cluster nodes
ansible.builtin.include_role:
name: kubeinit.kubeinit.kubeinit_libvirt
tasks_from: deploy_debian_guest.yml
public: yes
loop: "{{ groups['all_cluster_nodes'] }}"
loop_control:
loop_var: cluster_node
vars:
kubeinit_deployment_node_name: "{{ cluster_node }}"
kubeinit_deployment_delegate: "{{ hostvars[cluster_node].target }}"
when: kubeinit_cluster_nodes_deployed is not defined or not kubeinit_cluster_nodes_deployed
- name: Install controller requirements
ansible.builtin.package:
name: "{{ kubeinit_kid_controller_dependencies }}"
state: present
loop: "{{ groups['all_controller_nodes'] }}"
loop_control:
loop_var: controller_node
vars:
delegate_to: "{{ controller_node }}"
when: kubeinit_kid_controller_dependencies is defined
- name: Install compute nodes requirements
ansible.builtin.package:
name: "{{ kubeinit_kid_compute_dependencies }}"
state: present
loop: "{{ groups['all_compute_nodes'] | default([]) }}"
loop_control:
loop_var: compute_node
delegate_to: "{{ compute_node }}"
when: kubeinit_kid_compute_dependencies is defined
- name: Create kube directory
ansible.builtin.file:
path: ~/.kube
state: directory
mode: '0644'
delegate_to: "{{ kubeinit_provision_service_node }}"
- name: Touch a file
ansible.builtin.shell: |
touch ~/.kube/config
args:
executable: /bin/bash
register: _result
changed_when: "_result.rc == 0"
delegate_to: "{{ kubeinit_provision_service_node }}"