]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
purge-container: remove awk usage in favor of blkid
authorGuillaume Abrioux <gabrioux@redhat.com>
Wed, 17 Jan 2018 08:06:43 +0000 (09:06 +0100)
committerSébastien Han <seb@redhat.com>
Thu, 18 Jan 2018 21:02:32 +0000 (22:02 +0100)
Avoid using `awk` to get the different devices from the partlabel.
Using `blkid` is more readable.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 58eb045d2fac02337ed47ead1cab9b4cc484a092)
Signed-off-by: Sébastien Han <seb@redhat.com>
infrastructure-playbooks/purge-docker-cluster.yml

index 8b78fa2e8b8e5dfa9769a5e6e8778e848fc69a4a..c5b9cb317ff2386654fb1942aebeecd8127d4488 100644 (file)
     ignore_errors: true
 
   - name: get ceph data partitions
-    shell: |
-      blkid | awk -F: '/ceph data/ { print $1 }'
+    command: |
+      blkid -o device -t PARTLABEL="ceph data"
     when: ceph_data_partlabels.rc == 0
     failed_when: false
     register: ceph_data_partition_to_erase_path
 
   - name: get ceph lockbox partitions
-    shell: |
-      blkid | awk '/ceph lockbox/ { sub (":", "", $1); print $1 }'
+    command: |
+      blkid -o device -t PARTLABEL="ceph lockbox"
     when: ceph_lockbox_partlabels.rc == 0
     failed_when: false
     register: ceph_lockbox_partition_to_erase_path
 
   - name: get ceph block partitions
-    shell: |
-      blkid | awk '/ceph block"/ { sub (":", "", $1); print $1 }'
+    command: |
+      blkid -o device -t PARTLABEL="ceph block"
     when: ceph_block_partlabels.rc == 0
     failed_when: false
     register: ceph_block_partition_to_erase_path
 
   - name: get ceph journal partitions
-    shell: |
-      blkid | awk '/ceph journal/ { sub (":", "", $1); print $1 }'
+    command: |
+      blkid -o device -t PARTLABEL="ceph journal"
     when: ceph_journal_partlabels.rc == 0
     failed_when: false
     register: ceph_journal_partition_to_erase_path
 
   - name: get ceph db partitions
-    shell: |
-      blkid | awk '/ceph block.db/ { sub (":", "", $1); print $1 }'
+    command: |
+      blkid -o device -t PARTLABEL="ceph block.db"
     when: ceph_db_partlabels.rc == 0
     failed_when: false
     register: ceph_db_partition_to_erase_path
 
   - name: get ceph wal partitions
-    shell: |
-      blkid | awk '/ceph block.wal/ { sub (":", "", $1); print $1 }'
+    command: |
+      blkid -o device -t PARTLABEL="ceph block.wal"
     when: ceph_wal_partlabels.rc == 0
     failed_when: false
     register: ceph_wal_partition_to_erase_path