ansible/roles/virthost/tasks/main.yml
Kevin Fenzi c6e86b2d05 virthost: clean out a bunch of old rhel7 conditionals
Signed-off-by: Kevin Fenzi <kevin@scrye.com>
2024-02-20 13:06:37 -08:00

73 lines
2.4 KiB
YAML

---
# tasklist for setting up the virthost server.
- name: set selinux to enforcing
selinux: policy=targeted state=enforcing
# enable the advanced virt module
- name: enable the advanced virt module
copy:
dest: /etc/dnf/modules.d/virt.module
content: |
[virt]
name=virt
stream=av
profiles=
state=enabled
tags:
- virthost
when: ansible_distribution == 'RedHat' and ansible_distribution_major_version|int == 8
- name: install libvirt packages on virthost
package: name={{ item }} state=present
with_items:
- qemu-kvm
- libvirt
- virt-install
tags:
- packages
#
# 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
failed_when: false
tags:
- config
- nolvmetad
# Also kill the service with fire
- name: disable lvm2-lvmetad socket
service: name=lvm2-lvmetad.socket state=stopped enabled=no
check_mode: no
failed_when: false
tags:
- config
- nolvmetad
#
# 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 (x86_64)
copy: src=kvm_intel.conf dest=/etc/modprobe.d/kvm_intel.conf
when: nested == true and ansible_architecture == 'x86_64'
- name: setup nested virt on virthosts with nested=true variable (s390x)
copy: src=kvm.conf dest=/etc/modprobe.d/kvm.conf
when: nested == true and ansible_architecture == 's390x'
#
# On some hosts in the fedorainfracloud network we want to add some users to be able to manage
# their own vms.
- name: add copr user to some virthosts that will run copr builders
user: name=copr password_lock=true group=libvirt
when: copr_build_virthost
#
# Add the copr ssh key to the copr account
#
- name: Add the copr ssh key to the copr account
authorized_key: key="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeTO0ddXuhDZYM9HyM0a47aeV2yIVWhTpddrQ7/RAIs99XyrsicQLABzmdMBfiZnP0FnHBF/e+2xEkT8hHJpX6bX81jjvs2bb8KP18Nh8vaXI3QospWrRygpu1tjzqZT0Llh4ZVFscum8TrMw4VWXclzdDw6x7csCBjSttqq8F3iTJtQ9XM9/5tCAAOzGBKJrsGKV1CNIrfUo5CSzY+IUVIr8XJ93IB2ZQVASK34T/49egmrWlNB32fqAbDMC+XNmobgn6gO33Yq5Ly7Dk4kqTUx2TEaqDkZfhsVu0YcwV81bmqsltRvpj6bIXrEoMeav7nbuqKcPLTxWEY/2icePF" user=copr
when: copr_build_virthost