Skip to content

Ansible role to deploy a Fedora CoreOS or Red Hat CoreOS virtual machine into QEMU/KVM

License

Notifications You must be signed in to change notification settings

nccurry/libvirt_coreos_vm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libvirt_coreos_vm

An ansible role to deploy Fedora CoreOS and Red Hat CoreOS virtual machines into QEMU/KVM.

Requirements

This is tested on a host running the following

  • Ansible 2.9.6
  • Fedora 31
  • libvirtd 5.6.0

Role Variables

A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.

Variable Required Default Choices Comments
coreos_type no fedora fedora, redhat Type of CoreOS host to deploy
libvirt_domain_path no ${HOME}/documents/vms Directory path to deploy virtual machine
ignition_path yes Path to ignition 3.0.0 file. One of ignition_config or ignition_path is required.
ignition_config yes YAML definition of the ignition 3.0.0 configuration. One of ignition_config or ignition_path is required.
vm_name no coreos Alphanumeric virtual machine name
vm_mac no 52:54:00:7b:0a:16 QEMU/KVM MAC address
vm_cpus no 2 Number of CPU cores
vm_memory no 2048 Amount of memory in MiB
vm_disk_size no 20G Root disk size in GB. Must end in a single 'G'
vm_network_name no default QEMU/KVM network to deploy domain into
vm_network_bridge no virbr0 Host bridge to put virtual machine interface on
fedora_version no 31 When deploying Fedora CoreOS. Major Fedora version to use for QEMU/KVM libosprofile
fcos_stream no stable Stream to download Fedora CoreOS build from.
fcos_build no 31.20200310.3.0 Fedora CoreOS build number to download
redhat_version no 8.1 When deploying Red Hat CoreOS. Major Red Hat version to use for QEMU/KVM libosprofile
rhcos_build no 4.3.8 Red Hat CoreOS build number to download

Example Playbook

#!/usr/bin/env ansible-playbook
---
- name: Administer virtual machine
  hosts: localhost
  gather_facts: false
  tasks:
  - name: Deploy Fedora CoreOS virtual machine
    vars:
      coreos_type: fedora
      ignition_config:
        ignition:
          version: 3.0.0
        storage:
          files:
          - path: /etc/sysctl.d/11-lowports.conf
            contents:
              source: "data:,net.ipv4.ip_unprivileged_port_start=53"
        systemd:
          units:
          - name: coredns.service
            enabled: true
            contents: "{{ lookup('file', playbook_dir + '/../files/coredns.service') | replace('\n', '\\n') }}"
        passwd:
          users:
          - name: core
            sshAuthorizedKeys:
            - "{{ lookup('file', '/tmp/fcos.pub') }}"
      vm_name: coredns
      vm_mac: 52:54:00:7b:0a:17
      vm_cpus: 2
      vm_memory: 2048
      vm_disk_size: 20G
      vm_network_name: lab
      vm_network_bridge: virbr2
    import_role: 
      name: libvirt_coreos_vm

  - name: Deploy Red Hat CoreOS virtual machine
    vars:
      coreos_type: redhat
      ignition_path: /tmp/openshift/master.ign
      vm_name: ocp-master-1
      vm_mac: 52:54:00:7b:0a:16
      vm_cpus: 4
      vm_memory: 16938
      vm_disk_size: 120G
      vm_network_name: openshift
      vm_network_bridge: virbr0
    import_role: 
      name: libvirt_coreos_vm
...

License

See LICENSE

About

Ansible role to deploy a Fedora CoreOS or Red Hat CoreOS virtual machine into QEMU/KVM

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published