@@ -1,4 +1,5 @@ | |||||
partitioning_base_profile: bios-gpt | |||||
partitioning_boot_profile: bios-gpt | |||||
partitioning_base_profile: data-partition | |||||
partitioning_raid_profile: "{{ ( hard_disks | length > 1 ) | ternary('mirror','single') }}" | partitioning_raid_profile: "{{ ( hard_disks | length > 1 ) | ternary('mirror','single') }}" | ||||
partitioning_crypt_profile: none | partitioning_crypt_profile: none | ||||
@@ -5,11 +5,6 @@ | |||||
file: "base_profiles/{{partitioning_base_profile}}.yml" | file: "base_profiles/{{partitioning_base_profile}}.yml" | ||||
name: _partitioning_base_profile | name: _partitioning_base_profile | ||||
- name: set base profile vars | |||||
set_fact: | |||||
debian_boot_packages: "{{ _partitioning_base_profile.debian_boot_packages }}" | |||||
grub_bootloader_target: "{{ _partitioning_base_profile.grub_bootloader_target }}" | |||||
- name: set hard disks base profile | - name: set hard disks base profile | ||||
set_fact: | set_fact: | ||||
hard_disks: "{{lookup('template','hard_disks_base_profile.json.j2')}}" | hard_disks: "{{lookup('template','hard_disks_base_profile.json.j2')}}" | ||||
@@ -0,0 +1,15 @@ | |||||
--- | |||||
- name: load boot profile vars | |||||
include_vars: | |||||
file: "boot_profiles/{{partitioning_boot_profile}}.yml" | |||||
name: _partitioning_boot_profile | |||||
- name: set boot profile vars | |||||
set_fact: | |||||
debian_boot_packages: "{{ _partitioning_boot_profile.debian_boot_packages }}" | |||||
grub_bootloader_target: "{{ _partitioning_boot_profile.grub_bootloader_target }}" | |||||
- name: set hard disks boot profile | |||||
set_fact: | |||||
hard_disks: "{{lookup('template','hard_disks_boot_profile.json.j2')}}" |
@@ -2,6 +2,8 @@ | |||||
- import_tasks: scan.yml | - import_tasks: scan.yml | ||||
- import_tasks: boot_profile.yml | |||||
- import_tasks: base_profile.yml | - import_tasks: base_profile.yml | ||||
- import_tasks: raid_profile.yml | - import_tasks: raid_profile.yml | ||||
@@ -1,22 +1,10 @@ | |||||
[ | [ | ||||
{% for hd in hard_disks %} | {% for hd in hard_disks %} | ||||
{% set first_device = (hard_disks | first) == hd %} | |||||
{ | { | ||||
"device": "{{hd.device}}", | |||||
"name": "{{hd.name}}", | "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 %} #} | |||||
] | |||||
"device": "{{hd.device}}", | |||||
"label_type": "{{ hd.label_type }}", | |||||
"partitions": {{ hd.partitions + _partitioning_base_profile.partitions }} | |||||
}, | }, | ||||
{% endfor %} | {% endfor %} | ||||
] | ] |
@@ -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_boot_profile.label_type }}", | |||||
"partitions": [ | |||||
{% if first_device and _partitioning_boot_profile.partitions_first_device is defined %} | |||||
{% for part in _partitioning_boot_profile.partitions_first_device %} | |||||
{{part}}, | |||||
{% endfor %} | |||||
{% endif %} | |||||
{% if _partitioning_boot_profile.partitions is defined %} | |||||
{% for part in _partitioning_boot_profile.partitions %} | |||||
{{part}}, | |||||
{% endfor %} | |||||
{% endif %} #} | |||||
] | |||||
}, | |||||
{% endfor %} | |||||
] |
@@ -1,31 +0,0 @@ | |||||
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: -data | |||||
start: 2GiB | |||||
end: "{{last_partition_end}}" | |||||
typecode: 8300 | |||||
usage: data | |||||
debian_boot_packages: | |||||
- grub-pc | |||||
grub_bootloader_target: i386-pc |
@@ -1,20 +0,0 @@ | |||||
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: data | |||||
debian_boot_packages: | |||||
- grub-pc | |||||
grub_bootloader_target: i386-pc |
@@ -0,0 +1,7 @@ | |||||
partitions: | |||||
- prefix: "{{inventory_hostname_short}}-" | |||||
suffix: -data | |||||
start: 2GiB | |||||
end: "{{last_partition_end}}" | |||||
typecode: 8300 | |||||
usage: data |
@@ -0,0 +1,19 @@ | |||||
label_type: gpt | |||||
partitions: | |||||
- name: bios_boot | |||||
start: 1MiB | |||||
end: 2MiB | |||||
flags: | |||||
- bios_grub | |||||
- prefix: "{{inventory_hostname_short}}-" | |||||
suffix: -boot | |||||
start: 2MiB | |||||
end: 1GiB | |||||
typecode: 8300 | |||||
usage: boot | |||||
debian_boot_packages: | |||||
- grub-pc | |||||
grub_bootloader_target: i386-pc |
@@ -0,0 +1,12 @@ | |||||
label_type: msdos | |||||
partitions: | |||||
- type: primary | |||||
start: 1MiB | |||||
end: 1GiB | |||||
usage: boot | |||||
debian_boot_packages: | |||||
- grub-pc | |||||
grub_bootloader_target: i386-pc |
@@ -1,5 +1,5 @@ | |||||
_host_vars_filename: partitioning | |||||
_host_vars_default: {} | |||||
_host_vars_filename: partitioning | |||||
_host_vars_default: {} | |||||
_host_vars: | _host_vars: | ||||
hard_disks: "{{ hard_disks }}" | hard_disks: "{{ hard_disks }}" | ||||
mdraid_devices: "{{ mdraid_devices }}" | mdraid_devices: "{{ mdraid_devices }}" | ||||
@@ -2,9 +2,6 @@ mdraid_devices: | |||||
- device: /dev/md/boot | - device: /dev/md/boot | ||||
level: 1 | level: 1 | ||||
devices: "{{ hard_disks | json_query(\"[].partitions[?usage=='boot'][].device\") | list }}" | 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/data | - device: /dev/md/data | ||||
level: 1 | level: 1 | ||||
devices: "{{ hard_disks | json_query(\"[].partitions[?usage=='data'][].device\") | list }}" | devices: "{{ hard_disks | json_query(\"[].partitions[?usage=='data'][].device\") | list }}" | ||||
@@ -2,9 +2,6 @@ mdraid_devices: | |||||
- device: /dev/md/boot | - device: /dev/md/boot | ||||
level: 1 | level: 1 | ||||
devices: "{{ hard_disks | json_query(\"[].partitions[?usage=='boot'][].device\") | list }}" | 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/data | - device: /dev/md/data | ||||
level: 0 | level: 0 | ||||
devices: "{{ hard_disks | json_query(\"[].partitions[?usage=='data'][].device\") | list }}" | devices: "{{ hard_disks | json_query(\"[].partitions[?usage=='data'][].device\") | list }}" | ||||