Skip to content

enable tpm simulation for virtual machines #1510

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions vm-setup/roles/libvirt/templates/baremetalvm.xml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<tpm model="tpm-tis">
<backend type="emulator" version="2.0"/>
</tpm>
<disk type="file" device="cdrom">
<target dev='{{ libvirt_cdromdev }}' bus='{{ libvirt_cdrombus }}'/>
<readonly/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,8 @@
become: yes
when: CONTAINER_RUNTIME == "podman"

- name: Install swtpm
dnf:
name: swtpm
state: present
become: yes
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
state: latest

# TODO: (Sunnatillo) Remove this task after fully removing apt-key
- name: Remove OS old repository (without gpg key file location)
- name: Remove OS old repository (without gpg key file location)
apt_repository:
repo: "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_{{ OS_VERSION_ID }}/ /"
state: absent

- name: Remove Ubuntu Noble old repository (without gpg key file location)
apt_repository:
repo: "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_{{ OS_VERSION_ID }}/ /"
Expand All @@ -35,9 +35,9 @@
when: ansible_distribution_release == "noble"

- name: Dearmor Release key
shell: |
shell: |
cat /usr/share/keyrings/libcontainers-archive-keyring.asc | sudo gpg --dearmor -o /usr/share/keyrings/libcontainers-archive-keyring.gpg --yes

- name: Add OS repository
lineinfile:
path: /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
Expand Down Expand Up @@ -66,7 +66,7 @@
- name: Podman
block:
- name: Install podman
apt:
apt:
name: podman
state: present

Expand All @@ -92,19 +92,19 @@
dest: /etc/apt/keyrings/docker.asc
mode: '0644'
force: true

- name: Dearmor GPG key
shell: |
shell: |
cat /etc/apt/keyrings/docker.asc | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg --yes

# TODO: (Sunnatillo) Remove this task after fully removing apt-key
- name: Remove Docker old repository (without gpg key file location)
- name: Remove Docker old repository (without gpg key file location)
apt_repository:
repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable"
state: absent

# TODO: (Sunnatillo) Remove this task after fully removing apt-key
- name: Remove Docker old repository (without gpg key file location)
- name: Remove Docker old repository (without gpg key file location)
apt_repository:
repo: "deb https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable"
state: absent
Expand Down Expand Up @@ -150,4 +150,10 @@
append: yes
when: CONTAINER_RUNTIME == "docker"
become: yes

- name: Install swtpm
apt:
name: swtpm
state: present

become: yes