Преглед на файлове

boot profiles

boot-profiles
Markus Katharina Brechtel преди 2 години
родител
ревизия
bd8fde015f
променени са 15 файла, в които са добавени 84 реда и са изтрити 80 реда
  1. +2
    -1
      defaults/main.yml
  2. +0
    -5
      tasks/base_profile.yml
  3. +15
    -0
      tasks/boot_profile.yml
  4. +2
    -0
      tasks/main.yml
  5. +3
    -15
      templates/hard_disks_base_profile.json.j2
  6. +22
    -0
      templates/hard_disks_boot_profile.json.j2
  7. +0
    -31
      vars/base_profiles/bios-gpt.yml
  8. +0
    -20
      vars/base_profiles/bios-mbr.yml
  9. +7
    -0
      vars/base_profiles/data-partition.yml
  10. +19
    -0
      vars/boot_profiles/bios-gpt.yml
  11. +12
    -0
      vars/boot_profiles/bios-mbr.yml
  12. +0
    -0
      vars/boot_profiles/efi.yml
  13. +2
    -2
      vars/main.yml
  14. +0
    -3
      vars/raid_profiles/mirror.yml
  15. +0
    -3
      vars/raid_profiles/strip.yml

+ 2
- 1
defaults/main.yml Целия файл

@@ -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




+ 0
- 5
tasks/base_profile.yml Целия файл

@@ -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')}}"


+ 15
- 0
tasks/boot_profile.yml Целия файл

@@ -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
- 0
tasks/main.yml Целия файл

@@ -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


+ 3
- 15
templates/hard_disks_base_profile.json.j2 Целия файл

@@ -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 %}
] ]

+ 22
- 0
templates/hard_disks_boot_profile.json.j2 Целия файл

@@ -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 %}
]

+ 0
- 31
vars/base_profiles/bios-gpt.yml Целия файл

@@ -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

+ 0
- 20
vars/base_profiles/bios-mbr.yml Целия файл

@@ -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

+ 7
- 0
vars/base_profiles/data-partition.yml Целия файл

@@ -0,0 +1,7 @@
partitions:
- prefix: "{{inventory_hostname_short}}-"
suffix: -data
start: 2GiB
end: "{{last_partition_end}}"
typecode: 8300
usage: data

+ 19
- 0
vars/boot_profiles/bios-gpt.yml Целия файл

@@ -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

+ 12
- 0
vars/boot_profiles/bios-mbr.yml Целия файл

@@ -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

vars/base_profiles/efi.yml → vars/boot_profiles/efi.yml Целия файл


+ 2
- 2
vars/main.yml Целия файл

@@ -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 }}"


+ 0
- 3
vars/raid_profiles/mirror.yml Целия файл

@@ -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 }}"


+ 0
- 3
vars/raid_profiles/strip.yml Целия файл

@@ -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 }}"


Loading…
Отказ
Запис