ansible-workstation/roles/base/tasks/archinstall/install_os.yaml

82 lines
2.1 KiB
YAML

---
- name: archinstall | install os | check for presence of previously pacstrapped /mnt
stat:
path: /mnt/usr/lib
register: existing_pacstrap
- debug:
var: existing_pacstrap
- name: archinstall | install os | pacstrap
shell: "pacstrap /mnt {{ packages | join(' ') }}"
vars:
packages:
- ansible
- base
- base-devel
- efibootmgr
- git
- iwd
- linux-firmware
- linux-lts
- linux-lts-headers
- openssh
- zsh
when: not existing_pacstrap.stat.exists
- name: archinstall | install os | copy pacman mirrorlist
copy:
remote_src: true
src: /etc/pacman.d/mirrorlist
dest: /mnt/etc/pacman.d/mirrorlist
- name: archinstall | install os | propagate root authorized keys
copy:
remote_src: true
src: /root/.ssh/authorized_keys
dest: /mnt/root/.ssh/authorized_keys
- name: archinstall | install os | passwordless sudo for group wheel
copy:
content: "%wheel ALL=(ALL) NOPASSWD: ALL"
dest: /mnt/etc/sudoers.d/wheel-group-nopasswd
- name: archinstall | install os | set timezone
file:
src: /usr/share/zoneinfo/US/Central
dest: /mnt/etc/localtime
state: link
- name: archinstall | install os | enable en_US locales
command: sed -i 's/^#en_US/en_US/' /mnt/etc/locale.gen
- name: archinstall | install os | generate locales
command: arch-chroot /mnt locale-gen
- name: archinstall | install os | generate template for arch-chroot installation
template:
src: arch_chroot_install.sh
dest: /mnt/arch_chroot_install.sh
mode: "0755"
- name: archinstall | install os | set hostname
copy:
dest: /mnt/etc/hostname
content: |
{{ inventory_hostname }}
- name: archinstall | install os | run installation script in arch-chroot
command: arch-chroot /mnt /arch_chroot_install.sh
register: chroot
- name: archinstall | install os | arch-chroot install output
debug:
msg: "{{ chroot.stdout_lines }}"
- name: archinstall | install os | remove arch-chroot installation script
file:
path: /mnt/arch_chroot_install.sh
state: absent
# TODO
# - name: archinstall | install os | create fstab