Giter Club home page Giter Club logo

ansible-role-virt_install_import's Introduction

Ansible Role: virt_install_import

An ansible role to import virtual machine with the virt-install import command

Requirements

This role depends on the virt-install command. The role will install the required packages on most GNU/Linux distributions.

Supported GNU/Linux Distributions

  • Archlinux
  • AlmaLinux
  • Debian
  • Centos
  • Fedora
  • RedHat
  • Rocky
  • Suse
  • Ubuntu

Role tasks, tags variables and templates

Tasks

  • install

    All installation-related tasks are defined in the install playbook. This allows you to install the required packages and start/enable the required service with tasks_from in the include_role, import_role, โ€ฆ ansible modules.

    See example below.

Tags

  • install

    Install the required packages.

Playbook related variables

  • virt_install_import: "namespace"
    • name: required. The name of the virtual machine
    • autostart: optional default: true. Enable autostart.
    • wait: optional default: 0. The --wait option for the virt-install command. A negative value will wait still the virtmachine is shutdown. 0 will just start the virtual machine and disconnect.
    • memory: optional, default 1024 The virtual machine memory
    • vcpu: optional, default 1. The number of virtual cpu cores.
    • virt_type: optional, default: kvm. The hypervisor type.
    • graphics: optional, default: none. The graphical display configuration.
    • os_type: optional, default: not defined. The operating system type.
    • os_variant: optional, default: not defined. The operating system variant.
    • network: optional, default: not defined. The network string
    • disks: optional, default: not defined. The disk strings.

Dependencies

None

Example Playbooks

Install the virt-install packages with include_role

---
- name: Install libvirt & co
  gather_facts: true 
  hosts: all
  become: true
  tasks:
    - name: Install the requirements
      include_role:
        name: "{{ item }}"
        tasks_from:
          install
      with_items:
        - stafwag.libvirt 
        - stafwag.qemu_img
        - stafwag.cloud_localds
        - stafwag.virt_install_import
      tags:
        - install

Import a virtual machine

---
- name: Import a virtual machine
  gather_facts: no 
  become: true
  hosts: localhost
  roles:
    - role: stafwag.virt_install_import
      vars:
        virt_install_import:
          wait: -1
          name: tstdebian2
          os_type: Linux
          os_variant: debian10
          network: network:default
          graphics: spice
          disks:
            - /var/lib/libvirt/images/tstdebian2.qcow2,device=disk
            - /var/lib/libvirt/images/tstdebian2_cloudinit.iso,device=cdrom

License

MIT/BSD

Author Information

Created by Staf Wagemakers, email: [email protected], website: http://www.wagemakers.be.

ansible-role-virt_install_import's People

Contributors

stafwag avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.