On Tue, 9 Jun 2020 at 14:26, Rajesh <[email protected]> wrote: > > Thanks again for your help. What needs to be done so that the below play will > print the message? > > - name: No extra hard disk > debug: > msg: "No extra hard disk available" > when: ansible_devices.sdb is undefined
This should be moved all the way up, so that it is the first task. Note that the majority of the subsequent tasks assume /dev/sdb is available, while this is clearly not the case. You should probably revise the playbook and add (more) conditionals. For instance, one of the previous outputs you posted shows that the playbook tried to create a filesystem on a device that is already mounted. The logic with 1200MB could also be improved. If the size is > 1200. Create a 1200MB partition - that seems OK. But when it's smaller than 1200, create a 800MB partition. What happens if the device is less than 800MB? Etc etc -- Dick Visser Trust & Identity Service Operations Manager GÉANT -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAL8fbwOMOirMLgnO4iFXuTEMp5GJ7Rrqta5%3D4XvBcZuWOVOGSg%40mail.gmail.com.
