Playbook #1

/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
29 Oct 2023 10:04:38 +0000 00:25:53.67 nyctea root Ansible 2.15.2 ara 1.6.1 (client), 1.6.1 (server) Python 3.11.4 5 9 822 822 48 1

File: /root/.ansible/collections/ansible_collections/kubeinit/kubeinit/roles/kubeinit_libvirt/tasks/deploy_coreos_guest.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.

- name: Deploy a CoreOS guest for OKD
  block:

    - name: Remove old disk images
      ansible.builtin.file:
        path: "{{ kubeinit_libvirt_target_image_dir }}/{{ hostvars[kubeinit_deployment_node_name].guest_name }}.qcow2"
        state: absent

    - name: "Create VM definition for {{ kubeinit_deployment_node_name }}"
      ansible.builtin.shell: |
        set -o pipefail
        kernel_args='initrd=http://{{ kubeinit_apache_service_address }}:8080/kubeinit/okd4/{{ kubeinit_coreos_initrd }} ip=dhcp nameserver={{ kubeinit_bind_service_address }} rd.neednet=1 console=tty0 console=ttyS0 coreos.inst=yes coreos.inst.insecure=yes coreos.inst.install_dev=/dev/vda coreos.inst.image_url=http://{{ kubeinit_apache_service_address }}:8080/kubeinit/okd4/{{ kubeinit_coreos_raw }} coreos.inst.ignition_url=http://{{ kubeinit_apache_service_address }}:8080/kubeinit/okd4/{{ kubeinit_ignition_name }}.ign coreos.live.rootfs_url=http://{{ kubeinit_apache_service_address }}:8080/kubeinit/okd4/{{ kubeinit_coreos_rootfs }}'
        virt-install \
            --connect qemu:///system \
            --name={{ hostvars[kubeinit_deployment_node_name].guest_name }} \
            --memory memory={{ hostvars[kubeinit_deployment_node_name].ram|int // 1024 }} \
            --vcpus={{ hostvars[kubeinit_deployment_node_name].vcpus }},maxvcpus={{ hostvars[kubeinit_deployment_node_name].maxvcpus }} \
            --os-variant=fedora29 \
            --autostart \
            --network network={{ kubeinit_cluster_hostvars.network_name }},mac={{ hostvars[kubeinit_deployment_node_name].mac }},virtualport.parameters.interfaceid={{ hostvars[kubeinit_deployment_node_name].interfaceid }},target.dev=veth0-{{ hostvars[kubeinit_deployment_node_name].ansible_host | ansible.utils.ip4_hex }},model=virtio \
            --disk {{ kubeinit_libvirt_target_image_dir }}/{{ hostvars[kubeinit_deployment_node_name].guest_name }}.qcow2,format=qcow2,bus=virtio,size={{ hostvars[kubeinit_deployment_node_name].disk | replace('G','') }},readonly=false \
            --location {{ kubeinit_libvirt_target_image_dir }}/ \
            --extra-args "${kernel_args}"
      args:
        executable: /bin/bash
      register: _result
      changed_when: "_result.rc == 0"

    - name: "Wait until is running {{ kubeinit_deployment_node_name }}"
      community.libvirt.virt:
        command: list_vms
        state: running
      register: _result
      retries: 30
      delay: 10
      until: hostvars[kubeinit_deployment_node_name].guest_name in _result.list_vms

  delegate_to: "{{ hostvars[kubeinit_deployment_node_name].target }}"

- name: Check cluster nodes are up and running
  ansible.builtin.include_tasks: 70_check_nodes_up.yml
  vars:
    _param_guest_user: 'core'
    _param_request_ping: false