]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
testnode: Use new drives_to_partition dict to partition drives
authorDavid Galloway <dgallowa@redhat.com>
Fri, 29 Sep 2017 16:52:19 +0000 (12:52 -0400)
committerDavid Galloway <dgallowa@redhat.com>
Fri, 29 Sep 2017 19:33:13 +0000 (15:33 -0400)
Signed-off-by: David Galloway <dgallowa@redhat.com>
roles/testnode/tasks/drive_partitioning.yml

index c6aa5e412fedd2528691020489e4327f2c06a3aa..d3ea7022d223429644926b60842ba0e008b557fd 100644 (file)
@@ -2,27 +2,27 @@
 # Partition a data drive, like the nvme devices in smithi.  Only included
 # if drives_to_partition is defined.
 
-- name: "Write a new partition table to {{ drives_to_partition.drive }}"
-  command: "parted -s {{ drives_to_partition.drive }} mktable gpt"
+- name: "Write a new partition table to {{ item.value.device }}"
+  command: "parted -s {{ item.value.device }} mktable gpt"
+  with_dict: "{{ drives_to_partition }}"
 
-- name: "Write partition entries to {{ drive_to_partition }}"
-  command: "parted {{ drive_to_partition }} unit '%' mkpart primary {{ item }}"
-  with_items:
-    - "0 25"
-    - "25 50"
-    - "50 75"
-    - "75 100"
+- name: "Write partition entries to {{ item.0.device }}"
+  command: "parted {{ item.0.device }} unit '{{ item.0.unit }}' mkpart foo {{ item.1 }}"
+  with_subelements:
+    - "{{ drives_to_partition }}"
+    - sizes
 
-- name: "Add /scratch_devs for {{ drive_to_partition }} p1"
+- name: "Add /scratch_devs for {{ item.0.device }}"
   lineinfile:
     dest: /scratch_devs
     create: yes
     owner: root
     group: root
     mode: 0644
-    line: "{{ drive_to_partition }}{{ item }}"
-  with_items:
-    - p1
-    - p2
-    - p3
-    - p4
+    line: "{{ item.0.device }}{{ item.1 }}"
+  with_subelements:
+    - "{{ drives_to_partition }}"
+    - scratch_devs
+    - flags:
+      # In case you want to partition a drive but not use it as a scratch device
+      skip_missing: True