2024-10-06 21:24:57 +02:00
|
|
|
---
|
2024-10-09 21:40:52 +02:00
|
|
|
# - name: Include tasks from preparation.yml
|
|
|
|
# ansible.builtin.include_tasks:
|
|
|
|
# file: preparation.yml
|
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:
|
|
|
|
|
|
|
|
- name: Create backup structure
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: "~/old_dat"
|
|
|
|
state: "directory"
|
|
|
|
|
|
|
|
- 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-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:
|
|
|
|
- "~/.config/Vorlagen"
|
2024-10-10 20:40:07 +02:00
|
|
|
- "~/.emacs.d"
|
|
|
|
- "~/scripts/archive"
|
2024-10-09 21:40:52 +02:00
|
|
|
- "~/scripts/in_path"
|
|
|
|
- "~/scripts/pieces"
|
|
|
|
- "~/scripts/polybar"
|
|
|
|
|
|
|
|
# - name: Include tasks from copy_new.yml
|
|
|
|
# ansible.builtin.include_tasks:
|
|
|
|
# file: copy_new.yml
|
|
|
|
|
|
|
|
- name: Copy new files and directories
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: "{{ item }}"
|
2024-10-10 20:08:24 +02:00
|
|
|
dest: "~/"
|
2024-10-09 21:40:52 +02:00
|
|
|
loop:
|
|
|
|
- ".config"
|
|
|
|
- ".face"
|
|
|
|
- ".gitconfig"
|
|
|
|
- ".gtkrc-2.0"
|
|
|
|
- ".local"
|
|
|
|
- ".ssh"
|
|
|
|
- "scripts"
|
|
|
|
|
|
|
|
- name: Copy new files and directories (root)
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: "{{ item }}"
|
2024-10-10 20:08:24 +02:00
|
|
|
dest: "/"
|
2024-10-09 21:40:52 +02:00
|
|
|
loop:
|
|
|
|
- "etc"
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- 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
|
|
|
|
|
|
|
|
- name: Symlink xdg environment variables
|
|
|
|
ansible.builtin.file:
|
|
|
|
src: "~/.config/user-dirs.dirs"
|
|
|
|
dest: "~/.config/environment.d/user-dirs.dirs.conf"
|
|
|
|
state: "link"
|
|
|
|
|
|
|
|
- name: Bash cat | Download
|
|
|
|
ansible.builtin.git:
|
|
|
|
repo: https://github.com/exu-g/bash-cat-with-cat.git
|
|
|
|
dest: "/tmp/bash-cat-with-cat"
|
|
|
|
|
|
|
|
- name: Bash cat | Copy to scripts
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: "/tmp/bash-cat-with-cat/cat.sh"
|
|
|
|
dest: "~/scripts/pieces/cat.sh"
|
|
|
|
mode: "0755"
|
|
|
|
|
|
|
|
- name: Reload user systemd services
|
|
|
|
ansible.builtin.systemd_service:
|
|
|
|
daemon_reload: true
|
2024-10-10 20:15:20 +02:00
|
|
|
scope: user
|
2024-10-09 21:40:52 +02:00
|
|
|
|
|
|
|
- name: Enable fstrim
|
|
|
|
ansible.builtin.systemd_service:
|
|
|
|
name: fstrim.timer
|
|
|
|
state: "started"
|
|
|
|
enabled: true
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- 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
|
|
|
|
|
|
|
|
- name: Enable btrfsmaintenance services
|
|
|
|
ansible.builtin.systemd_service:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: "restarted"
|
|
|
|
loop:
|
|
|
|
- "btrfsmaintenance-refresh.service"
|
|
|
|
when: ('btrfsmaintenance' in ansible_facts.packages)
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Enable reflector
|
|
|
|
ansible.builtin.systemd_service:
|
|
|
|
name: "{{ item }}"
|
|
|
|
enabled: true
|
|
|
|
loop:
|
|
|
|
- "reflector.timer"
|
|
|
|
when: ('reflector' in ansible_facts.packages)
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Enable NTP
|
|
|
|
ansible.builtin.command: timedatectl set-ntp true
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Enable ssh-agent
|
|
|
|
ansible.builtin.systemd_service:
|
|
|
|
name: ssh-agent
|
|
|
|
state: "restarted"
|
|
|
|
enabled: true
|
2024-10-10 20:15:20 +02:00
|
|
|
scope: user
|
2024-10-10 20:27:06 +02:00
|
|
|
|
|
|
|
- name: Enable sddm
|
|
|
|
ansible.builtin.systemd_service:
|
|
|
|
name: sddm
|
|
|
|
enabled: true
|
|
|
|
become: true
|
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
|
|
|
|
|
|
|
|
- name: Create groups
|
|
|
|
ansible.builtin.group:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: present
|
|
|
|
loop:
|
|
|
|
- video # backlight
|
|
|
|
- render # GPU passing
|
|
|
|
- wireguard # wireguard
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Add user to groups
|
|
|
|
ansible.builtin.user:
|
|
|
|
name: "{{ ansible_user_id }}"
|
|
|
|
groups:
|
|
|
|
- video # backlight
|
|
|
|
- render # GPU passing
|
|
|
|
- wireguard # wireguard
|
|
|
|
append: true
|
|
|
|
|
|
|
|
- name: Set sudoers.d permissions
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: /etc/sudoers.d
|
|
|
|
mode: "600"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
recurse: true
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Make scripts executable
|
|
|
|
ansible.builin.file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
mode: u+x,g+x,o+x
|
|
|
|
recurse: true
|
|
|
|
loop:
|
|
|
|
- "~/scripts"
|
|
|
|
- "~/.local/share/applications"
|
|
|
|
|
|
|
|
- name: Reload applications
|
|
|
|
ansible.builtin.shell:
|
|
|
|
cmd: "update-desktop-database ~/.local/share/applications/"
|