gwerlas.libvirt

Libvirt

管道状态

安装、配置和管理libvirt资源。

GitLab项目 : yoanncolin/ansible/roles/libvirt

要求

Linux基础系统需配置以下内容:

  • SSH
  • Python(用于Ansible)
  • Sudo
  • 可用的包管理器
  • 为EL7发行版安装EPEL

gwerlas.system角色可以帮助您:

ansible-galaxy install gwerlas.system
- name: 我的剧本
  hosts: all
  roles:
    - role: gwerlas.system
    - role: gwerlas.libvirt

事实

此角色定义的事实:

  • libvirt_packages

您可以仅获取事实,而不对节点进行任何更改:

- name: 我的剧本
  hosts: all
  tasks:
    - name: 获取事实
      ansible.builtin.import_role:
        name: gwerlas.libvirt
        tasks_from: facts

    - name: 显示
      ansible.builtin.debug:
        var: libvirt_packages

标签

您可以使用以下标签对特定任务进行过滤:

  • provision : 仅配置资源

角色变量

可用的变量列在下面,并提供默认值 (参见 defaults/main/*.yml):

依赖性

确保在系统上安装了 community.libvirt,或在您的 requirements.yml中存在。

示例剧本

安装和配置libvirt的示例方式:

- name: Libvirt
  hosts: all
  roles:
    - name: gwerlas.libvirt

配置一些资源:

- name: Libvirt
  hosts: all
  tasks:
    - name: 仅配置一些资源
      ansible.builtin.import_role:
        name: gwerlas.libvirt
        tasks_from: provision
      vars:
        libvirt_networks:
          - name: my-bridge
            forward:
              mode: bridge
            bridge:
              name: br0
          - name: my-nat
            bridge:
              name: br1
            ip:
              address: 192.168.0.1
              netmask: 255.255.255.0
              dhcp:
                start: 192.168.0.2
                end: 192.168.0.254
        libvirt_pools:
          - name: local-dir
            path: /data/images
          - name: from-nfs
            type: netfs
            path: /data/images
            source:
              host: hostname
              dir: /server-export
        libvirt_domains:
          - name: my-node
            autostart: false
            cpu:
              mode: host-passthrough
              model:
                fallback: allow
            memory: 4G
            networks:
              - name: my-bridge
              - name: my-nat
            vcpu:
              placement: static
              quantity: 2
            volumes:
              - name: os
              - name: data
                size: 200G
                device: vdb
                pool: data-dir

许可证

BSD 3-Clause License

关于项目

Install, configure and provision libvirt resources

安装
ansible-galaxy install gwerlas.libvirt
许可证
bsd-3-clause
下载
2.3k
拥有者
DevOps Engineer