Playbook #2

/root/kubeinit/ci/builds/6mbKNrxD/0/kubeinit/kubeinit/kubeinit-aux/kubeinit/playbook.yml

Report Status CLI Date Duration Controller User Versions Hosts Plays Tasks Results Files Records
31 Oct 2023 00:16:40 +0000 00:02:09.96 nyctea root Ansible 2.15.2 ara 1.6.1 (client), 1.6.1 (server) Python 3.11.4 2 6 348 347 23 1

File: /root/.ansible/collections/ansible_collections/kubeinit/kubeinit/roles/kubeinit_prepare/tasks/prepare_hypervisor.yml

---
# 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.

#
# Prepare the hypervisor
#

- name: Delegate to kubeinit_deployment_node_name (inventory_hostname)
  block:

    - name: Generate an OpenSSH keypair on kubeinit_deployment_node_name
      community.crypto.openssh_keypair:
        path: "~/.ssh/{{ hostvars['kubeinit-facts'].cluster_name }}_id_{{ hostvars['kubeinit-facts'].ssh_keytype }}"
        type: "{{ hostvars['kubeinit-facts'].ssh_keytype }}"
        comment: "{{ hostvars['kubeinit-facts'].cluster_name + ' ' + kubeinit_deployment_node_name }}"
        regenerate: 'never'
      register: _result_keypair

    - name: Create authorized_key from keypair
      ansible.builtin.set_fact:
        authorized_key: "{{ _result_keypair.public_key + ' ' + _result_keypair.comment }}"
      delegate_facts: true

    - name: Provision the libvirt services on the hypervisor
      ansible.builtin.include_role:
        name: kubeinit.kubeinit.kubeinit_libvirt
        public: true

  vars:
    kubeinit_deployment_node_name: "{{ inventory_hostname }}"
  delegate_to: "{{ kubeinit_deployment_node_name }}"