try this using ansible-pull
This commit is contained in:
parent
1444f05d9c
commit
2b7d4e9c77
9 changed files with 69 additions and 23 deletions
9
inventory/host_vars/hulder.yaml
Normal file
9
inventory/host_vars/hulder.yaml
Normal file
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
ansible_user: root
|
||||
ansible_host: 10.4.0.49
|
||||
|
||||
base_root_swap_mib: "{{ 1024 * 16 }}"
|
||||
base_root_efi_mib: 512
|
||||
base_root_free_percent: 2
|
||||
base_root_disks:
|
||||
- /dev/nvme0n1
|
|
@ -1,2 +1,2 @@
|
|||
[desktop]
|
||||
vmguest
|
||||
[base]
|
||||
hulder
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
---
|
||||
- hosts: localhost
|
||||
- import_playbook: playbooks/install.yaml
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
- name: Partition base filesystem
|
||||
shell: echo poop
|
||||
when: base_partition_devices is defined
|
||||
|
|
@ -4,6 +4,3 @@
|
|||
- name: is this a livecd?
|
||||
debug:
|
||||
msg: "{{ ansible_nodename }} {{ ansible_nodename == 'archiso' }}"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
- name: Provision new workstation from scratch
|
||||
tags: base
|
||||
- name: Provision new Arch workstation from scratch
|
||||
hosts: all
|
||||
tags: base
|
||||
roles:
|
||||
- base
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
}}
|
||||
with_items: "{{ base_partitions_by_id | dict2items }}"
|
||||
|
||||
- debug:
|
||||
var: base_root_partitions | map('extract', partition_device_to_ids) | map('first')
|
||||
|
||||
- name: Create zroot volume
|
||||
become: true
|
||||
command: >-
|
||||
|
@ -32,7 +35,7 @@
|
|||
-O canmount=off
|
||||
-O mountpoint=none
|
||||
-R /mnt
|
||||
zroot {{ mirror }} {{ base_root_partitions | map('extract', partition_device_to_ids) | flatten | list | join(' ') }}
|
||||
zroot {{ mirror }} {{ base_root_partitions | map('extract', partition_device_to_ids) | map('first') | flatten | list | join(' ') }}
|
||||
vars:
|
||||
mirror: "{{ 'mirror' if base_root_partitions | length > 1 else '' }}"
|
||||
when: zroot_check.rc != 0
|
||||
|
|
|
@ -69,9 +69,24 @@
|
|||
loop: "{{ base_root_disks_info.results }}"
|
||||
register: parted_create
|
||||
|
||||
- name: Store EFI partition details
|
||||
- name: Collect EFI partition devices
|
||||
command: "lsblk -r --noheadings -o PATH {{ item }}"
|
||||
register: lsblk
|
||||
loop: "{{ parted_create.results | map(attribute='disk.dev') }}"
|
||||
|
||||
- debug:
|
||||
var: lsblk
|
||||
|
||||
- name: Store EFI partition devices
|
||||
set_fact:
|
||||
base_efi_partitions: "{{ parted_create.results | map(attribute='disk.dev') | product([1]) | map('join') | list }}"
|
||||
base_efi_partitions: >-
|
||||
{{ base_efi_partitions|d([]) + [
|
||||
item[part_index+1]
|
||||
]
|
||||
}}
|
||||
loop: "{{ lsblk.results | map(attribute='stdout_lines') }}"
|
||||
vars:
|
||||
part_index: 0
|
||||
|
||||
- name: Create root zvol partition
|
||||
become: true
|
||||
|
@ -89,9 +104,21 @@
|
|||
loop: "{{ parted_create.results }}"
|
||||
register: parted_create
|
||||
|
||||
- name: Store root zvol partition details
|
||||
- name: Collect root zvol partition devices
|
||||
command: "lsblk -r --noheadings -o PATH {{ item }}"
|
||||
register: lsblk
|
||||
loop: "{{ parted_create.results | map(attribute='disk.dev') }}"
|
||||
|
||||
- name: Store EFI partition devices
|
||||
set_fact:
|
||||
base_root_partitions: "{{ parted_create.results | map(attribute='disk.dev') | product([2]) | map('join') | list }}"
|
||||
base_root_partitions: >-
|
||||
{{ base_root_partitions|d([]) + [
|
||||
item[part_index+1]
|
||||
]
|
||||
}}
|
||||
loop: "{{ lsblk.results | map(attribute='stdout_lines') }}"
|
||||
vars:
|
||||
part_index: 1
|
||||
|
||||
- name: Create swap partition
|
||||
become: true
|
||||
|
@ -108,12 +135,23 @@
|
|||
fs_type: linux-swap
|
||||
loop: "{{ parted_create.results }}"
|
||||
register: parted_create
|
||||
when: base_root_swap_mib is defined and base_root_swap_mib > 0
|
||||
when: base_root_swap_mib is defined and base_root_swap_mib|int > 0
|
||||
|
||||
- name: Store swap partition details
|
||||
- name: Collect swap partition devices
|
||||
command: "lsblk -r --noheadings -o PATH {{ item }}"
|
||||
register: lsblk
|
||||
loop: "{{ parted_create.results | map(attribute='disk.dev') }}"
|
||||
|
||||
- name: Store EFI partition devices
|
||||
set_fact:
|
||||
base_swap_partitions: "{{ parted_create.results | map(attribute='disk.dev') | product([3]) | map('join') | list }}"
|
||||
when: base_root_swap_mib is defined and base_root_swap_mib > 0
|
||||
base_swap_partitions: >-
|
||||
{{ base_swap_partitions|d([]) + [
|
||||
item[part_index+1]
|
||||
]
|
||||
}}
|
||||
loop: "{{ lsblk.results | map(attribute='stdout_lines') }}"
|
||||
vars:
|
||||
part_index: 2
|
||||
|
||||
- name: Analyze resulting partition layouts
|
||||
parted:
|
||||
|
@ -136,3 +174,7 @@
|
|||
| map('list')
|
||||
)
|
||||
}}
|
||||
|
||||
- debug: var=base_efi_partitions
|
||||
- debug: var=base_root_partitions
|
||||
- debug: var=base_swap_partitions
|
||||
|
|
|
@ -56,8 +56,7 @@ function configure_zfs_initrd {
|
|||
# Add 'zfs' to MODULES=()
|
||||
sed -i '/^MODULES=/!b;/zfs/!s/)/zfs)/' /etc/mkinitcpio.conf
|
||||
initrd=/boot/initramfs-linux-lts.img
|
||||
[[ ! -e $initrd || $initrd -ot /etc/mkinitcpio.conf ]] || mkinitcpio -P
|
||||
# ^ only rebuild if initrd image is older than mkinitpio.conf
|
||||
[[ ! -e "$initrd" || "$initrd" -ot /etc/mkinitcpio.conf ]] && mkinitcpio -P
|
||||
}
|
||||
|
||||
function configure_dhcp_ethernet {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue