Skip to content

Add Cloud-init and TPM Support #101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add tpm support
Signed-off-by: aleskxyz <39186039+aleskxyz@users.noreply.github.com>
  • Loading branch information
aleskxyz committed Dec 30, 2024
commit 6235f0b030dfa8f868db41b5e51061a710c6cb2c
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ be preconfigured with libvirt/KVM.

`genisoimage` is required for cloud-init support.

`swtpm` and `swtpm-tools` packages are required for TPM support.

Role Variables
--------------

Expand Down Expand Up @@ -203,6 +205,9 @@ Role Variables

- `boot_firmware`: Can be one of: `bios`, or `efi`. Defaults to `bios`.

- `tpm_enabled`: Whether to enable TPM for this VM. Default is `false`.

- `tpm_version`: TPM version to use. Can be '1.2' or '2.0'. Default is '2.0'.

- `cloud_init_enabled`: Whether to enable cloud-init for this VM. Default is `false`.

Expand Down Expand Up @@ -297,6 +302,8 @@ Example Playbook
type: 'file'
file_path: '/srv/cloud/images'
capacity: '900GB'
tpm_enabled: true
tpm_version: "2.0"
cloud_init_enabled: true
cloud_init_user_data:
users:
Expand Down
5 changes: 5 additions & 0 deletions templates/vm.xml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@
</source>
</hostdev>
{% endfor %}
{% if vm.tpm_enabled | default(false) | bool %}
<tpm model='tpm-tis'>
<backend type='emulator' version='{{ vm.tpm_version | default("2.0") }}'/>
</tpm>
{% endif %}
<rng model="virtio"><backend model="random">/dev/urandom</backend></rng>
</devices>
</domain>