110 lines
3.4 KiB
YAML
110 lines
3.4 KiB
YAML
---
|
|
# tasklist for setting up the virthost server.
|
|
|
|
- name: set selinux to enforcing
|
|
selinux: policy=targeted state=enforcing
|
|
|
|
- name: install libvirt packages on rhel6 virthosts
|
|
yum: pkg={{ item }} state=present
|
|
with_items:
|
|
- qemu-kvm
|
|
- libvirt
|
|
- python-virtinst
|
|
tags:
|
|
- packages
|
|
when: ansible_distribution == 'RedHat' and ansible_distribution_major_version|int == 6
|
|
|
|
- name: install openstack 7 repo file
|
|
copy: src=rhel7-os.repo dest=/etc/yum.repos.d/rhel7-os.repo
|
|
tags:
|
|
- repos
|
|
- rhel7-os-repo
|
|
when: ansible_distribution == 'RedHat' and ansible_distribution_major_version|int == 7 and ansible_architecture == 'x86_64'
|
|
|
|
- name: install RHEV/ppc64le for el7 repo file
|
|
copy: src=rhel7-rhev-ppc64le.repo dest=/etc/yum.repos.d/rhel7-rhev-ppc64le.repo
|
|
tags:
|
|
- repos
|
|
- rhel7-rhev-ppc64le
|
|
when: ansible_distribution == 'RedHat' and ansible_distribution_major_version|int == 7 and ansible_architecture == 'ppc64le'
|
|
|
|
- name: install RHEV/aarch64 for el7 repo file
|
|
copy: src=rhel7-rhev-aarch64.repo dest=/etc/yum.repos.d/rhel7-rhev-aarch64.repo
|
|
tags:
|
|
- repos
|
|
- rhel7-rhev-aarch64
|
|
when: ansible_distribution == 'RedHat' and ansible_distribution_major_version|int == 7 and ansible_architecture == 'aarch64'
|
|
|
|
- name: install libvirt packages on rhel7 virthosts
|
|
yum: pkg={{ item }} state=present
|
|
with_items:
|
|
- qemu-kvm-rhev
|
|
- qemu-kvm-tools-rhev
|
|
- qemu-img-rhev
|
|
- libvirt
|
|
- virt-install
|
|
tags:
|
|
- packages
|
|
when: ansible_distribution == 'RedHat' and ansible_distribution_major_version|int == 7
|
|
|
|
- name: install AAVMF uEFI tianocore on aarch64 rhel7 virthosts
|
|
yum: pkg={{ item }} state=present
|
|
with_items:
|
|
- AAVMF
|
|
tags:
|
|
- packages
|
|
when: ansible_distribution == 'RedHat' and ansible_distribution_major_version|int == 7 and ansible_architecture == 'aarch64'
|
|
|
|
- name: install libguestfs-tools for ARMv7 VMs on aarch64 rhel7 virthosts
|
|
yum: pkg={{ item }} state=present
|
|
with_items:
|
|
- libguestfs-tools-c
|
|
tags:
|
|
- packages
|
|
when: ansible_distribution == 'RedHat' and ansible_distribution_major_version|int == 7 and ansible_architecture == 'aarch64'
|
|
|
|
# install libvirtd.conf
|
|
#
|
|
# This provides us with the ability to use virt-manager from non root accounts.
|
|
#
|
|
- name: install libvirtd.conf
|
|
copy: src="{{ files }}/virthost/libvirtd.conf" dest=/etc/libvirt/libvirtd.conf
|
|
notify:
|
|
- restart libvirtd
|
|
tags:
|
|
- config
|
|
|
|
- name: enable libvirtd
|
|
service: name=libvirtd state=started enabled=yes
|
|
|
|
#
|
|
# Disable lvmetad as it causes lots of problems with iscsi shared lvm and caching.
|
|
#
|
|
- name: disable lvmetad
|
|
lineinfile: dest=/etc/lvm/lvm.conf regexp="^(.*)use_lvmetad = 1" line="\1use_lvmetad = 0" backrefs=yes
|
|
tags:
|
|
- config
|
|
- nolvmetad
|
|
|
|
# Also kill the service with fire
|
|
- name: disable lvm2-lvmetad service
|
|
service: name=lvm2-lvmetad state=stopped enabled=no
|
|
tags:
|
|
- config
|
|
- nolvmetad
|
|
|
|
- name: set bridging to work right -
|
|
copy: src="{{ files }}/virthost/99-bridge.rules" dest=/etc/udev/rules.d/99-bridge.rules
|
|
notify:
|
|
- restart bridge
|
|
tags:
|
|
- config
|
|
when: ansible_distribution == 'RedHat' and ansible_distribution_major_version|int == 7
|
|
|
|
#
|
|
# Some virthosts we want to use nested virt (a tech preview in rhel 7.2)
|
|
# We need this module option set and then need to tweak the libvirt xml to enable it
|
|
#
|
|
- name: setup nested virt on virthosts with nested=true variable
|
|
copy: src=kvm_intel.conf dest=/etc/modprobe.d/kvm_intel.conf
|
|
when: nested == true
|