From 1ab99a97a9dc6608ba85e8e2a4eb41a85c7e297e Mon Sep 17 00:00:00 2001
From: pullyvan <pullyvan.kris@gmail.com>
Date: Tue, 1 Feb 2022 13:19:45 +0100
Subject: [PATCH] fix crash on creating partition table GPT by adding a
 ignore_errors condition and double the command first to make the device nvme
 visible then to format it

---
 tasks/ubuntu2004.yml | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tasks/ubuntu2004.yml b/tasks/ubuntu2004.yml
index 9379da7..48c230a 100644
--- a/tasks/ubuntu2004.yml
+++ b/tasks/ubuntu2004.yml
@@ -36,6 +36,15 @@
     state: unmounted
   ignore_errors: yes
 
+- name: Make nvme visible on /dev/
+  community.general.parted:
+    device: "{{ dev }}"
+    number: 1
+    state: present
+    fs_type: "{{ fstype }}"
+    label: gpt
+  ignore_errors: yes
+
 - name: Create a new partition on disk
   community.general.parted:
     device: "{{ dev }}"
@@ -43,6 +52,7 @@
     state: present
     fs_type: "{{ fstype }}"
     label: gpt
+  ignore_errors: yes
 
 - name: Create a filesystem on device
   community.general.filesystem:
-- 
GitLab