summaryrefslogtreecommitdiff
path: root/roles/vm/guest/tasks/main.yml
blob: 72ea32721320dc2070eb4279c2f964e66129bb6c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
- 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 {{ install_cooked.vm.host }} %I $TERM