Przeglądaj źródła

current state from 2015-11-29

master
Markus Brecchtel 7 lat temu
commit
f2dcb4bf18
4 zmienionych plików z 39 dodań i 0 usunięć
  1. +1
    -0
      .gitignore
  2. +30
    -0
      tasks/main.yml
  3. +3
    -0
      templates/set_fact-hard_disks.j2
  4. +5
    -0
      vars/main.yml

+ 1
- 0
.gitignore Wyświetl plik

@@ -0,0 +1 @@
*~

+ 30
- 0
tasks/main.yml Wyświetl plik

@@ -0,0 +1,30 @@
---

- name: set default partitions
set_fact:
hard_disks: "{{ _hard_disks }}"

- name: clear all partition table informations from disks
command:
sgdisk
--clear
{{ item.device }}
with_items: "{{ hard_disks }}"
- name: create new partition table information
command:
sgdisk
"--new={{ item.1.partnum }}:{{ item.1.start }}:{{ item.1.end }}"
"--change-name={{ item.1.partnum }}:{{ item.1.name }}"
"--typecode={{ item.1.partnum }}:{{ item.1.typecode }}"
{{ item.0.device }}
with_subelements:
- "{{ hard_disks }}"
- partitions

- name: sync
command: sync
- name: reread partition tables
command: hdparm -z {{ item.device }}
with_items: "{{ hard_disks }}"

+ 3
- 0
templates/set_fact-hard_disks.j2 Wyświetl plik

@@ -0,0 +1,3 @@
{% for disk in hard_disks %}
- {{ _hard_disk_default | combine(disk) | to_json }}
{% endfor %}

+ 5
- 0
vars/main.yml Wyświetl plik

@@ -0,0 +1,5 @@
_hard_disks: "{{ lookup('template','set_fact-hard_disks.j2') | from_yaml }}"

_hard_disk_default:
partition_label: "{{ default_partition_label }}"
partitions: "{{ default_partitions }}"

Ładowanie…
Anuluj
Zapisz