refactor: reorganize Ansible tasks for better structure and include common package installations
All checks were successful
Nix Format Check / check-format (pull_request) Successful in 40s

This commit is contained in:
2025-01-22 15:11:58 +01:00
parent 596a3574df
commit c651722b73
20 changed files with 125 additions and 186 deletions

View File

@@ -3,4 +3,5 @@ mennos-laptop ansible_connection=local
mennos-desktop ansible_connection=local
[servers]
mennos-server ansible_connection=local
mennos-server ansible_connection=local
homeserver-pc ansible_connection=local

View File

@@ -3,69 +3,13 @@
gather_facts: true
tasks:
- name: Include symlinks tasks
ansible.builtin.import_tasks: tasks/symlinks.yml
- name: Include global tasks
ansible.builtin.import_tasks: tasks/global/global.yml
- name: Gather package facts
ansible.builtin.package_facts:
manager: auto
become: true
- name: Include Tailscale tasks
ansible.builtin.import_tasks: tasks/tailscale.yml
become: true
- name: Include VSCode tasks
ansible.builtin.import_tasks: tasks/vscode.yml
when: hostname in ['mennos-laptop', 'mennos-desktop']
become: true
- name: Include Rust tasks
ansible.builtin.import_tasks: tasks/rust.yml
become: true
- name: Include Brave tasks
ansible.builtin.import_tasks: tasks/brave.yml
when: hostname in ['mennos-laptop', 'mennos-desktop']
become: true
- name: Include 1Password tasks
ansible.builtin.import_tasks: tasks/1password.yml
when: hostname in ['mennos-laptop', 'mennos-desktop']
become: true
- name: Include Docker tasks
ansible.builtin.import_tasks: tasks/docker.yml
become: true
- name: Include Ollama tasks
ansible.builtin.import_tasks: tasks/ollama.yml
become: true
- name: Include GNOME Extensions tasks
ansible.builtin.import_tasks: tasks/gnome-extensions.yml
- name: Ensure common packages are installed
ansible.builtin.package:
name:
- git
- vim
- pipx
- trash-cli
- curl
- wget
- flatpak
# Required by Pano - Clipboard Manager (GNOME Extension)
- libgda
- libgda-sqlite
# Required by Bubblemail - Email Notifications (GNOME Extension)
- bubblemail
state: present
become: true
- name: Include flatpaks tasks
ansible.builtin.import_tasks: tasks/flatpaks.yml
- name: Include workstation tasks
ansible.builtin.import_tasks: tasks/workstations/workstation.yml
when: hostname in ['mennos-laptop', 'mennos-desktop']
- name: Include pipx tasks
ansible.builtin.import_tasks: tasks/pipx.yml
- name: Include server tasks
ansible.builtin.import_tasks: tasks/servers/server.yml
when: hostname in ['mennos-server', 'homeserver-pc', 'mennos-vm']

View File

@@ -0,0 +1,38 @@
- name: Include symlinks tasks
ansible.builtin.import_tasks: tasks/global/symlinks.yml
- name: Gather package facts
ansible.builtin.package_facts:
manager: auto
become: true
- name: Include Tailscale tasks
ansible.builtin.import_tasks: tasks/global/tailscale.yml
become: true
- name: Include Rust tasks
ansible.builtin.import_tasks: tasks/global/rust.yml
become: true
- name: Include Docker tasks
ansible.builtin.import_tasks: tasks/global/docker.yml
become: true
- name: Include Ollama tasks
ansible.builtin.import_tasks: tasks/global/ollama.yml
become: true
- name: Ensure common packages are installed
ansible.builtin.package:
name:
- git
- vim
- pipx
- trash-cli
- curl
- wget
state: present
become: true
- name: Include pipx tasks
ansible.builtin.import_tasks: tasks/global/pipx.yml

View File

@@ -1,5 +1,5 @@
- name: Set user home directory
set_fact:
ansible.builtin.set_fact:
user_home: "{{ ansible_env.HOME if ansible_user_id == 'root' else lookup('env', 'HOME') }}"
- name: Create basic symlinks
@@ -7,7 +7,7 @@
src: "{{ item.src | replace('~', user_home) }}"
dest: "{{ item.dest | replace('~', user_home) }}"
state: link
force: yes
force: true
follow: false
loop:
- { src: "~/dotfiles/config/home-manager", dest: "~/.config/home-manager" }
@@ -21,7 +21,7 @@
src: "{{ gitconfig_mapping[hostname] | replace('~', user_home) }}"
dest: "{{ user_home }}/.gitconfig"
state: link
force: yes
force: true
follow: false
vars:
gitconfig_mapping:
@@ -37,7 +37,7 @@
src: "{{ authorized_keys_mapping[hostname] | replace('~', user_home) }}"
dest: "{{ user_home }}/.ssh/authorized_keys"
state: link
force: yes
force: true
follow: false
vars:
authorized_keys_mapping:
@@ -46,4 +46,4 @@
mennos-gamingpc: "~/dotfiles/config/ssh/authorized_keys/mennos-gamingpc"
mennos-laptop: "~/dotfiles/config/ssh/authorized_keys/mennos-laptop"
homeserver-pc: "~/dotfiles/config/ssh/authorized_keys/homeserver-pc"
wsl: "~/dotfiles/config/ssh/authorized_keys/wsl"
wsl: "~/dotfiles/config/ssh/authorized_keys/wsl"

View File

@@ -1,2 +0,0 @@
- name: Install Pano - Clipboard Manager
ansible.builtin.import_tasks: tasks/gnome-extensions/pano.yml

View File

@@ -0,0 +1,6 @@
- name: Ensure common packages are installed
ansible.builtin.package:
name:
- openssh-server
state: present
become: true

View File

@@ -0,0 +1,2 @@
- name: Install Pano - Clipboard Manager
ansible.builtin.import_tasks: tasks/workstations/gnome-extensions/pano.yml

View File

@@ -0,0 +1,30 @@
- name: Include VSCode tasks
ansible.builtin.import_tasks: tasks/workstations/vscode.yml
become: true
- name: Include Brave tasks
ansible.builtin.import_tasks: tasks/workstations/brave.yml
become: true
- name: Include 1Password tasks
ansible.builtin.import_tasks: tasks/workstations/1password.yml
become: true
- name: Include GNOME Extensions tasks
ansible.builtin.import_tasks: tasks/workstations/gnome-extensions.yml
- name: Include flatpaks tasks
ansible.builtin.import_tasks: tasks/workstations/flatpaks.yml
- name: Ensure common packages are installed
ansible.builtin.package:
name:
# Flatpak package manager, used for various applications
- flatpak
# Required by Pano - Clipboard Manager (GNOME Extension)
- libgda
- libgda-sqlite
# Required by Bubblemail - Email Notifications (GNOME Extension)
- bubblemail
state: present
become: true