diff options
Diffstat (limited to 'roles')
-rw-r--r-- | roles/vm/define/defaults/main.yml | 2 | ||||
-rw-r--r-- | roles/vm/define/templates/libvirt-domain.xml.j2 | 6 | ||||
-rw-r--r-- | roles/vm/guest/defaults/main.yml | 5 | ||||
-rw-r--r-- | roles/vm/guest/tasks/main.yml | 36 |
4 files changed, 28 insertions, 21 deletions
diff --git a/roles/vm/define/defaults/main.yml b/roles/vm/define/defaults/main.yml index 29884a9b..f0bcc4fd 100644 --- a/roles/vm/define/defaults/main.yml +++ b/roles/vm/define/defaults/main.yml @@ -1,5 +1,5 @@ --- -vm_define_autostart: "{{ not vm_define_installer and hostvars[install_hostname].install_cooked.autostart | default(False) }}" +vm_define_autostart: "{{ not vm_define_installer and hostvars[install_hostname].install_cooked.vm.autostart | default(False) }}" vm_define_start: yes vm_define_installer: no diff --git a/roles/vm/define/templates/libvirt-domain.xml.j2 b/roles/vm/define/templates/libvirt-domain.xml.j2 index 5e7f8f1f..af9fbf52 100644 --- a/roles/vm/define/templates/libvirt-domain.xml.j2 +++ b/roles/vm/define/templates/libvirt-domain.xml.j2 @@ -1,8 +1,8 @@ <domain type='kvm'> <name>{{ install_hostname }}</name> - <memory>{{ hostvars[install_hostname].install_cooked.mem * 1024 }}</memory> - <currentMemory>{{ hostvars[install_hostname].install_cooked.mem * 1024 }}</currentMemory> - <vcpu>{{ hostvars[install_hostname].install_cooked.numcpu }}</vcpu> + <memory>{{ hostvars[install_hostname].install_cooked.vm.mem * 1024 }}</memory> + <currentMemory>{{ hostvars[install_hostname].install_cooked.vm.mem * 1024 }}</currentMemory> + <vcpu>{{ hostvars[install_hostname].install_cooked.vm.numcpu }}</vcpu> <os> <type arch='x86_64' machine='pc-0.12'>hvm</type> {% if vm_define_installer %} 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 |