From 4c59b1592a16ceb2589857922ba94c9a60ad4990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Grondek?= Date: Sat, 11 May 2024 12:55:24 +0200 Subject: [PATCH] Refactor desktop role --- roles/desktop/tasks/arch.yml | 59 +++---------------------- roles/desktop/tasks/audio.yml | 2 + roles/desktop/tasks/bluetooth.yml | 1 + roles/desktop/tasks/cron.yml | 14 ++++++ roles/desktop/tasks/cups.yml | 19 ++++++++ roles/desktop/tasks/dotfiles.yml | 1 - roles/desktop/tasks/flatpaks.yml | 15 +++++++ roles/desktop/tasks/fonts.yml | 10 +++++ roles/desktop/tasks/main.yml | 10 +++++ roles/desktop/tasks/network-manager.yml | 15 +++++++ roles/desktop/tasks/signal.yml | 8 ++-- roles/desktop/tasks/ubuntu.yml | 3 +- roles/desktop/tasks/xorg.yml | 15 +++++++ 13 files changed, 111 insertions(+), 61 deletions(-) create mode 100644 roles/desktop/tasks/cron.yml create mode 100644 roles/desktop/tasks/cups.yml create mode 100644 roles/desktop/tasks/fonts.yml create mode 100644 roles/desktop/tasks/network-manager.yml create mode 100644 roles/desktop/tasks/xorg.yml diff --git a/roles/desktop/tasks/arch.yml b/roles/desktop/tasks/arch.yml index 586ce6e..6b437df 100644 --- a/roles/desktop/tasks/arch.yml +++ b/roles/desktop/tasks/arch.yml @@ -1,41 +1,25 @@ --- -- name: install basic system +- name: "[Arch] install basic system" become: yes community.general.pacman: name: - btrfs-progs - - cronie - dhcpcd - efibootmgr - - grub - - xorg-xinit - - polkit-gnome - - xdg-desktop-portal-gtk - helvum -- name: "Enable cron service" - become: yes - ansible.builtin.systemd: - name: cronie - state: started - enabled: yes - -- name: install terminal packages [Arch] +- name: "[Arch] install terminal packages" become: yes community.general.pacman: name: - - autorandr - bash-completion - bind - - bluez - - brightnessctl - graphviz - htop - imagemagick - less - net-tools - neofetch - - networkmanager - screen - tmux - traceroute @@ -44,9 +28,9 @@ - name: "[Arch] install terminal packages" shell: cmd: - yay -S --needed --noconfirm epson-inkjet-printer-escpr pm-utils + yay -S --needed --noconfirm pm-utils -- name: install gui packages +- name: "[Arch] install gui packages" become: yes community.general.pacman: name: @@ -58,44 +42,11 @@ - gnome-themes-extra - gsimplecal - libreoffice-still - - network-manager-applet - - nm-connection-editor - nautilus - - numlockx - openscad - - pavucontrol - - pasystray - - picom - - redshift - thunderbird - - xdotool - - xorg-xkill - - xorg-xwininfo -- name: Install some fonts - become: yes - community.general.pacman: - name: - - ttf-dejavu - - ttf-fira-code - - ttf-font-awesome - - ttf-liberation - - ttf-ubuntu-font-family - -- name: "Enable network manager" - become: yes - ansible.builtin.systemd: - name: NetworkManager.service - state: started - enabled: yes - -- name: install flatpak - become: yes - community.general.pacman: - name: - - flatpak - -- name: copy scripts +- name: "[Arch] copy scripts" become: yes copy: src: "usr/local/sbin/{{item}}" diff --git a/roles/desktop/tasks/audio.yml b/roles/desktop/tasks/audio.yml index 11fabcb..0dd0e39 100644 --- a/roles/desktop/tasks/audio.yml +++ b/roles/desktop/tasks/audio.yml @@ -3,6 +3,8 @@ become: yes community.general.pacman: name: + - pavucontrol + - pasystray - pipewire - pipewire-alsa - pipewire-pulse diff --git a/roles/desktop/tasks/bluetooth.yml b/roles/desktop/tasks/bluetooth.yml index c4de77a..32489d1 100644 --- a/roles/desktop/tasks/bluetooth.yml +++ b/roles/desktop/tasks/bluetooth.yml @@ -4,6 +4,7 @@ community.general.pacman: name: - blueman + - bluez - name: "[All] Enable service" become: yes diff --git a/roles/desktop/tasks/cron.yml b/roles/desktop/tasks/cron.yml new file mode 100644 index 0000000..19e62a8 --- /dev/null +++ b/roles/desktop/tasks/cron.yml @@ -0,0 +1,14 @@ +- name: "[Arch] Install cron" + become: yes + community.general.pacman: + name: + - cronie + when: ansible_distribution == "Archlinux" + +- name: "[Arch] Enable cron service" + become: yes + ansible.builtin.systemd: + name: cronie + state: started + enabled: yes + when: ansible_distribution == "Archlinux" diff --git a/roles/desktop/tasks/cups.yml b/roles/desktop/tasks/cups.yml new file mode 100644 index 0000000..323faac --- /dev/null +++ b/roles/desktop/tasks/cups.yml @@ -0,0 +1,19 @@ +- name: "[Arch] cups" + become: yes + community.general.pacman: + name: + - cups + when: ansible_distribution == "Archlinux" + +- name: "[Arch] install drivers for epson printer" + shell: + cmd: + yay -S --needed --noconfirm epson-inkjet-printer-escpr + when: ansible_distribution == "Archlinux" + +- name: "[All] Enable service" + become: yes + ansible.builtin.systemd: + name: cups + state: started + enabled: yes diff --git a/roles/desktop/tasks/dotfiles.yml b/roles/desktop/tasks/dotfiles.yml index 348c5bf..58eeb43 100644 --- a/roles/desktop/tasks/dotfiles.yml +++ b/roles/desktop/tasks/dotfiles.yml @@ -1,4 +1,3 @@ ---- - name: checkout dotfiles git: repo: "{{ git.dotfiles }}" diff --git a/roles/desktop/tasks/flatpaks.yml b/roles/desktop/tasks/flatpaks.yml index 2738e21..565ee94 100644 --- a/roles/desktop/tasks/flatpaks.yml +++ b/roles/desktop/tasks/flatpaks.yml @@ -1,3 +1,18 @@ +- name: "[Arch] install flatpak" + become: yes + community.general.pacman: + name: + - flatpak + when: ansible_distribution == "Archlinux" + +- name: "[Ubuntu] install package managers" + become: yes + apt: + update_cache: yes + pkg: + - flatpak + when: ansible_distribution == "Ubuntu" + - name: "[All] install the smile emoji picker" community.general.flatpak: state: present diff --git a/roles/desktop/tasks/fonts.yml b/roles/desktop/tasks/fonts.yml new file mode 100644 index 0000000..0c54007 --- /dev/null +++ b/roles/desktop/tasks/fonts.yml @@ -0,0 +1,10 @@ +- name: "[Arch] Install fonts" + become: yes + community.general.pacman: + name: + - ttf-dejavu + - ttf-fira-code + - ttf-font-awesome + - ttf-liberation + - ttf-ubuntu-font-family + when: ansible_distribution == "Archlinux" diff --git a/roles/desktop/tasks/main.yml b/roles/desktop/tasks/main.yml index 9153720..bcfef77 100644 --- a/roles/desktop/tasks/main.yml +++ b/roles/desktop/tasks/main.yml @@ -11,8 +11,18 @@ - import_tasks: bluetooth.yml +- import_tasks: cron.yml + +- import_tasks: cups.yml + - import_tasks: dotfiles.yml +- import_tasks: fonts.yml + +- import_tasks: network-manager.yml + - import_tasks: signal.yml - import_tasks: timekpr.yml + +- import_tasks: xorg.yml diff --git a/roles/desktop/tasks/network-manager.yml b/roles/desktop/tasks/network-manager.yml new file mode 100644 index 0000000..e23f689 --- /dev/null +++ b/roles/desktop/tasks/network-manager.yml @@ -0,0 +1,15 @@ +- name: "[Arch] install nm packages" + become: yes + community.general.pacman: + name: + - networkmanager + - network-manager-applet + - nm-connection-editor + when: ansible_distribution == "Archlinux" + +- name: "[All] Enable network manager" + become: yes + ansible.builtin.systemd: + name: NetworkManager.service + state: started + enabled: yes diff --git a/roles/desktop/tasks/signal.yml b/roles/desktop/tasks/signal.yml index 15dae06..0c8c13d 100644 --- a/roles/desktop/tasks/signal.yml +++ b/roles/desktop/tasks/signal.yml @@ -2,24 +2,24 @@ - become: yes when: ansible_distribution == "Ubuntu" block: - - name: add signal gpg key [Ubuntu[ + - name: "[Ubuntu] add signal gpg key" apt_key: url: https://updates.signal.org/desktop/apt/keys.asc state: present - - name: add signal repo + - name: "[Ubuntu] add signal repo" apt_repository: repo: deb [arch=amd64] https://updates.signal.org/desktop/apt xenial main state: present filename: signal-xenial - - name: install signal-desktop + - name: "[Ubuntu] install signal-desktop" apt: update_cache: yes pkg: - signal-desktop -- name: install signal-desktop [Arch] +- name: "[Arch] install signal-desktop" when: ansible_distribution == "Archlinux" become: yes community.general.pacman: diff --git a/roles/desktop/tasks/ubuntu.yml b/roles/desktop/tasks/ubuntu.yml index 16b8ce6..abcd9a0 100644 --- a/roles/desktop/tasks/ubuntu.yml +++ b/roles/desktop/tasks/ubuntu.yml @@ -1,10 +1,9 @@ -- name: "[Ubuntu] install package managers" +- name: "[Ubuntu] install aptitude" become: yes apt: update_cache: yes pkg: - aptitude - - flatpak - name: "[Ubuntu] install terminal packages" become: yes diff --git a/roles/desktop/tasks/xorg.yml b/roles/desktop/tasks/xorg.yml new file mode 100644 index 0000000..b6f8e9a --- /dev/null +++ b/roles/desktop/tasks/xorg.yml @@ -0,0 +1,15 @@ +- name: "[Arch] install xorg tools" + become: yes + community.general.pacman: + name: + - autorandr + - brightnessctl + - numlockx + - picom + - polkit-gnome + - redshift + - xdotool + - xdg-desktop-portal-gtk + - xorg-xinit + - xorg-xkill + - xorg-xwininfo