vm/guest: Make sure haveged is not installed
[noc.git] / ansible / roles / vm / guest / tasks / main.yml
index 23f4ef4..8cdc0a4 100644 (file)
@@ -1,16 +1,30 @@
-- name: Install rngd
+- name: Install and configure rngd (on kernel < 3.17)
+  when: ansible_kernel is version('3.17', '<')
+  import_tasks: rngd.yml
+
+- name: Uninstall rngd (on kernel >= 3.17)
+  when: ansible_kernel is version('3.17', '>=')
   apt:
     name: rng-tools
-    state: present
+    state: absent
+    purge: yes
+
+- name: Uninstall haveged
+  when: not (vm_guest_force_haveged | default(False))
+  apt:
+    name: haveged
+    state: absent
+    purge: yes
+
+- name: Provide a root shell on the VM console [1/2]
+  file:
+    path: /etc/systemd/system/serial-getty@ttyS0.service.d/
+    state: directory
 
-- name: Configure rngd
-  lineinfile:
-    path: /etc/default/rng-tools
-    line: '{{ item.key }}={{ item.value }}'
-    regexp: '^#?{{ item.key }}={{ item.value }}'
-  with_dict:
-    HRNGDEVICE: /dev/hwrng
-    RNGDOPTIONS: '"-s 256 -W 80%"'
-  loop_control:
-    label: "{{ item.key }}"
-  notify: restart rngd
+- name: Provide a root shell on the VM console [2/2]
+  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_install_host }} %I $TERM