Guest User

Untitled

a guest
Apr 21st, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. ---
  2. - name: Rotational Disks
  3. gather_facts: true
  4. hosts: localhost
  5.  
  6. tasks:
  7. - name: list device
  8. set_fact:
  9. disk_rotationals: "{{ ansible_devices | dictsort | selectattr('1.rotational', 'match', '1') | map(attribute=0) | list }}"
  10.  
  11. - name: Ensure root folder for mount point
  12. file:
  13. path: /mnt
  14. state: directory
  15. owner: root
  16. group: root
  17.  
  18. - name : "Format new volume /dev/{{ item }}"
  19. filesystem:
  20. fstype: xfs
  21. dev: "/dev/{{ item }}"
  22. with_items:
  23. - "{{ disk_rotationals }}"
  24.  
  25. - name: "Edit fstab and mount the device {{ item }}"
  26. mount:
  27. name: "/mnt/{{ item.0 }}"
  28. src: "/dev/{{ item.1 }}"
  29. opts: noatime
  30. fstype: xfs
  31. state: mounted
  32. with_indexed_items:
  33. - "{{ disk_rotationals }}"
  34. ...
Add Comment
Please, Sign In to add comment