--- - name: install rngd apt: name: rng-tools state: present force_apt_get: yes - name: configure rngd [1/2] loop: '{{ vm_guest_rngd_config | dict2items }}' loop_control: label: "{{ item.key }}" lineinfile: path: /etc/default/rng-tools line: '{{ item.key }}={{ item.value }}' regexp: '^#?{{ item.key }}=' notify: restart rngd - name: configure rngd [2/2] loop: '{{ vm_guest_rngd_config | dict2items }}' loop_control: label: "{{ item.key }}" lineinfile: path: /etc/default/rng-tools regexp: '^{{ item.key }}=(?!{{ item.value }})' state: absent notify: restart rngd - name: provide a root shell on the VM serial console when: vm_guest_autologin_on_serial block: - name: create systemd override directory for gettyS0 file: path: /etc/systemd/system/serial-getty@ttyS0.service.d/ state: directory - name: create autologin config for gettyS0 copy: dest: /etc/systemd/system/serial-getty@ttyS0.service.d/autologon.conf content: | [Service] ExecStart= ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 --noclear --autologin root --login-pause --host {{ vm_host_cooked.name }} %I $TERM - name: enable serial console in grub and for kernel vars: grub_options: GRUB_TIMEOUT: 2 GRUB_CMDLINE_LINUX: '"console=ttyS0,115200n8"' GRUB_TERMINAL: serial GRUB_SERIAL_COMMAND: >- "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1" loop: "{{ grub_options | dict2items }}" loop_control: label: "{{ item.key }}" lineinfile: dest: /etc/default/grub regexp: "^{{ item.key }}=" line: "{{ item.key }}={{ item.value }}" notify: update grub