Parcourir la source

refactored

master
Parent
révision
5dc1478c65
26 fichiers modifiés avec 396 ajouts et 380 suppressions
  1. +12
    -1
      defaults/main.yml
  2. +23
    -0
      tasks/base_profile.yml
  3. +12
    -0
      tasks/crypt_profile.yml
  4. +6
    -0
      tasks/efi_filesystem.yml
  5. +16
    -0
      tasks/filesystems.yml
  6. +8
    -8
      tasks/host_vars.yml
  7. +11
    -14
      tasks/main.yml
  8. +19
    -0
      tasks/raid_profile.yml
  9. +12
    -0
      tasks/scan.yml
  10. +11
    -0
      tasks/swap_devices.yml
  11. +0
    -0
      tasks/volumes.yml
  12. +8
    -0
      templates/filesystems.json.j2
  13. +0
    -144
      templates/hard_disks.json.j2
  14. +22
    -0
      templates/hard_disks_base_profile.json.j2
  15. +8
    -0
      templates/hard_disks_scan.json.j2
  16. +39
    -0
      templates/hard_disks_set.json.j2
  17. +8
    -0
      templates/swap_devices.json.j2
  18. +29
    -0
      vars/base_profiles/bios-gpt.yml
  19. +18
    -0
      vars/base_profiles/bios-mbr.yml
  20. +33
    -0
      vars/base_profiles/efi.yml
  21. +11
    -0
      vars/crypt_profiles/dmcrypt-luks.yml
  22. +5
    -0
      vars/crypt_profiles/none.yml
  23. +44
    -213
      vars/main.yml
  24. +17
    -0
      vars/raid_profiles/mirror.yml
  25. +7
    -0
      vars/raid_profiles/single.yml
  26. +17
    -0
      vars/raid_profiles/strip.yml

+ 12
- 1
defaults/main.yml Voir le fichier

@@ -1 +1,12 @@
partitioning_profile_last_partition_end: -1MiB
partitioning_base_profile: bios-gpt
partitioning_raid_profile: auto
partitioning_crypt_profile: none

hard_disks_scan: false

last_partition_end: -1MiB

primary_volume_group_name: "{{inventory_hostname_short}}-vg0"

root_partition_default_size: 32G
swap_partition_default_size: 2G

+ 23
- 0
tasks/base_profile.yml Voir le fichier

@@ -0,0 +1,23 @@
---

- name: load base profile vars
include_vars:
file: "base_profiles/{{partitioning_base_profile}}.yml"
name: _partitioning_base_profile

- name: set base profile vars
set_fact:
debian_boot_packages: "{{ debian_boot_packages | union(_partitioning_base_profile.debian_boot_packages) }}"

- name: set hard disks base profile
set_fact:
hard_disks: "{{lookup('template','hard_disks_base_profile.json.j2')}}"

- name: set hard disks
set_fact:
hard_disks: "{{lookup('template','hard_disks_set.json.j2')}}"

# - name: debug hard hard_disks
# debug:
# msg:
# hard_disks: "{{hard_disks}}"

+ 12
- 0
tasks/crypt_profile.yml Voir le fichier

@@ -0,0 +1,12 @@
---

- name: load crypt profile vars
include_vars:
file: "crypt_profiles/{{partitioning_crypt_profile}}.yml"
name: _partitioning_crypt_profile

- name: set crypt profile vars
set_fact:
dmcrypt_devices: "{{_partitioning_crypt_profile.dmcrypt_devices}}"
system_device: "{{_partitioning_crypt_profile.system_device}}"
debian_boot_packages: "{{ debian_boot_packages | union(_partitioning_crypt_profile.debian_boot_packages) }}"

+ 6
- 0
tasks/efi_filesystem.yml Voir le fichier

@@ -0,0 +1,6 @@
---

- name: set efi file system
set_fact:
filesystems: "{{ filesystems | union(_efi_filesystems) }}"
when: partitioning_base_profile == 'efi'

+ 16
- 0
tasks/filesystems.yml Voir le fichier

@@ -0,0 +1,16 @@
---

- name: generate filesystem uuids
local_action: command uuid -v4
with_items: "{{filesystems}}"
register: _filesystems_uuids
changed_when: false

- name: set filesystems
set_fact:
filesystems: "{{lookup('template','filesystems.json.j2')}}"

# - debug:
# msg:
# _filesystems_uuids: "{{_filesystems_uuids}}"
# filesystems: "{{filesystems}}"

+ 8
- 8
tasks/host_vars.yml Voir le fichier

@@ -1,16 +1,16 @@
---

- name: host_vars directory
local_action:
file
path={{ playbook_dir }}/host_vars/{{inventory_hostname}}
state=directory
local_action: file
args:
path: "{{ playbook_dir }}/host_vars/{{inventory_hostname}}"
state: directory

- name: host_vars file
local_action:
template
src=host_vars.yml.j2
dest={{ playbook_dir }}/host_vars/{{inventory_hostname}}/{{_host_vars_filename}}.yml
local_action: template
args:
src: host_vars.yml.j2
dest: "{{ playbook_dir }}/host_vars/{{inventory_hostname}}/{{_host_vars_filename}}.yml"

- name: include host_vars
include_vars:


+ 11
- 14
tasks/main.yml Voir le fichier

@@ -1,20 +1,17 @@
---

- name: set filesystem uuid namespace
set_fact:
filesystem_uuid_namespace: "{{ lookup('pipe','uuid -v4') }}"
- import_tasks: scan.yml

#- name: hard_disks debug
# debug:
# msg: "{{hard_disks}}"
# when: hard_disks is defined
- import_tasks: base_profile.yml

- name: set hard_disks
set_fact:
hard_disks: "{{lookup('template','hard_disks.json.j2')}}"
- import_tasks: raid_profile.yml

#- name: _host_vars debug
# debug:
# msg: "{{_host_vars}}"
- import_tasks: crypt_profile.yml

- include: host_vars.yml
- import_tasks: efi_filesystem.yml

- import_tasks: filesystems.yml

- import_tasks: swap_devices.yml

- import_tasks: host_vars.yml

+ 19
- 0
tasks/raid_profile.yml Voir le fichier

@@ -0,0 +1,19 @@
---

- name: set raid profile to mdraid if more than one disk and to single if one
set_fact:
partitioning_raid_profile: "{{ ( hard_disks | length > 1 ) | ternary('mirror','single') }}"
when: partitioning_raid_profile == 'auto'

- name: load raid profile vars
include_vars:
file: "raid_profiles/{{partitioning_raid_profile}}.yml"
name: _partitioning_raid_profile

- name: set raid profile vars
set_fact:
mdraid_devices: "{{_partitioning_raid_profile.mdraid_devices}}"
boot_device: "{{_partitioning_raid_profile.boot_device}}"
rescue_device: "{{_partitioning_raid_profile.rescue_device}}"
system_device: "{{_partitioning_raid_profile.system_device}}"
debian_boot_packages: "{{ debian_boot_packages | union(_partitioning_raid_profile.debian_boot_packages) }}"

+ 12
- 0
tasks/scan.yml Voir le fichier

@@ -0,0 +1,12 @@
---

# - name: ansible_devices debug
# debug:
# msg: "{{ansible_devices}}"

- name: scan hard disks
set_fact:
hard_disks: "{{lookup('template','hard_disks_scan.json.j2')}}"
when:
- not hard_disks is defined
- hard_disks_scan

+ 11
- 0
tasks/swap_devices.yml Voir le fichier

@@ -0,0 +1,11 @@
---

- name: generate swap device uuids
local_action: command uuid -v4
with_items: "{{filesystems}}"
register: _swap_devices_uuids
changed_when: false

- name: set filesystems
set_fact:
swap_devices: "{{lookup('template','swap_devices.json.j2')}}"

+ 0
- 0
tasks/volumes.yml Voir le fichier


+ 8
- 0
templates/filesystems.json.j2 Voir le fichier

@@ -0,0 +1,8 @@
[
{% for fs in filesystems %}
{% if not fs.uuid is defined and fs.fstype != 'vfat' %}
{% set fs = fs | combine({ 'uuid': _filesystems_uuids.results[loop.index0].stdout }) %}
{% endif %}
{{fs|to_json}},
{% endfor %}
]

+ 0
- 144
templates/hard_disks.json.j2 Voir le fichier

@@ -1,144 +0,0 @@
[
{#
{% if not hard_disks is defined %}
{% for device in ansible_devices.keys() %}
{% set name = device %}
{% set device = '/dev/' + device %}
{% 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":
[
{% 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 %}
]

+ 22
- 0
templates/hard_disks_base_profile.json.j2 Voir le fichier

@@ -0,0 +1,22 @@
[
{% for hd in hard_disks %}
{% set first_device = (hard_disks | first) == hd %}
{
"device": "{{hd.device}}",
"name": "{{hd.name}}",
"label_type": "{{ _partitioning_base_profile.label_type }}",
"partitions": [
{% if first_device and _partitioning_base_profile.partitions_first_device is defined %}
{% for part in _partitioning_base_profile.partitions_first_device %}
{{part}},
{% endfor %}
{% endif %}
{% if _partitioning_base_profile.partitions is defined %}
{% for part in _partitioning_base_profile.partitions %}
{{part}},
{% endfor %}
{% endif %} #}
]
},
{% endfor %}
]

+ 8
- 0
templates/hard_disks_scan.json.j2 Voir le fichier

@@ -0,0 +1,8 @@
[
{% for device in ansible_devices.keys() %}
{
"name": "{{device}}",
"device": "/dev/{{device}}",
},
{% endfor %}
]

+ 39
- 0
templates/hard_disks_set.json.j2 Voir le fichier

@@ -0,0 +1,39 @@
[
{% for hd in hard_disks %}
{
"name": "{{hd.name}}",
"device": "{{hd.device}}",
"label_type": "{{ hd.label_type }}",
"partitions": [
{% for part in hd.partitions %}

{% if hd.label_type == 'gpt' %}

{% if not part.name is defined and ( part.prefix is defined or part.suffix is defined ) %}
{% set part = part | combine({ 'name': hd.name }) %}

{% if part.prefix is defined %}
{% set part = part | combine({ 'name': part.prefix+part.name }) %}
{% endif %}

{% if part.suffix is defined %}
{% set part = part | combine({ 'name': part.name+part.suffix }) %}
{% endif %}

{% endif %}

{% if part.name is defined and not part.device is defined %}
{% set part = part | combine({ 'device': '/dev/disk/by-partlabel/'+part.name }) %}
{% endif %}

{% elif hd.label_type == 'msdos' and not part.device is defined %}
{% set part = part | combine({ 'device': hd.device+(loop.index|string) }) %}
{% endif %}

{{part|to_json}},

{% endfor %}
]
},
{% endfor %}
]

+ 8
- 0
templates/swap_devices.json.j2 Voir le fichier

@@ -0,0 +1,8 @@
[
{% for swap in swap_devices %}
{% if not swap.uuid is defined %}
{% set swap = swap | combine({ 'uuid': _swap_devices_uuids.results[loop.index0].stdout }) %}
{% endif %}
{{swap|to_json}},
{% endfor %}
]

+ 29
- 0
vars/base_profiles/bios-gpt.yml Voir le fichier

@@ -0,0 +1,29 @@
label_type: gpt

partitions:
- name: bios_boot
start: 2MiB
end: 4MiB
flags:
- bios_grub
- prefix: "{{inventory_hostname_short}}-"
suffix: -boot
start: 512MiB
end: 1GiB
typecode: 8300
usage: boot
- prefix: "{{inventory_hostname_short}}-"
suffix: -rescue
start: 1GiB
end: 2GiB
typecode: 8300
usage: rescue
- prefix: "{{inventory_hostname_short}}-"
suffix: -system
start: 2GiB
end: "{{last_partition_end}}"
typecode: 8300
usage: system

debian_boot_packages:
- grub-pc

+ 18
- 0
vars/base_profiles/bios-mbr.yml Voir le fichier

@@ -0,0 +1,18 @@
label_type: msdos

partitions:
- type: primary
start: 512MiB
end: 1GiB
usage: boot
- type: primary
start: 1GiB
end: 2GiB
usage: rescue
- type: primary
start: 2GiB
end: "{{last_partition_end}}"
usage: system

debian_boot_packages:
- grub-pc

+ 33
- 0
vars/base_profiles/efi.yml Voir le fichier

@@ -0,0 +1,33 @@
label_type: gpt

partitions_first_device:
- name: "{{_efi_partlabel}}"
part_type: ESP
start: 4MiB
end: 512MiB
flags:
- boot

partitions:
- prefix: "{{inventory_hostname_short}}-"
suffix: -boot
start: 512MiB
end: 1GiB
typecode: 8300
usage: boot
- prefix: "{{inventory_hostname_short}}-"
suffix: -rescue
start: 1GiB
end: 2GiB
typecode: 8300
usage: rescue
- prefix: "{{inventory_hostname_short}}-"
suffix: -system
start: 2GiB
end: "{{last_partition_end}}"
typecode: 8300
usage: system

debian_boot_packages:
- efibootmgr
- grub-efi-amd64

+ 11
- 0
vars/crypt_profiles/dmcrypt-luks.yml Voir le fichier

@@ -0,0 +1,11 @@
dmcrypt_devices:
- device: "{{ system_device }}"
name: "{{inventory_hostname}}-crypt0"
cipher: aes-xts-plain64
hash: sha512
key_size: 512

system_device: /dev/mapper/{{inventory_hostname}}-crypt0

debian_boot_packages:
- cryptsetup

+ 5
- 0
vars/crypt_profiles/none.yml Voir le fichier

@@ -0,0 +1,5 @@
dmcrypt_devices: []

system_device: "{{ system_device }}"

debian_boot_packages: []

+ 44
- 213
vars/main.yml Voir le fichier

@@ -1,222 +1,53 @@
_host_vars_filename: partitioning
_host_vars_default: {}
_host_vars_filename: partitioning
_host_vars_default: {}
_host_vars:
hard_disks: "{{ hard_disks }}"
mdraid_devices: "{{ _mdraid_devices[partitioning_profile] }}"
dmcrypt_devices: "{{ _dmcrypt_devices[partitioning_profile] }}"
volume_groups: "{{ _volume_groups[partitioning_profile] }}"
logical_volumes: "{{ _logical_volumes[partitioning_profile] }}"
filesystems: "{{ _filesystems[partitioning_profile] }}"
swap_devices: "{{ _swap_devices[partitioning_profile] }}"
debian_boot_packages: "{{ _debian_boot_packages[partitioning_profile] | union(_debian_boot_packages_all) }}"
hard_disks: "{{ hard_disks }}"
mdraid_devices: "{{ mdraid_devices }}"
dmcrypt_devices: "{{ dmcrypt_devices }}"
volume_groups: "{{ volume_groups }}"
logical_volumes: "{{ logical_volumes }}"
filesystems: "{{ filesystems }}"
swap_devices: "{{ swap_devices }}"
debian_boot_packages: "{{ debian_boot_packages }}"

volume_groups:
- name: "{{primary_volume_group_name}}"
devices:
- "{{ system_device }}"

logical_volumes:
- name: root
size: "{{root_partition_default_size}}"
- name: swap
size: "{{swap_partition_default_size}}"

filesystems:
- device: "{{ boot_device }}"
mount_point: /boot
fstype: ext4
- device: "{{ rescue_device }}"
mount_point: /rescue
fstype: btrfs
- device: /dev/{{primary_volume_group_name}}/root
mount_point: /
fstype: btrfs

_debian_boot_packages_all:
_efi_partlabel: "{{inventory_hostname_short}}-efi"
_efi_filesystems:
- device: /dev/disk/by-partlabel/{{_efi_partlabel}}
mount_point: /boot/efi
fstype: vfat

swap_devices:
- device: /dev/{{primary_volume_group_name}}/swap

debian_boot_packages:
- linux-image-amd64
- busybox-static
- e2fsprogs
- btrfs-tools
- openssh-server
- python
- console-setup
- acpi-support
- bridge-utils

_debian_boot_packages:
efi-dmcrypt-lvm:
- busybox-static
- lvm2
- cryptsetup
- btrfs-tools
- grub-efi-amd64
- efibootmgr
efi-mdraid-lvm:
- busybox-static
- mdadm
- lvm2
- btrfs-tools
- grub-efi-amd64
- efibootmgr
bios-mbr-dmcrypt-lvm:
- busybox-static
- lvm2
- cryptsetup
- btrfs-tools
- grub-pc
bios-gpt-mdraid-lvm:
- busybox-static
- mdadm
- lvm2
- btrfs-tools
- grub-pc

_label_type:
efi-mdraid-lvm: gpt
efi-dmcrypt-lvm: gpt
bios-mbr-dmcrypt-lvm: msdos
bios-gpt-mdraid-lvm: gpt

_dmcrypt_device_name: "{{inventory_hostname_short}}-crypt0"
_volume_group_name: "{{inventory_hostname_short}}-vg0"
_select_partlabel: "{{inventory_hostname_short}}-select"
_efi_partlabel: "{{inventory_hostname_short}}-efi"

_mdraid_devices:
bios-mbr-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:
- 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 }}"

_dmcrypt_devices:
efi-mdraid-lvm: []
bios-gpt-mdraid-lvm: []
efi-dmcrypt-lvm:
- device: "{{ _crypt_device[partitioning_profile] }}"
name: "{{inventory_hostname}}-crypt0"
cipher: aes-xts-plain64
hash: sha512
key_size: 512
_crypt_device:
#bios-dmcrypt-lvm: "{{ hard_disk_device }}-part4"
efi-dmcrypt-lvm: /dev/disk/by-partlabel/{{inventory_hostname}}-crypt
bios-gpt-mdraid-lvm: []

_volume_groups:
bios-mbr-dmcrypt-lvm:
- name: "{{_volume_group_name}}"
devices:
- /dev/mapper/{{_dmcrypt_device_name}}
efi-dmcrypt-lvm:
- name: "{{_volume_group_name}}"
devices:
- /dev/mapper/{{_dmcrypt_device_name}}
bios-gpt-mdraid-lvm:
- name: "{{_volume_group_name}}"
devices:
- /dev/md/vg0
efi-mdraid-lvm:
- name: "{{_volume_group_name}}"
devices:
- /dev/md/vg0

_logical_volumes_default:
- name: root
size: 32G
volume_group: "{{_volume_group_name}}"
- name: swap
size: 2G
volume_group: "{{_volume_group_name}}"
#- name: home
# size: 100%FREE
# 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_boot: "{{ lookup('pipe','uuid -v5 '+filesystem_uuid_namespace+' boot') }}"
_fs_uuid_rescue: "{{ lookup('pipe','uuid -v5 '+filesystem_uuid_namespace+' rescue') }}"
_fs_uuid_select: "{{ lookup('pipe','uuid -v5 '+filesystem_uuid_namespace+' select') }}"
_fs_uuid_swap: "{{ lookup('pipe','uuid -v5 '+filesystem_uuid_namespace+' swap') }}"


_filesystems:
#bios-mbr-dmcrypt-lvm:
# - device: /dev/vg/root
# mount_point: /
# fstype: btrfs
# uuid: "{{ _fs_uuid_root }}"
# - device: "{{ hard_disk_device }}-part2"
# mount_point: /boot
# fstype: btrfs
# uuid: "{{ _fs_uuid_boot }}"
# - device: "{{ hard_disk_device }}-part3"
# mount_point: /boot/rescue
# fstype: btrfs
# uuid: "{{ _fs_uuid_rescue }}"
# - device: "{{ hard_disk_device }}-part1"
# mount_point: /boot/select
# fstype: btrfs
# uuid: "{{ _fs_uuid_select }}"
efi-dmcrypt-lvm:
- device: /dev/{{_volume_group_name}}/root
mount_point: /
fstype: btrfs
uuid: "{{ _fs_uuid_root }}"
- device: /dev/disk/by-partlabel/{{inventory_hostname}}-boot
mount_point: /boot
fstype: btrfs
uuid: "{{ _fs_uuid_boot }}"
- device: /dev/disk/by-partlabel/{{inventory_hostname}}-rescue
mount_point: /boot/rescue
fstype: btrfs
uuid: "{{ _fs_uuid_rescue }}"
- device: /dev/disk/by-partlabel/{{inventory_hostname}}-select
mount_point: /boot/select
fstype: btrfs
uuid: "{{ _fs_uuid_select }}"
- device: /dev/disk/by-partlabel/{{_efi_partlabel}}
mount_point: /boot/efi
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:
- 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 }}"
- device: /dev/disk/by-partlabel/{{_efi_partlabel}}
mount_point: /boot/efi
fstype: vfat

_swap_devices:
bios-mbr-dmcrypt-lvm:
- device: /dev/{{_volume_group_name}}/swap
uuid: "{{ _fs_uuid_swap }}"
efi-dmcrypt-lvm:
- device: /dev/{{_volume_group_name}}/swap
uuid: "{{ _fs_uuid_swap }}"
bios-gpt-mdraid-lvm:
- device: /dev/{{_volume_group_name}}/swap
uuid: "{{ _fs_uuid_swap }}"
efi-mdraid-lvm:
- device: /dev/{{_volume_group_name}}/swap
uuid: "{{ _fs_uuid_swap }}"

+ 17
- 0
vars/raid_profiles/mirror.yml Voir le fichier

@@ -0,0 +1,17 @@
mdraid_devices:
- device: /dev/md/boot
level: 1
devices: "{{ hard_disks | json_query(\"[].partitions[?usage=='boot'][].device\") | list }}"
- device: /dev/md/rescue
level: 1
devices: "{{ hard_disks | json_query(\"[].partitions[?usage=='rescue'][].device\") | list }}"
- device: /dev/md/system
level: 1
devices: "{{ hard_disks | json_query(\"[].partitions[?usage=='system'][].device\") | list }}"

boot_device: /dev/md/boot
rescue_device: /dev/md/rescue
system_device: /dev/md/system

debian_boot_packages:
- mdadm

+ 7
- 0
vars/raid_profiles/single.yml Voir le fichier

@@ -0,0 +1,7 @@
mdraid_devices: []

boot_device: "{{ hard_disks | json_query(\"[].partitions[?usage=='boot'][].device\") | first }}"
rescue_device: "{{ hard_disks | json_query(\"[].partitions[?usage=='rescue'][].device\") | first }}"
system_device: "{{ hard_disks | json_query(\"[].partitions[?usage=='system'][].device\") | first }}"

debian_boot_packages: []

+ 17
- 0
vars/raid_profiles/strip.yml Voir le fichier

@@ -0,0 +1,17 @@
mdraid_devices:
- device: /dev/md/boot
level: 1
devices: "{{ hard_disks | json_query(\"[].partitions[?usage=='boot'][].device\") | list }}"
- device: /dev/md/rescue
level: 1
devices: "{{ hard_disks | json_query(\"[].partitions[?usage=='rescue'][].device\") | list }}"
- device: /dev/md/system
level: 0
devices: "{{ hard_disks | json_query(\"[].partitions[?usage=='system'][].device\") | list }}"

boot_device: /dev/md/boot
rescue_device: /dev/md/rescue
system_device: /dev/md/system

debian_boot_packages:
- mdadm

Chargement…
Annuler
Enregistrer