Files
fedora-infra_ansible/roles/virthost/tasks/main.yml
Ryan Lerch 25391e95b7 ansiblelint fixes - fqcn[action-core] - package to ansible.builtin.package
Replaces many references to  package: with ansible.builtin.package

Signed-off-by: Ryan Lerch <rlerch@redhat.com>
2025-01-15 11:28:00 +10:00

74 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
ansible.builtin.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
ansible.builtin.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)
ansible.builtin.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)
ansible.builtin.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