HI all,

 I am trying to get the disk information of target machine.

1. I want to check the newly added disk which is fully free, means there is 
no partition created.
2. running a loop like /dev/sda to /dev/sdz and that should fail if 
patition is not created and print the me last failed disk. can someone help 
me ?

I have tried bellow playbook in Linux machine. let me know the changes.

Thanks in advance.

- hosts: one
  become: true
  tasks:
    - shell: " lsblk | grep -i disk | awk '{print$1}' "
      register: part
    - debug:
         msg: "{{part.stdout_lines}}"
    - shell: "fdisk -l /dev/{{item}}1 | grep -i cylinders"
      register: new
      with_items:
         - "{{part.stdout_lines}}"
      #until: '"cylinders" not in new.stdout'
      failed_when: new.rc == 1
      ignore_errors: true
    - debug:
         msg: "{{item.new}}"

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f7bdee8b-ae70-48b4-8344-3bea1f3172f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to