sandervanvugt

Untitled

Dec 23rd, 2021
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. ---
  2. - name: setup additional storage
  3. gather_facts: yes
  4. hosts: all
  5. tasks:
  6.  
  7. - name: DEBUG - show disk device facts
  8. debug:
  9. var: ansible_facts['devices']
  10.  
  11. - name:
  12. fail:
  13. msg: device sdb not present
  14. when: ansible_facts['devices']['sdb'] is not defined
  15.  
  16. - name: actions when /dev/sdb is present
  17. block:
  18. - name: DEBUG - disk partititon
  19. debug:
  20. msg: parted - create a single partition spanning /dev/sdb
  21. - name: DEBUG - setup LVM PV and VG
  22. debug:
  23. msg: lvg - create an LVM VG vgfiles using /dev/sdb1 partition
  24. - name: DEBUG - we have a smaller VG
  25. debug:
  26. msg: lvol - create LV lvfiles that is 3GB
  27. # Dummy value for logic test
  28. when: 4 <= 5
  29. - name: DEBUG - we have a larger VG
  30. debug:
  31. msg: lvol - create LV lvfiles that is 6GB
  32. # Dummy value for logic test
  33. when: 12 > 5
  34. - name: DEBUG - format filesystem
  35. debug:
  36. msg: filesystem - format lvfiles using xfs
  37. - name: DEBUG - /files mountpoint
  38. debug:
  39. msg: file - create dir /files for mount point
  40. - name: DEBUG - mount filesystem
  41. debug:
  42. msg: mount - add /etc/fstab entry for /files referencing lvfiles LV with XFS
  43. when: ansible_facts['devices']['sdb'] is defined
  44.  
Advertisement
Add Comment
Please, Sign In to add comment