2024-10-06 21:24:57 +02:00
|
|
|
---
|
2024-10-09 21:40:52 +02:00
|
|
|
- name: Gather the package facts
|
|
|
|
ansible.builtin.package_facts:
|
2024-10-11 17:22:49 +02:00
|
|
|
tags: always
|
2024-10-09 21:40:52 +02:00
|
|
|
|
|
|
|
- name: Create backup structure
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: "~/old_dat"
|
|
|
|
state: "directory"
|
2024-10-11 16:40:13 +02:00
|
|
|
tags: config
|
2024-10-09 21:40:52 +02:00
|
|
|
|
|
|
|
- name: Copy files to backup
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: "~/{{ item }}"
|
2024-10-10 20:37:44 +02:00
|
|
|
dest: "~/old_dat/"
|
2024-10-10 19:47:41 +02:00
|
|
|
remote_src: true
|
2024-10-09 21:40:52 +02:00
|
|
|
loop:
|
|
|
|
- ".config"
|
|
|
|
- ".local/share/applications"
|
|
|
|
- ".mozilla"
|
2024-10-10 20:40:07 +02:00
|
|
|
- ".ssh"
|
2024-10-09 21:40:52 +02:00
|
|
|
- "scripts"
|
2024-10-10 19:53:27 +02:00
|
|
|
ignore_errors: true
|
2024-10-11 16:40:13 +02:00
|
|
|
tags: config
|
2024-10-09 21:40:52 +02:00
|
|
|
|
2024-10-10 20:40:07 +02:00
|
|
|
- name: Remove old/unnecessary files and directories
|
2024-10-09 21:40:52 +02:00
|
|
|
ansible.builtin.file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: "absent"
|
|
|
|
loop:
|
2024-10-10 20:40:07 +02:00
|
|
|
- "~/.emacs.d"
|
2024-10-13 09:23:23 +02:00
|
|
|
- "~/scripts"
|
2024-10-11 16:40:13 +02:00
|
|
|
tags: config
|
2024-10-09 21:40:52 +02:00
|
|
|
|
|
|
|
- name: Copy new files and directories
|
2024-10-13 09:16:01 +02:00
|
|
|
ansible.posix.synchronize:
|
2024-10-09 21:40:52 +02:00
|
|
|
src: "{{ item }}"
|
2024-10-10 20:08:24 +02:00
|
|
|
dest: "~/"
|
2024-10-13 09:16:01 +02:00
|
|
|
owner: false
|
|
|
|
group: false
|
2024-10-09 21:40:52 +02:00
|
|
|
loop:
|
|
|
|
- ".config"
|
|
|
|
- ".face"
|
2024-10-12 15:05:31 +02:00
|
|
|
- ".fonts"
|
2024-10-09 21:40:52 +02:00
|
|
|
- ".gitconfig"
|
|
|
|
- ".gtkrc-2.0"
|
|
|
|
- ".local"
|
2024-10-12 15:05:31 +02:00
|
|
|
- ".themes"
|
2024-10-09 21:40:52 +02:00
|
|
|
- "scripts"
|
2024-10-11 16:40:13 +02:00
|
|
|
tags: config
|
2024-10-09 21:40:52 +02:00
|
|
|
|
2024-10-15 09:56:08 +02:00
|
|
|
- name: Copy new templated files
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: "{{ item }}"
|
|
|
|
dest: "~/"
|
|
|
|
loop:
|
|
|
|
- ".ssh/config.j2"
|
|
|
|
tags: config
|
|
|
|
|
2024-10-09 21:40:52 +02:00
|
|
|
- name: Copy new files and directories (root)
|
2024-10-13 09:16:01 +02:00
|
|
|
ansible.posix.synchronize:
|
2024-10-09 21:40:52 +02:00
|
|
|
src: "{{ item }}"
|
2024-10-10 20:08:24 +02:00
|
|
|
dest: "/"
|
2024-10-13 09:16:01 +02:00
|
|
|
owner: false
|
|
|
|
group: false
|
2024-10-09 21:40:52 +02:00
|
|
|
loop:
|
|
|
|
- "etc"
|
2024-10-12 16:07:24 +02:00
|
|
|
- "usr"
|
2024-10-09 21:40:52 +02:00
|
|
|
become: true
|
2024-10-11 16:40:13 +02:00
|
|
|
tags: config
|
2024-10-09 21:40:52 +02:00
|
|
|
|
2024-10-14 20:47:54 +02:00
|
|
|
- name: Copy config for SDDM (root)
|
2024-10-14 21:14:40 +02:00
|
|
|
ansible.builtin.copy:
|
|
|
|
src: "{{ ansible_env['HOME'] }}/{{ item }}"
|
2024-10-14 20:47:54 +02:00
|
|
|
dest: "/var/lib/sddm/.config/"
|
|
|
|
owner: sddm
|
|
|
|
group: sddm
|
|
|
|
remote_src: true
|
|
|
|
loop:
|
2024-10-14 21:14:40 +02:00
|
|
|
- ".config/kwinoutputconfig.json"
|
|
|
|
- ".config/kcminputrc"
|
2024-10-14 20:47:54 +02:00
|
|
|
become: true
|
|
|
|
tags: config
|
|
|
|
|
2024-10-09 21:40:52 +02:00
|
|
|
- name: x86_64 | Copy files (root)
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: "{{ item }}"
|
|
|
|
dest: "/etc/pacman.conf"
|
|
|
|
loop:
|
2024-10-10 20:00:40 +02:00
|
|
|
- "etc/pacman-x86_64.conf"
|
2024-10-09 21:40:52 +02:00
|
|
|
when: ansible_architecture == "x86_64"
|
|
|
|
become: true
|
2024-10-11 16:40:13 +02:00
|
|
|
tags: config
|
2024-10-09 21:40:52 +02:00
|
|
|
|
|
|
|
- name: Symlink xdg environment variables
|
|
|
|
ansible.builtin.file:
|
|
|
|
src: "~/.config/user-dirs.dirs"
|
|
|
|
dest: "~/.config/environment.d/user-dirs.dirs.conf"
|
|
|
|
state: "link"
|
2024-10-11 16:40:13 +02:00
|
|
|
tags: config
|
2024-10-09 21:40:52 +02:00
|
|
|
|
|
|
|
- name: Bash cat | Download
|
|
|
|
ansible.builtin.git:
|
|
|
|
repo: https://github.com/exu-g/bash-cat-with-cat.git
|
|
|
|
dest: "/tmp/bash-cat-with-cat"
|
2024-10-11 16:40:13 +02:00
|
|
|
tags: config
|
2024-10-09 21:40:52 +02:00
|
|
|
|
|
|
|
- name: Bash cat | Copy to scripts
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: "/tmp/bash-cat-with-cat/cat.sh"
|
|
|
|
dest: "~/scripts/pieces/cat.sh"
|
|
|
|
mode: "0755"
|
2024-10-11 16:40:13 +02:00
|
|
|
tags: config
|
2024-10-09 21:40:52 +02:00
|
|
|
|
2024-11-12 17:01:55 +01:00
|
|
|
# Start async tasks early
|
|
|
|
- name: Import Tasks from async.yml
|
|
|
|
ansible.builtin.import_tasks:
|
|
|
|
file: async.yml
|
|
|
|
tags: config
|
|
|
|
|
2024-10-16 08:16:15 +02:00
|
|
|
- name: Reload system systemd services
|
|
|
|
ansible.builtin.systemd_service:
|
|
|
|
daemon_reload: true
|
|
|
|
become: true
|
|
|
|
tags: services
|
|
|
|
|
2024-10-09 21:40:52 +02:00
|
|
|
- name: Reload user systemd services
|
|
|
|
ansible.builtin.systemd_service:
|
|
|
|
daemon_reload: true
|
2024-10-10 20:15:20 +02:00
|
|
|
scope: user
|
2024-10-11 16:40:13 +02:00
|
|
|
tags: services
|
2024-10-09 21:40:52 +02:00
|
|
|
|
2024-10-16 08:16:15 +02:00
|
|
|
- name: Enable system services
|
2024-10-14 21:07:54 +02:00
|
|
|
ansible.builtin.systemd_service:
|
2024-10-16 08:16:15 +02:00
|
|
|
name: "{{ item }}"
|
|
|
|
state: "started"
|
|
|
|
enabled: true
|
|
|
|
loop:
|
|
|
|
- "fstrim.timer"
|
|
|
|
- "bluetooth.service"
|
|
|
|
- "sddm.service"
|
2024-10-18 10:34:58 +02:00
|
|
|
- "systemd-resolved.service"
|
2024-10-14 21:07:54 +02:00
|
|
|
become: true
|
|
|
|
tags: services
|
|
|
|
|
2024-10-16 08:16:15 +02:00
|
|
|
- name: Enable user services
|
2024-10-09 21:40:52 +02:00
|
|
|
ansible.builtin.systemd_service:
|
2024-10-16 08:16:15 +02:00
|
|
|
name: "{{ item }}"
|
|
|
|
state: "restarted"
|
|
|
|
enabled: true
|
|
|
|
scope: user
|
|
|
|
loop:
|
|
|
|
- "ssh-agent.service"
|
|
|
|
tags: services
|
|
|
|
|
|
|
|
- name: Start system services
|
|
|
|
ansible.builtin.systemd_service:
|
|
|
|
name: "{{ item }}"
|
2024-10-09 21:40:52 +02:00
|
|
|
state: "started"
|
|
|
|
enabled: true
|
2024-10-16 08:16:15 +02:00
|
|
|
loop:
|
|
|
|
- "fstrim.timer"
|
|
|
|
- "bluetooth.service"
|
2024-10-09 21:40:52 +02:00
|
|
|
become: true
|
2024-10-11 16:40:13 +02:00
|
|
|
tags: services
|
2024-10-09 21:40:52 +02:00
|
|
|
|
2024-10-14 21:07:54 +02:00
|
|
|
- name: Enable zram generator
|
|
|
|
ansible.builtin.systemd_service:
|
|
|
|
name: "systemd-zram-setup@zram0.service"
|
|
|
|
state: "started"
|
|
|
|
enabled: true
|
|
|
|
when:
|
|
|
|
- ('zram-generator' in ansible_facts.packages)
|
2024-10-14 21:15:54 +02:00
|
|
|
- ('zswap.enabled=0' in lookup('ansible.builtin.file', '/proc/cmdline'))
|
2024-10-14 21:07:54 +02:00
|
|
|
become: true
|
|
|
|
tags: services
|
|
|
|
|
2024-10-09 21:40:52 +02:00
|
|
|
- name: Enable btrfsmaintenance timers
|
|
|
|
ansible.builtin.systemd_service:
|
|
|
|
name: "{{ item }}"
|
|
|
|
enabled: true
|
|
|
|
loop:
|
|
|
|
- "btrfs-balance.timer"
|
|
|
|
- "btrfs-scrub.timer"
|
|
|
|
when: ('btrfsmaintenance' in ansible_facts.packages)
|
|
|
|
become: true
|
2024-10-11 16:40:13 +02:00
|
|
|
tags: services
|
2024-10-09 21:40:52 +02:00
|
|
|
|
|
|
|
- name: Enable btrfsmaintenance services
|
|
|
|
ansible.builtin.systemd_service:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: "restarted"
|
|
|
|
loop:
|
|
|
|
- "btrfsmaintenance-refresh.service"
|
|
|
|
when: ('btrfsmaintenance' in ansible_facts.packages)
|
|
|
|
become: true
|
2024-10-11 16:40:13 +02:00
|
|
|
tags: services
|
2024-10-09 21:40:52 +02:00
|
|
|
|
|
|
|
- name: Enable reflector
|
|
|
|
ansible.builtin.systemd_service:
|
|
|
|
name: "{{ item }}"
|
|
|
|
enabled: true
|
|
|
|
loop:
|
|
|
|
- "reflector.timer"
|
|
|
|
when: ('reflector' in ansible_facts.packages)
|
|
|
|
become: true
|
2024-10-11 16:40:13 +02:00
|
|
|
tags: services
|
2024-10-09 21:40:52 +02:00
|
|
|
|
|
|
|
- name: Enable NTP
|
|
|
|
ansible.builtin.command: timedatectl set-ntp true
|
|
|
|
become: true
|
2024-10-11 16:40:13 +02:00
|
|
|
tags: services
|
2024-10-10 21:45:05 +02:00
|
|
|
|
|
|
|
- name: Add group for libvirt
|
|
|
|
ansible.builtin.user:
|
|
|
|
name: "{{ ansible_user_id }}"
|
|
|
|
groups:
|
|
|
|
- libvirt
|
|
|
|
append: true
|
|
|
|
when: ('libvirt' in ansible_facts.packages)
|
|
|
|
become: true
|
2024-10-11 16:40:13 +02:00
|
|
|
tags: config
|
2024-10-10 21:45:05 +02:00
|
|
|
|
2024-10-15 16:16:56 +02:00
|
|
|
- name: Enable libvirt socket
|
|
|
|
ansible.builtin.systemd_service:
|
|
|
|
name: "libvirtd.socket"
|
|
|
|
state: "started"
|
|
|
|
enabled: true
|
|
|
|
when: ('libvirt' in ansible_facts.packages)
|
|
|
|
become: true
|
|
|
|
tags: services
|
|
|
|
|
2024-10-27 18:45:06 +01:00
|
|
|
- name: Enable LACT daemon
|
|
|
|
ansible.builtin.systemd_service:
|
|
|
|
name: "lactd"
|
|
|
|
state: "started"
|
|
|
|
enabled: true
|
|
|
|
when: ('lact' in ansible_facts.packages)
|
|
|
|
become: true
|
|
|
|
tags: services
|
|
|
|
|
2024-10-10 21:45:05 +02:00
|
|
|
- name: Create groups
|
|
|
|
ansible.builtin.group:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: present
|
|
|
|
loop:
|
|
|
|
- video # backlight
|
|
|
|
- render # GPU passing
|
|
|
|
- wireguard # wireguard
|
|
|
|
become: true
|
2024-10-11 16:40:13 +02:00
|
|
|
tags: config
|
2024-10-10 21:45:05 +02:00
|
|
|
|
2024-10-11 18:51:51 +02:00
|
|
|
- name: Set fish for user
|
|
|
|
ansible.builtin.user:
|
|
|
|
name: "{{ ansible_user_id }}"
|
|
|
|
shell: "/usr/bin/fish"
|
2024-10-11 18:58:32 +02:00
|
|
|
become: true
|
2024-10-11 18:52:59 +02:00
|
|
|
tags: config
|
2024-10-11 18:51:51 +02:00
|
|
|
|
|
|
|
- name: Set fish for root
|
|
|
|
ansible.builtin.user:
|
|
|
|
name: "root"
|
|
|
|
shell: "/usr/bin/fish"
|
|
|
|
become: true
|
2024-10-11 18:52:59 +02:00
|
|
|
tags: config
|
2024-10-11 18:51:51 +02:00
|
|
|
|
2024-10-10 21:45:05 +02:00
|
|
|
- name: Add user to groups
|
|
|
|
ansible.builtin.user:
|
|
|
|
name: "{{ ansible_user_id }}"
|
|
|
|
groups:
|
|
|
|
- video # backlight
|
|
|
|
- render # GPU passing
|
|
|
|
- wireguard # wireguard
|
|
|
|
append: true
|
2024-10-11 17:11:30 +02:00
|
|
|
become: true
|
2024-10-11 16:40:13 +02:00
|
|
|
tags: config
|
2024-10-10 21:45:05 +02:00
|
|
|
|
2024-10-18 10:34:58 +02:00
|
|
|
- name: Symlink systemd-resolved config file for /etc/resolv.conf
|
|
|
|
ansible.builtin.file:
|
|
|
|
src: "/run/systemd/resolve/stub-resolv.conf"
|
|
|
|
dest: "/etc/resolv.conf"
|
|
|
|
state: link
|
|
|
|
force: true
|
|
|
|
become: true
|
|
|
|
tags: config
|
|
|
|
|
2024-10-10 21:45:05 +02:00
|
|
|
- name: Set sudoers.d permissions
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: /etc/sudoers.d
|
|
|
|
mode: "600"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
recurse: true
|
|
|
|
become: true
|
2024-10-11 16:40:13 +02:00
|
|
|
tags: config
|
2024-10-10 21:45:05 +02:00
|
|
|
|
|
|
|
- name: Make scripts executable
|
2024-10-11 16:40:13 +02:00
|
|
|
ansible.builtin.file:
|
2024-10-10 21:45:05 +02:00
|
|
|
path: "{{ item }}"
|
|
|
|
mode: u+x,g+x,o+x
|
|
|
|
recurse: true
|
|
|
|
loop:
|
|
|
|
- "~/scripts"
|
2024-10-16 08:18:07 +02:00
|
|
|
- "~/.local/share/applications/*.desktop"
|
2024-10-11 16:40:13 +02:00
|
|
|
tags: config
|
2024-10-10 21:45:05 +02:00
|
|
|
|
|
|
|
- name: Reload applications
|
|
|
|
ansible.builtin.shell:
|
|
|
|
cmd: "update-desktop-database ~/.local/share/applications/"
|
2024-10-11 16:40:13 +02:00
|
|
|
tags: config
|
|
|
|
|
2024-10-30 14:55:18 +01:00
|
|
|
- name: Import Tasks from plasma.yml
|
2024-10-16 08:21:55 +02:00
|
|
|
ansible.builtin.import_tasks:
|
2024-10-15 20:56:26 +02:00
|
|
|
file: plasma.yml
|
2024-10-16 08:23:03 +02:00
|
|
|
tags: config
|
2024-11-12 17:01:55 +01:00
|
|
|
|
|
|
|
# Async task callbacks
|
|
|
|
- name: Import Tasks from async_check.yml
|
|
|
|
ansible.builtin.import_tasks:
|
|
|
|
file: async_check.yml
|
|
|
|
tags: config
|