arch-setup/tasks/setup.yml

195 lines
4.3 KiB
YAML

- name: copy reflector configuration
become: true
template:
src: 'templates/reflector.j2'
dest: '/etc/xdg/reflector/reflector.conf'
owner: root
group: root
mode: '0600'
# started by weekly timer
- name: disable reflector
become: true
systemd:
name: reflector
state: stopped
enabled: false
- name: copy pacman configuration
become: true
template:
src: 'templates/pacman.j2'
dest: '/etc/pacman.conf'
owner: root
group: root
mode: '0644'
- name: create extra conf
become: true
file:
path: '/etc/pacman.d/extra.conf'
owner: root
group: root
state: touch
mode: '0644'
- name: create wezterm configuration dir
file:
path: '{{ xdg_config_dir }}/wezterm/includes'
state: directory
- name: copy wezterm configuration files
template:
src: '{{ item.src }}'
dest: '{{ item.dest }}'
loop:
- {
src: 'templates/wezterm/wezterm.lua.j2',
dest: '{{ xdg_config_dir }}/wezterm/wezterm.lua'
}
- {
src: 'templates/wezterm/includes/colors.lua.j2',
dest: '{{ xdg_config_dir }}/wezterm/includes/colors.lua'
}
- {
src: 'templates/wezterm/includes/fonts.lua.j2',
dest: '{{ xdg_config_dir }}/wezterm/includes/fonts.lua'
}
- {
src: 'templates/wezterm/includes/window.lua.j2',
dest: '{{ xdg_config_dir }}/wezterm/includes/window.lua'
}
- name: enable fstrim timer
become: true
systemd:
name: fstrim.timer
enabled: true
- name: remove the sysctl.d directory
become: true
file:
path: /etc/sysctl.d
state: absent
- name: recreate the sysctl.d directory
become: true
file:
path: /etc/sysctl.d
state: directory
mode: 755
- name: copy sysctl files
become: true
template:
src: '{{ item.src }}'
dest: '{{ item.dest }}'
loop:
- {
src: 'templates/{{ platform }}/sysctl/99-sysrq.conf.j2',
dest: '/etc/sysctl.d/99-sysrq.conf'
}
- {
src: 'templates/{{ platform }}/sysctl/98-forward.conf.j2',
dest: '/etc/sysctl.d/98-foward.conf'
}
notify: reload sysctl configuration
- name: remove the modprobe.d directory
become: true
file:
path: /etc/modprobe.d
state: absent
- name: recreate the modprobe.d directory
become: true
file:
path: /etc/modprobe.d
state: directory
mode: 755
- name: copy modprobe configuration files
become: true
template:
src: '{{ item.src }}'
dest: '{{ item.dest }}'
loop: '{{ modprobe_templates }}'
when: modprobe_templates
- name: copy kernel parameters template
become: true
template:
src: 'templates/{{ platform }}/cmdline.j2'
dest: '/etc/kernel/cmdline'
- name: remove the mkinitcpio directories
become: true
file:
path: '{{ item }}'
state: absent
loop:
- /etc/mkinitcpio.conf.d
- /etc/mkinitcpio.d
- name: recreate the mkinitcpio directories
become: true
file:
path: '{{ item }}'
state: directory
mode: 755
loop:
- /etc/mkinitcpio.conf.d
- /etc/mkinitcpio.d
- name: copy mkinitcpio configuration files
become: true
template:
src: '{{ item.src }}'
dest: '{{ item.dest }}'
loop: '{{ mkinitcpio_templates }}'
when: mkinitcpio_templates
- name: regenerate initramfs images
become: true
command: 'mkinitcpio --allpresets'
register: mkinitcpio_stats
- name: log mkinitcpio stdout
debug:
var: mkinitcpio_stats.stdout_lines
- name: create a Linux UEFI boot entry
become: true
command: efibootmgr \
--create \
--disk '{{ boot_configuration.disk }}' \
--part '{{ boot_configuration.partition }}' \
--label 'Arch Linux' \
--loader '\EFI\Linux\linux.efi'\
--unicode
--index 0
register: efi_linux_stats
when: register_uefi_entries
- name: log efibootmgr stdout
debug:
var: efi_linux_stats.stdout_lines
when: register_uefi_entries
- name: create a Linux LTS UEFI boot entry
become: true
command: efibootmgr \
--create \
--disk '{{ boot_configuration.disk }}' \
--part '{{ boot_configuration.partition }}' \
--label 'Arch Linux LTS' \
--loader '\EFI\Linux\linux-lts.efi'\
--unicode
--index 1
register: efi_linux_lts_stats
when: register_uefi_entries
- name: log efibootmgr LTS stdout
debug:
var: efi_linux_lts_stats.stdout_lines
when: register_uefi_entries