Selaa lähdekoodia

partitions are defined in the hard_disks template

master
Markus Katharina Brechtel 7 vuotta sitten
vanhempi
commit
96720a62af
2 muutettua tiedostoa jossa 132 lisäystä ja 134 poistoa
  1. +132
    -10
      templates/hard_disks.json.j2
  2. +0
    -124
      templates/partitions.json.j2

+ 132
- 10
templates/hard_disks.json.j2 Näytä tiedosto

@@ -1,22 +1,144 @@
[
{#
{% if hard_disks is defined %}
{% for hard_disk in hard_disks %}
{{hard_disk}},
{% endfor %}
{% else %}
#}
{% set first_device_name = ansible_devices.keys() | first %}
{% if not hard_disks is defined %}
{% for device in ansible_devices.keys() %}
{% set name = device %}
{% set device = '/dev/' + device %}
{% set first_device = first_device_name == name %}
{% endif %}
#}
{% for hd in hard_disks %}
{% set first_device = (hard_disks | first) == hd %}
{% set name = hd.name %}
{% set device = hd.device %}
{
"device": "{{device}}",
"name": "{{name}}",
"label_type": "{{ _label_type[partitioning_profile] }}",
"partitions": {% include "partitions.json.j2" %}
"partitions":
[
{% set partition_name_prefix = inventory_hostname_short + '-' + name %}
{% if partitioning_profile == "bios-mbr-dmcrypt-lvm" %}
{
"part_type": "primary",
"fs_type": "btrfs",
"start": "768MiB",
"end": "1GiB"
}
{
"part_type": "primary",
"fs_type": "btrfs",
"start": "1GiB",
"end": "2GiB"
}
{
"part_type": "primary",
"fs_type": "btrfs",
"start": "2GiB",
"end": "6GiB"
}
{
"part_type": "primary",
"start": "6GiB",
"end": "{{ partitioning_profile_last_partition_end }}"
}
{% endif %}
{% if partitioning_profile == "efi-dmcrypt-lvm" %}
{
"part_type": "ESP",
"start": "256MiB",
"end": "768MiB"
},
{
"name": "select",
"start": "768MiB",
"end": "1GiB"
},
{
"name": "{{partition_name_prefix}}-boot",
"typecode": "8300",
"start": "1GiB",
"end": "2GiB"
},
{
"name": "{{partition_name_prefix}}-rescue",
"typecode": "8300",
"start": "2GiB",
"end": "6GiB"
},
{
"name": "{{partition_name_prefix}}-crypt",
"typecode": "8300",
"start": "6GiB",
"end": "{{ partitioning_profile_last_partition_end }}"
}
{% endif %}
{% if partitioning_profile == "bios-gpt-mdraid-lvm" %}
{
"name": "bios_boot",
"start": "2MiB",
"end": "4MiB",
"flags": ["bios_grub"]
},
{% if first_device %}
{
"name": "{{_select_partlabel}}",
"start": "768MiB",
"end": "1GiB"
},
{% endif %}
{
"name": "{{partition_name_prefix}}-boot-md",
"start": "1GiB",
"end": "2GiB",
"mdraid": "boot"
},
{
"name": "{{partition_name_prefix}}-rescue-md",
"start": "2GiB",
"end": "6GiB",
"mdraid": "rescue"
},
{
"name": "{{partition_name_prefix}}-vg0-md",
"start": "6GiB",
"end": "{{ partitioning_profile_last_partition_end }}",
"mdraid": "vg0"
}
{% endif %}
{% if partitioning_profile == "efi-mdraid-lvm" %}
{% if first_device %}
{
"name": "{{_efi_partlabel}}",
"start": "256MiB",
"end": "768MiB",
"flags": ["boot"]
},
{
"name": "{{_select_partlabel}}",
"start": "768MiB",
"end": "1GiB"
},
{% endif %}
{
"name": "{{partition_name_prefix}}-boot-md",
"start": "1GiB",
"end": "2GiB",
"mdraid": "boot"
},
{
"name": "{{partition_name_prefix}}-rescue-md",
"start": "2GiB",
"end": "6GiB",
"mdraid": "rescue"
},
{
"name": "{{partition_name_prefix}}-vg0-md",
"start": "6GiB",
"end": "{{ partitioning_profile_last_partition_end }}",
"mdraid": "vg0"
}
{% endif %}
]
},
{% endfor %}
{#{% endif %}#}
]

+ 0
- 124
templates/partitions.json.j2 Näytä tiedosto

@@ -1,124 +0,0 @@
[
{% set partition_name_prefix = inventory_hostname_short + '-' + name %}
{% if partitioning_profile == "bios-mbr-dmcrypt-lvm" %}
{
"part_type": "primary",
"fs_type": "btrfs",
"start": "768MiB",
"end": "1GiB"
}
{
"part_type": "primary",
"fs_type": "btrfs",
"start": "1GiB",
"end": "2GiB"
}
{
"part_type": "primary",
"fs_type": "btrfs",
"start": "2GiB",
"end": "6GiB"
}
{
"part_type": "primary",
"start": "6GiB",
"end": "{{ partitioning_profile_last_partition_end }}"
}
{% endif %}
{% if partitioning_profile == "efi-dmcrypt-lvm" %}
{
"part_type": "ESP",
"start": "256MiB",
"end": "768MiB"
},
{
"name": "select",
"start": "768MiB",
"end": "1GiB"
},
{
"name": "{{partition_name_prefix}}-boot",
"typecode": "8300",
"start": "1GiB",
"end": "2GiB"
},
{
"name": "{{partition_name_prefix}}-rescue",
"typecode": "8300",
"start": "2GiB",
"end": "6GiB"
},
{
"name": "{{partition_name_prefix}}-crypt",
"typecode": "8300",
"start": "6GiB",
"end": "{{ partitioning_profile_last_partition_end }}"
}
{% endif %}
{% if partitioning_profile == "bios-gpt-mdraid-lvm" %}
{
"name": "bios_boot",
"start": "2MiB",
"end": "4MiB",
"flags": ["bios_grub"]
},
{% if first_device %}
{
"name": "{{_select_partlabel}}",
"start": "768MiB",
"end": "1GiB"
},
{% endif %}
{
"name": "{{partition_name_prefix}}-boot-md",
"start": "1GiB",
"end": "2GiB",
"mdraid": "boot"
},
{
"name": "{{partition_name_prefix}}-rescue-md",
"start": "2GiB",
"end": "6GiB",
"mdraid": "rescue"
},
{
"name": "{{partition_name_prefix}}-vg0-md",
"start": "6GiB",
"end": "{{ partitioning_profile_last_partition_end }}",
"mdraid": "vg0"
}
{% endif %}
{% if partitioning_profile == "efi-mdraid-lvm" %}
{% if first_device %}
{
"name": "{{_efi_partlabel}}",
"start": "256MiB",
"end": "768MiB",
"flags": ["boot"]
},
{
"name": "{{_select_partlabel}}",
"start": "768MiB",
"end": "1GiB"
},
{% endif %}
{
"name": "{{partition_name_prefix}}-boot-md",
"start": "1GiB",
"end": "2GiB",
"mdraid": "boot"
},
{
"name": "{{partition_name_prefix}}-rescue-md",
"start": "2GiB",
"end": "6GiB",
"mdraid": "rescue"
},
{
"name": "{{partition_name_prefix}}-vg0-md",
"start": "6GiB",
"end": "{{ partitioning_profile_last_partition_end }}",
"mdraid": "vg0"
}
{% endif %}
]

Loading…
Peruuta
Tallenna