Bläddra i källkod

boot profiles

boot-profiles
förälder
incheckning
bd8fde015f
15 ändrade filer med 84 tillägg och 80 borttagningar
  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 Visa fil

@@ -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_crypt_profile: none



+ 0
- 5
tasks/base_profile.yml Visa fil

@@ -5,11 +5,6 @@
file: "base_profiles/{{partitioning_base_profile}}.yml"
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
set_fact:
hard_disks: "{{lookup('template','hard_disks_base_profile.json.j2')}}"


+ 15
- 0
tasks/boot_profile.yml Visa fil

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

@@ -2,6 +2,8 @@

- import_tasks: scan.yml

- import_tasks: boot_profile.yml

- import_tasks: base_profile.yml

- import_tasks: raid_profile.yml


+ 3
- 15
templates/hard_disks_base_profile.json.j2 Visa fil

@@ -1,22 +1,10 @@
[
{% 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 %} #}
]
"device": "{{hd.device}}",
"label_type": "{{ hd.label_type }}",
"partitions": {{ hd.partitions + _partitioning_base_profile.partitions }}
},
{% endfor %}
]

+ 22
- 0
templates/hard_disks_boot_profile.json.j2 Visa fil

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

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

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

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

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

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


+ 2
- 2
vars/main.yml Visa fil

@@ -1,5 +1,5 @@
_host_vars_filename: partitioning
_host_vars_default: {}
_host_vars_filename: partitioning
_host_vars_default: {}
_host_vars:
hard_disks: "{{ hard_disks }}"
mdraid_devices: "{{ mdraid_devices }}"


+ 0
- 3
vars/raid_profiles/mirror.yml Visa fil

@@ -2,9 +2,6 @@ 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/data
level: 1
devices: "{{ hard_disks | json_query(\"[].partitions[?usage=='data'][].device\") | list }}"


+ 0
- 3
vars/raid_profiles/strip.yml Visa fil

@@ -2,9 +2,6 @@ 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/data
level: 0
devices: "{{ hard_disks | json_query(\"[].partitions[?usage=='data'][].device\") | list }}"


Laddar…
Avbryt
Spara