summaryrefslogtreecommitdiff
path: root/roles/vm/guest
diff options
context:
space:
mode:
Diffstat (limited to 'roles/vm/guest')
-rw-r--r--roles/vm/guest/defaults/main.yml5
-rw-r--r--roles/vm/guest/tasks/main.yml36
2 files changed, 24 insertions, 17 deletions
diff --git a/roles/vm/guest/defaults/main.yml b/roles/vm/guest/defaults/main.yml
index b4deefa0..ce072e95 100644
--- a/roles/vm/guest/defaults/main.yml
+++ b/roles/vm/guest/defaults/main.yml
@@ -1,3 +1,6 @@
-rngd_config:
+---
+vm_guest_rngd_config:
HRNGDEVICE: /dev/hwrng
RNGDOPTIONS: '"-s 256 -W 80%"'
+
+vm_guest_autologin_on_serial: yes
diff --git a/roles/vm/guest/tasks/main.yml b/roles/vm/guest/tasks/main.yml
index c3a346d7..72ea3272 100644
--- a/roles/vm/guest/tasks/main.yml
+++ b/roles/vm/guest/tasks/main.yml
@@ -1,11 +1,11 @@
-- name: Install rngd
+- name: install rngd
apt:
name: rng-tools
state: present
force_apt_get: yes
-- name: Configure rngd [1/2]
- loop: '{{ rngd_config | dict2items }}'
+- name: configure rngd [1/2]
+ loop: '{{ vm_guest_rngd_config | dict2items }}'
loop_control:
label: "{{ item.key }}"
lineinfile:
@@ -14,8 +14,8 @@
regexp: '^#?{{ item.key }}='
notify: restart rngd
-- name: Configure rngd [2/2]
- loop: '{{ rngd_config | dict2items }}'
+- name: configure rngd [2/2]
+ loop: '{{ vm_guest_rngd_config | dict2items }}'
loop_control:
label: "{{ item.key }}"
lineinfile:
@@ -24,15 +24,19 @@
state: absent
notify: restart rngd
-- name: Provide a root shell on the VM console [1/2]
- file:
- path: /etc/systemd/system/serial-getty@ttyS0.service.d/
- state: directory
-- 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_host }} %I $TERM
+- 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