--- # file: roles/kvm/tasks/main.yml - name: Ensure management group exists group: name: "{{ kvm_management_group }}" state: present - name: Add manager users to management group user: name: "{{ item }}" groups: "{{ kvm_management_group }}" append: yes when: kvm_manager_accounts is defined loop: "{{ kvm_manager_accounts }}" - name: Install packages package: name: - qemu-kvm - libvirt - virt-install - virt-viewer state: latest - name: "Start and enable kvm services" service: name: "{{ item }}" state: started enabled: yes loop: "{{ kvm_services }}" - name: Install tuned package: name: tuned state: latest when: kvm_tuned - name: Start and enable tuned service service: name: tuned state: started enabled: yes when: kvm_tuned - name: Check tuned profile shell: "tuned-adm active" args: executable: /bin/bash register: tuned_profile when: kvm_tuned changed_when: false - name: Set tuned profile shell: "tuned-adm profile virtual-host" args: executable: /bin/bash when: tuned_profile.stdout is not search("virtual-host") - name: Install cockpit package package: name: - cockpit - cockpit-machines state: latest when: kvm_cockpit - name: Start and enable cockpit service service: name: cockpit.socket state: started enabled: yes when: kvm_cockpit