summaryrefslogtreecommitdiff
path: root/roles/installer/debian/preseed/templates/partman_config.j2
blob: 70d218a74752074d0e74d27442ac96b7b2e339bc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
{# https://unix.stackexchange.com/questions/510445/install-grub-bootloader-dynamically-to-multiple-disks #}
d-i partman/early_command string /partman_early-command.sh

d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-md/confirm boolean true
d-i partman-md/confirm_nooverwrite boolean true
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true

d-i partman-auto/purge_lvm_from_device boolean true
d-i partman-auto-lvm/new_vg_name string {{ host_name }}
d-i partman-auto-lvm/guided_size string max
d-i partman-auto-lvm/no_boot boolean true

{% if (install.efi | default(false)) %}
d-i partman-efi/non_efi_system boolean true
d-i partman/choose_label string gpt
d-i partman/default_label string gpt
d-i partman-partitioning/choose_label string gpt
d-i partman-partitioning/default_label string gpt
d-i partman-basicfilesystems/choose_label string gpt
d-i partman-basicfilesystems/default_label string gpt
{% else %}
d-i partman/choose_label string msdos
d-i partman/default_label string msdos
d-i partman-partitioning/choose_label string msdos
d-i partman-partitioning/default_label string msdos
d-i partman-basicfilesystems/choose_label string msdos
d-i partman-basicfilesystems/default_label string msdos
{% endif %}

{% set system_lvm_size = install.system_lvm.size | default(debian_preseed_system_lvm_size_default) %}
{% set system_lvm_volumes = install.system_lvm.volumes | default(debian_preseed_system_lvm_volumes_default) %}
{# on small disks this probably triggers: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=896826 ... #}
{#  set system_lvm_reserve = install.system_lvm.reserve | default(debian_preseed_system_lvm_reserve_default) #}
{#  set system_lvm_pv_size_min_mb = (((system_lvm_volumes | map(attribute='size') | map('human_to_bytes') | sum) / (1024*1024)) | int) + (((system_lvm_reserve | human_to_bytes) / (1024*1024)) | int) #}
{# ... so let's go for a 1 MB minimum. #}
{% set system_lvm_pv_size_min_mb = 1 %}

{% if install.disks.primary == "software-raid" %}
d-i partman-auto/method string raid
{% else %}
d-i partman-auto/method string lvm
{% endif %}
d-i partman-auto/expert_recipe string                                                                             \
      ansible ::                                                                                                  \
{% if (install.efi | default(false)) %}
{%   set efi_esp_size_mb = ((debian_preseed_efi_esp_size | human_to_bytes) / (1024*1024)) | int %}
              {{ efi_esp_size_mb }} {{ efi_esp_size_mb }} {{ efi_esp_size_mb }} fat16                             \
                      $primary{ } $bootable{ }                                                                    \
                      method{ efi } format{ }                                                                     \
              .                                                                                                   \
{% endif %}
{% if install.disks.primary == "software-raid" %}
{%   set swraid_boot_size_mb = ((debian_preseed_swraid_boot_size | human_to_bytes) / (1024*1024)) | int %}
              {{ swraid_boot_size_mb }} {{ swraid_boot_size_mb }} {{ swraid_boot_size_mb }} raid                  \
                      $lvmignore{ } $primary{ } $bootable{ }                                                      \
                      method{ raid }                                                                              \
              .                                                                                                   \

{%   if system_lvm_size != 'all' %}
{%     set system_lvm_size_mb = ((system_lvm_size | human_to_bytes) / (1024*1024)) | int %}
              {{ system_lvm_size_mb }} {{ system_lvm_size_mb }} {{ system_lvm_size_mb }} raid                     \
                      $lvmignore{ } $primary{ }                                                                   \
                      method{ raid }                                                                              \
              .                                                                                                   \
              1 101 -1 ext4                                                                                       \
                      $lvmignore{ } $primary{ }                                                                   \
                      method{ unused }                                                                            \
              .                                                                                                   \
{%   else %}
              {{ system_lvm_pv_size_min_mb }} {{ system_lvm_pv_size_min_mb + 100 }} -1 raid                       \
                      $lvmignore{ } $primary{ }                                                                   \
                      method{ raid }                                                                              \
              .                                                                                                   \
{%   endif %}
{% else %}
{%   if system_lvm_size != 'all' %}
{%     set system_lvm_size_mb = ((system_lvm_size | human_to_bytes) / (1024*1024)) | int %}
              {{ system_lvm_size_mb }} {{ system_lvm_size_mb }} {{ system_lvm_size_mb }} lvm                      \
                      $defaultignore{ } $primary{ }                                                               \
                      method{ lvm } vg_name{ {{ host_name }} }                                                    \
              .                                                                                                   \
              1 101 -1 ext4                                                                                       \
                      $defaultignore{ } $primary{ }                                                               \
                      method{ unused }                                                                            \
              .                                                                                                   \
{%   else %}
              {{ system_lvm_pv_size_min_mb }} {{ system_lvm_pv_size_min_mb + 100 }} -1 lvm                        \
                      $defaultignore{ } $primary{ }                                                               \
                      method{ lvm } vg_name{ {{ host_name }} }                                                    \
              .                                                                                                   \
{%   endif %}
{% endif %}
{% for volume in system_lvm_volumes %}
{%   set volume_size = ((volume.size | human_to_bytes) / (1024*1024)) | int %}
              {{ volume_size }} {{ volume_size }} {{ volume_size }} {{ volume.filesystem }}                       \
                      $defaultignore{ } $lvmok{ }                                                                 \
                      in_vg{ {{ host_name }} } lv_name{ {{ volume.name }} }                                       \
                      method{ format } format{ }                                                                  \
                      use_filesystem{ } filesystem{ {{ volume.filesystem }} }                                     \
                      mountpoint{ {{ volume.mountpoint }} }                                                       \
                      mountpoint{ {{ volume.mountpoint }} }                                                       \
{%   for option in volume.mount_options | default([]) %}
                      options/{{ option }}{ {{ option }} }                                                        \
{%   endfor %}
              .                                                                                                   \
{% endfor %}
              1 101 -1 ext4                                                                                       \
                      $defaultignore{ } $lvmok{ }                                                                 \
                      in_vg{ {{ host_name }} } lv_name{ dummy }                                                   \
                      method{ unused }                                                                            \
              .



d-i partman-basicfilesystems/no_swap true
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish


## boot devices are configured by partman/early_command
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true