## This playbook deploys a FvS VM server machine.
---
- name: apply configuration to the VM server
  hosts: all
  remote_user: ansible
  become: yes
  vars:
    extra_pkgs:
      - vim
      - libvirt-daemon-system
    extra_pkgs_bpo: [ ]  # [ libreoffice ]

  roles:
    - up2date_debian
    - fvs-sssd

  tasks:
    - name: enable pam_mkhomedir.so
      lineinfile:
        dest: /etc/pam.d/common-session
        line: "session	optional	pam_mkhomedir.so  umask=0027"
        insertbefore: "session	optional	pam_mount.so"

    - name: allow all users to use VMs
      lineinfile:
        dest: /etc/libvirt/libvirtd.conf
        line: 'auth_unix_rw = "none"'
        insertafter: '#auth_unix_rw = "polkit"'

    - name: shared directory for ISO installer images
      file:
        path: /home/ISOsVM
        state: directory
        mode: '1777'