Advertisement
sandervanvugt

Untitled

May 19th, 2022
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. [ansible@control rhce8-book]$ cat listing79.yaml
  2. ---
  3. - name: check for existence of devices
  4. hosts: all
  5. tasks:
  6. - name: check if primary disk exists
  7. debug:
  8. msg: a primary disk exists
  9. when: ansible_facts['devices']['sda'] is defined or ansible_facts['devices']['nvme0n1'] is defined
  10. - name: check if econdary disk exists
  11. debug:
  12. msg: a secondary disk exists
  13. when: ansible_facts['devices']['sdb'] is defined or ansible_facts['devices']['nvme0n2'] is defined
  14. - name: dummy test, intended to fail
  15. debug:
  16. msg: failing
  17. when: dummy is defined
  18. - name: check if /dev/sdc does not exist
  19. debug:
  20. msg: there is no /dev/sdc device
  21. when: ansible_facts['devices']['sdc'] is not defined
  22.  
  23.  
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement