Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- - name: Rotational Disks
- gather_facts: true
- hosts: localhost
- tasks:
- - name: list device
- set_fact:
- disk_rotationals: "{{ ansible_devices | dictsort | selectattr('1.rotational', 'match', '1') | map(attribute=0) | list }}"
- - name: Ensure root folder for mount point
- file:
- path: /mnt
- state: directory
- owner: root
- group: root
- - name : "Format new volume /dev/{{ item }}"
- filesystem:
- fstype: xfs
- dev: "/dev/{{ item }}"
- with_items:
- - "{{ disk_rotationals }}"
- - name: "Edit fstab and mount the device {{ item }}"
- mount:
- name: "/mnt/{{ item.0 }}"
- src: "/dev/{{ item.1 }}"
- opts: noatime
- fstype: xfs
- state: mounted
- with_indexed_items:
- - "{{ disk_rotationals }}"
- ...
Add Comment
Please, Sign In to add comment