Kaynağa Gözat

bios-gpt-mdraid-profile

master
ebeveyn
işleme
9eb334a76c
3 değiştirilmiş dosya ile 77 ekleme ve 24 silme
  1. +2
    -1
      templates/hard_disks.json.j2
  2. +35
    -2
      templates/partitions.json.j2
  3. +40
    -21
      vars/main.yml

+ 2
- 1
templates/hard_disks.json.j2 Dosyayı Görüntüle

@@ -6,10 +6,11 @@
{% endfor %} {% endfor %}
{% else %} {% else %}
#} #}
{% set efi_device_name = ansible_devices.keys() | first %}
{% set first_device_name = ansible_devices.keys() | first %}
{% for device in ansible_devices.keys() %} {% for device in ansible_devices.keys() %}
{% set name = device %} {% set name = device %}
{% set device = '/dev/' + device %} {% set device = '/dev/' + device %}
{% set first_device = first_device_name == name %}
{ {
"device": "{{device}}", "device": "{{device}}",
"name": "{{name}}", "name": "{{name}}",


+ 35
- 2
templates/partitions.json.j2 Dosyayı Görüntüle

@@ -1,6 +1,6 @@
[ [
{% set partition_name_prefix = inventory_hostname_short + '-' + name %} {% set partition_name_prefix = inventory_hostname_short + '-' + name %}
{% if partitioning_profile == "bios-dmcrypt-lvm" %}
{% if partitioning_profile == "bios-mbr-dmcrypt-lvm" %}
{ {
"part_type": "primary", "part_type": "primary",
"fs_type": "btrfs", "fs_type": "btrfs",
@@ -55,8 +55,41 @@
"end": "-1MiB" "end": "-1MiB"
} }
{% endif %} {% 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": "-1MiB",
"mdraid": "vg0"
}
{% endif %}
{% if partitioning_profile == "efi-mdraid-lvm" %} {% if partitioning_profile == "efi-mdraid-lvm" %}
{% if efi_device_name == name %}
{% if first_device %}
{ {
"name": "{{_efi_partlabel}}", "name": "{{_efi_partlabel}}",
"start": "256MiB", "start": "256MiB",


+ 40
- 21
vars/main.yml Dosyayı Görüntüle

@@ -10,7 +10,8 @@ _host_vars:
_label_type: _label_type:
efi-mdraid-lvm: gpt efi-mdraid-lvm: gpt
efi-dmcrypt-lvm: gpt efi-dmcrypt-lvm: gpt
bios-dmcrypt-lvm: msdos
bios-mbr-dmcrypt-lvm: msdos
bios-gpt-mdraid-lvm: gpt


_dmcrypt_device_name: "{{inventory_hostname_short}}-crypt0" _dmcrypt_device_name: "{{inventory_hostname_short}}-crypt0"
_volume_group_name: "{{inventory_hostname_short}}-vg0" _volume_group_name: "{{inventory_hostname_short}}-vg0"
@@ -18,8 +19,15 @@ _select_partlabel: "{{inventory_hostname_short}}-select"
_efi_partlabel: "{{inventory_hostname_short}}-efi" _efi_partlabel: "{{inventory_hostname_short}}-efi"


_mdraid_devices: _mdraid_devices:
bios-dmcrypt-lvm: []
bios-mbr-dmcrypt-lvm: []
efi-dmcrypt-lvm: [] efi-dmcrypt-lvm: []
bios-gpt-mdraid-lvm:
- device: /dev/md/vg0
devices: "{{ hard_disks | json_query(\"[].partitions[?mdraid=='vg0'][].name\") | map('regex_replace','(.*)','/dev/disk/by-partlabel/\\1') | list }}"
- device: /dev/md/boot
devices: "{{ hard_disks | json_query(\"[].partitions[?mdraid=='boot'][].name\") | map('regex_replace','(.*)','/dev/disk/by-partlabel/\\1') | list }}"
- device: /dev/md/rescue
devices: "{{ hard_disks | json_query(\"[].partitions[?mdraid=='rescue'][].name\") | map('regex_replace','(.*)','/dev/disk/by-partlabel/\\1') | list }}"
efi-mdraid-lvm: efi-mdraid-lvm:
- device: /dev/md/vg0 - device: /dev/md/vg0
devices: "{{ hard_disks | json_query(\"[].partitions[?mdraid=='vg0'][].name\") | map('regex_replace','(.*)','/dev/disk/by-partlabel/\\1') | list }}" devices: "{{ hard_disks | json_query(\"[].partitions[?mdraid=='vg0'][].name\") | map('regex_replace','(.*)','/dev/disk/by-partlabel/\\1') | list }}"
@@ -30,6 +38,7 @@ _mdraid_devices:


_dmcrypt_devices: _dmcrypt_devices:
efi-mdraid-lvm: [] efi-mdraid-lvm: []
bios-gpt-mdraid-lvm: []
#- device: "{{ _crypt_device[partitioning_profile] }}" #- device: "{{ _crypt_device[partitioning_profile] }}"
# name: "{{inventory_hostname}}-crypt0" # name: "{{inventory_hostname}}-crypt0"
# cipher: aes-xts-plain64 # cipher: aes-xts-plain64
@@ -39,9 +48,8 @@ _dmcrypt_devices:
#bios-dmcrypt-lvm: "{{ hard_disk_device }}-part4" #bios-dmcrypt-lvm: "{{ hard_disk_device }}-part4"
#efi-dmcrypt-lvm: /dev/disk/by-partlabel/{{inventory_hostname}}-crypt #efi-dmcrypt-lvm: /dev/disk/by-partlabel/{{inventory_hostname}}-crypt



_volume_groups: _volume_groups:
bios-dmcrypt-lvm:
bios-mbr-dmcrypt-lvm:
- name: "{{_volume_group_name}}" - name: "{{_volume_group_name}}"
devices: devices:
- /dev/mapper/{{_dmcrypt_device_name}} - /dev/mapper/{{_dmcrypt_device_name}}
@@ -49,27 +57,16 @@ _volume_groups:
- name: "{{_volume_group_name}}" - name: "{{_volume_group_name}}"
devices: devices:
- /dev/mapper/{{_dmcrypt_device_name}} - /dev/mapper/{{_dmcrypt_device_name}}
bios-gpt-mdraid-lvm:
- name: "{{_volume_group_name}}"
devices:
- /dev/md/vg0
efi-mdraid-lvm: efi-mdraid-lvm:
- name: "{{_volume_group_name}}" - name: "{{_volume_group_name}}"
devices: devices:
- /dev/md/vg0 - /dev/md/vg0


_logical_volumes:
bios-dmcrypt-lvm:
- name: root
size: 32G
volume_group: "{{_volume_group_name}}"
- name: swap
size: 1G
volume_group: "{{_volume_group_name}}"
efi-dmcrypt-lvm:
- name: root
size: 32G
volume_group: "{{_volume_group_name}}"
- name: swap
size: 1G
volume_group: "{{_volume_group_name}}"
efi-mdraid-lvm:
_logical_volumes_default:
- name: root - name: root
size: 32G size: 32G
volume_group: "{{_volume_group_name}}" volume_group: "{{_volume_group_name}}"
@@ -79,6 +76,11 @@ _logical_volumes:
#- name: home #- name: home
# size: 100%FREE # size: 100%FREE
# volume_group: vg # volume_group: vg
_logical_volumes:
bios-mbr-dmcrypt-lvm: "{{_logical_volumes_default}}"
efi-dmcrypt-lvm: "{{_logical_volumes_default}}"
bios-gpt-mdraid-lvm: "{{_logical_volumes_default}}"
efi-mdraid-lvm: "{{_logical_volumes_default}}"


_fs_uuid_root: "{{ lookup('pipe','uuid -v5 '+filesystem_uuid_namespace+' root') }}" _fs_uuid_root: "{{ lookup('pipe','uuid -v5 '+filesystem_uuid_namespace+' root') }}"
_fs_uuid_boot: "{{ lookup('pipe','uuid -v5 '+filesystem_uuid_namespace+' boot') }}" _fs_uuid_boot: "{{ lookup('pipe','uuid -v5 '+filesystem_uuid_namespace+' boot') }}"
@@ -87,7 +89,7 @@ _fs_uuid_select: "{{ lookup('pipe','uuid -v5 '+filesystem_uuid_namespace+' selec




_filesystems: _filesystems:
#bios-dmcrypt-lvm:
#bios-mbr-dmcrypt-lvm:
# - device: /dev/vg/root # - device: /dev/vg/root
# mount_point: / # mount_point: /
# fstype: btrfs # fstype: btrfs
@@ -124,6 +126,23 @@ _filesystems:
- device: /dev/disk/by-partlabel/{{_efi_partlabel}} - device: /dev/disk/by-partlabel/{{_efi_partlabel}}
mount_point: /boot/efi mount_point: /boot/efi
fstype: vfat fstype: vfat
bios-gpt-mdraid-lvm:
- device: /dev/{{_volume_group_name}}/root
mount_point: /
fstype: btrfs
uuid: "{{ _fs_uuid_root }}"
- device: /dev/md/boot
mount_point: /boot
fstype: btrfs
uuid: "{{ _fs_uuid_boot }}"
- device: /dev/md/rescue
mount_point: /boot/rescue
fstype: btrfs
uuid: "{{ _fs_uuid_rescue }}"
- device: /dev/disk/by-partlabel/{{_select_partlabel}}
mount_point: /boot/select
fstype: btrfs
uuid: "{{ _fs_uuid_select }}"
efi-mdraid-lvm: efi-mdraid-lvm:
- device: /dev/{{_volume_group_name}}/root - device: /dev/{{_volume_group_name}}/root
mount_point: / mount_point: /


Yükleniyor…
İptal
Kaydet