ansible-lint --fix
This commit is contained in:
parent
5634cd32d3
commit
faa046aa21
21 changed files with 181 additions and 179 deletions
|
@ -6,8 +6,8 @@
|
|||
register: base_root_disks_info
|
||||
loop: "{{ base_root_disks | list }}"
|
||||
|
||||
- name: partition | ensure efi is not mounted
|
||||
mount:
|
||||
- name: partition | Ensure efi is not mounted
|
||||
ansible.posix.mount:
|
||||
path: /mnt/boot/efi
|
||||
state: unmounted
|
||||
|
||||
|
@ -15,20 +15,21 @@
|
|||
ansible.builtin.set_fact:
|
||||
base_root_usable_mib: "{{ (base_root_disks_info.results | map(attribute='disk.size') | min | int) - 1 }}"
|
||||
|
||||
- debug: var=base_root_usable_mib
|
||||
|
||||
- ansible.builtin.debug:
|
||||
var: base_root_usable_mib
|
||||
- name: Calculate disk utilization percentage
|
||||
ansible.builtin.set_fact:
|
||||
base_root_usable_mib: "{{ base_root_usable_mib|int - ((base_root_usable_mib|float) * (0.01 * (base_root_free_percent|float))) | round(method='floor') | int }}"
|
||||
base_root_usable_mib: "{{ base_root_usable_mib | int - ((base_root_usable_mib | float) * (0.01 * (base_root_free_percent | float))) | round(method='floor') |
|
||||
int }}"
|
||||
|
||||
- name: Calculate zfs volume size
|
||||
set_fact:
|
||||
base_root_zpool_mib: "{{ base_root_usable_mib|int - fixed_size_partitions|int }}"
|
||||
ansible.builtin.set_fact:
|
||||
base_root_zpool_mib: "{{ base_root_usable_mib | int - fixed_size_partitions | int }}"
|
||||
vars:
|
||||
fixed_size_partitions: "{{ base_root_swap_mib|int + base_root_efi_mib|int }}"
|
||||
fixed_size_partitions: "{{ base_root_swap_mib | int + base_root_efi_mib | int }}"
|
||||
#
|
||||
- name: Calculate partition layouts
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
partition_ranges: >-
|
||||
{{
|
||||
(partition_ranges|d([])) + [{
|
||||
|
@ -47,11 +48,11 @@
|
|||
- name: swap
|
||||
size_mib: "{{ base_root_swap_mib }}"
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
var: partition_ranges
|
||||
|
||||
- name: Initialize partition facts
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
base_efi_partitions: []
|
||||
base_root_partitions: []
|
||||
base_swap_partitions: []
|
||||
|
@ -61,14 +62,14 @@
|
|||
become: true
|
||||
vars:
|
||||
part_index: 0
|
||||
parted:
|
||||
community.general.parted:
|
||||
label: gpt
|
||||
unit: MiB
|
||||
name: EFI Boot
|
||||
device: "{{ item.disk.dev }}"
|
||||
number: "{{ part_index + 1 }}"
|
||||
flags: [ boot, esp ]
|
||||
part_start: "{{ [partition_ranges[part_index].begin, 1]|max }}MiB"
|
||||
flags: [boot, esp]
|
||||
part_start: "{{ [partition_ranges[part_index].begin, 1] | max }}MiB"
|
||||
part_end: "{{ partition_ranges[part_index].end }}MiB"
|
||||
state: present
|
||||
fs_type: fat32
|
||||
|
@ -76,12 +77,12 @@
|
|||
register: parted_create
|
||||
|
||||
- name: Collect EFI partition devices
|
||||
shell: "lsblk -r --noheadings -o PATH {{ item }} | sort"
|
||||
ansible.builtin.shell: "lsblk -r --noheadings -o PATH {{ item }} | sort"
|
||||
register: lsblk
|
||||
loop: "{{ parted_create.results | map(attribute='disk.dev') }}"
|
||||
|
||||
- name: Store EFI partition devices
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
base_efi_partitions: >-
|
||||
{{ base_efi_partitions|d([]) + [
|
||||
item[part_index+1]
|
||||
|
@ -91,14 +92,13 @@
|
|||
vars:
|
||||
part_index: 0
|
||||
|
||||
- debug: var=base_efi_partitions
|
||||
|
||||
#### zroot
|
||||
- ansible.builtin.debug:
|
||||
var: base_efi_partitions
|
||||
- name: Create root zvol partition
|
||||
become: true
|
||||
vars:
|
||||
part_index: 1
|
||||
parted:
|
||||
community.general.parted:
|
||||
label: gpt
|
||||
unit: MiB
|
||||
name: ArchLinux ZFS Root
|
||||
|
@ -111,12 +111,12 @@
|
|||
register: parted_create
|
||||
|
||||
- name: Collect root zvol partition devices
|
||||
shell: "lsblk -r --noheadings -o PATH {{ item }} | sort"
|
||||
ansible.builtin.shell: "lsblk -r --noheadings -o PATH {{ item }} | sort"
|
||||
register: lsblk
|
||||
loop: "{{ parted_create.results | map(attribute='disk.dev') }}"
|
||||
|
||||
- name: Store root zvol partition devices
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
base_root_partitions: >-
|
||||
{{ base_root_partitions|d([]) + [
|
||||
item[part_index+1]
|
||||
|
@ -131,7 +131,7 @@
|
|||
become: true
|
||||
vars:
|
||||
part_index: 2
|
||||
parted:
|
||||
community.general.parted:
|
||||
label: gpt
|
||||
unit: MiB
|
||||
device: "{{ item.disk.dev }}"
|
||||
|
@ -145,13 +145,13 @@
|
|||
when: base_root_swap_mib is defined and base_root_swap_mib|int > 0
|
||||
|
||||
- name: Collect swap partition devices
|
||||
shell: "lsblk -r --noheadings -o PATH {{ item }} | sort"
|
||||
ansible.builtin.shell: "lsblk -r --noheadings -o PATH {{ item }} | sort"
|
||||
register: lsblk
|
||||
loop: "{{ parted_create.results | map(attribute='disk.dev') }}"
|
||||
when: base_root_swap_mib is defined and base_root_swap_mib|int > 0
|
||||
|
||||
- name: Store swap partition devices
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
base_swap_partitions: >-
|
||||
{{ base_swap_partitions|d([]) + [
|
||||
item[part_index+1]
|
||||
|
@ -163,18 +163,18 @@
|
|||
when: base_root_swap_mib is defined and base_root_swap_mib|int > 0
|
||||
|
||||
- name: Analyze resulting partition layouts
|
||||
parted:
|
||||
community.general.parted:
|
||||
unit: MiB
|
||||
device: "{{ item }}"
|
||||
register: base_root_disks_info
|
||||
loop: "{{ base_root_disks | list }}"
|
||||
|
||||
- name: Collect disk device identifiers
|
||||
shell: "for x in /dev/disk/by-id/*; do echo $x $(realpath $x); done"
|
||||
ansible.builtin.shell: "for x in /dev/disk/by-id/*; do echo $x $(realpath $x); done"
|
||||
register: disk_realpaths
|
||||
|
||||
- name: Collect disk device identifiers into a base_partitions_by_id dictionary
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
base_partitions_by_id: >-
|
||||
{{
|
||||
dict(
|
||||
|
@ -184,6 +184,9 @@
|
|||
)
|
||||
}}
|
||||
|
||||
- debug: var=base_efi_partitions
|
||||
- debug: var=base_root_partitions
|
||||
- debug: var=base_swap_partitions
|
||||
- ansible.builtin.debug:
|
||||
var: base_efi_partitions
|
||||
- ansible.builtin.debug:
|
||||
var: base_root_partitions
|
||||
- ansible.builtin.debug:
|
||||
var: base_swap_partitions
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue