Difference between revisions of "Ansible and parted"
From MyWiki
(Created page with "https://docs.ansible.com/ansible/latest/modules/parted_module.html <br> <source lang="yaml" - name: Create a new primary partition parted: device: /dev/sdb number:...") |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
https://docs.ansible.com/ansible/latest/modules/parted_module.html <br> | https://docs.ansible.com/ansible/latest/modules/parted_module.html <br> | ||
− | <source lang="yaml" | + | logical volumes - https://docs.ansible.com/ansible/latest/modules/lvol_module.html<br> |
+ | Physical volumes - https://docs.ansible.com/ansible/latest/modules/lvg_module.html<br> | ||
+ | <source lang="yaml"> | ||
Latest revision as of 18:36, 23 March 2020
https://docs.ansible.com/ansible/latest/modules/parted_module.html
logical volumes - https://docs.ansible.com/ansible/latest/modules/lvol_module.html
Physical volumes - https://docs.ansible.com/ansible/latest/modules/lvg_module.html
- name: Create a new primary partition parted: device: /dev/sdb number: 1 state: present - name: Remove partition number 1 parted: device: /dev/sdb number: 1 state: absent - name: Create a new primary partition with a size of 1GiB parted: device: /dev/sdb number: 1 state: present part_end: 1GiB - name: Create a new primary partition for LVM parted: device: /dev/sdb number: 2 flags: [ lvm ] state: present part_start: 1GiB # Example on how to read info and reuse it in subsequent task - name: Read device information (always use unit when probing) parted: device=/dev/sdb unit=MiB register: sdb_info - name: Remove all partitions from disk parted: device: /dev/sdb number: '{{ item.num }}' state: absent loop: '{{ sdb_info.partitions }}'