From d79262bc9246d88a3305a0a545036cc5d335dca2 Mon Sep 17 00:00:00 2001 From: "flyingscorpio@clevo" Date: Sun, 14 Aug 2022 10:32:13 +0200 Subject: [PATCH] Move base things out to the roles that need them --- roles/base/tasks/main.yml | 42 +++-------------- roles/gitea-backup/tasks/main.yml | 16 +++++++ roles/{base => i3}/files/Xmodmap | 0 roles/i3/tasks/main.yml | 61 +++++++++++++++++-------- roles/rsync-backup/tasks/main.yml | 19 +++++++- roles/shell/files/shell_aliases.ansible | 9 ---- 6 files changed, 82 insertions(+), 65 deletions(-) rename roles/{base => i3}/files/Xmodmap (100%) diff --git a/roles/base/tasks/main.yml b/roles/base/tasks/main.yml index 09a9cb8..5b60c25 100644 --- a/roles/base/tasks/main.yml +++ b/roles/base/tasks/main.yml @@ -5,26 +5,14 @@ name: - archlinux-keyring - base-devel - - libnotify + - curl - pacman-contrib # for checkupdates, paccache, pacdiff... - pkgfile # get hint on missing package when command not found - python-pip - - python-wheel - python-setuptools + - python-wheel - reflector - - xorg-xinit # enable xinit to avoid having to type 'startx' - - ttf-font-awesome - - ttf-jetbrains-mono - - ttf-fira-code - - rsync # used for backup - - curl - wget - - xorg - - numlockx # activate numlock (set in .xinitrc) - - dunst - - udiskie # automount external drives (set in .xinitrc) - - xmlstarlet # for clitip - - pandoc # for clitip when: ansible_facts['distribution'] == 'Archlinux' - name: Install packages (Debian) @@ -32,33 +20,15 @@ apt: name: - build-essential - - libnotify-bin - - python3-venv - - python3-pip - - python3-wheel - - python3-setuptools - - xinit # enable xinit to avoid having to type 'startx' - - fonts-font-awesome - - fonts-jetbrains-mono - - fonts-firacode - - rsync # used for backup - curl + - python3-pip + - python3-setuptools + - python3-venv + - python3-wheel - wget - - xorg - - numlockx # activate numlock (set in .xinitrc) - - dunst - - udiskie # automount external drives (set in .xinitrc) - - xmlstarlet # for clitip - - pandoc # for clitip when: ansible_facts['distribution'] == 'Debian' - name: Update pkgfile for Archlinux become: true command: pkgfile -u when: ansible_facts['distribution'] == 'Archlinux' - -- name: Copy Xmodmap - copy: - src: Xmodmap - dest: ~/.Xmodmap - mode: 0644 diff --git a/roles/gitea-backup/tasks/main.yml b/roles/gitea-backup/tasks/main.yml index 36b9a9c..2d52039 100644 --- a/roles/gitea-backup/tasks/main.yml +++ b/roles/gitea-backup/tasks/main.yml @@ -1,8 +1,23 @@ --- +- name: Install packages (Archlinux) + become: true + pacman: + name: + - rsync # used for backup + when: ansible_facts['distribution'] == 'Archlinux' + +- name: Install packages (Debian) + become: true + apt: + name: + - rsync # used for backup + when: ansible_facts['distribution'] == 'Debian' + - name: Copy gitea-backup timer copy: src: gitea-backup.timer dest: ~/.config/systemd/user/gitea-backup.timer + mode: 0644 notify: - Run daemon-reload - Enable gitea-backup timer @@ -11,4 +26,5 @@ template: src: gitea-backup.service.j2 dest: ~/.config/systemd/user/gitea-backup.service + mode: 0644 notify: Run daemon-reload diff --git a/roles/base/files/Xmodmap b/roles/i3/files/Xmodmap similarity index 100% rename from roles/base/files/Xmodmap rename to roles/i3/files/Xmodmap diff --git a/roles/i3/tasks/main.yml b/roles/i3/tasks/main.yml index 25ad56a..8ee27ae 100644 --- a/roles/i3/tasks/main.yml +++ b/roles/i3/tasks/main.yml @@ -3,43 +3,65 @@ become: true pacman: name: - - noto-fonts - - i3-gaps - dmenu - - picom - - xdg-user-dirs - - i3lock - - xsettingsd - - lxappearance - - scrot - - viewnior + - dunst - hsetroot + - i3-gaps + - i3blocks + - i3lock + - libnotify + - lxappearance + - pandoc # for clitip + - picom - python-feedparser - python-matplotlib - - i3blocks + - noto-fonts + - numlockx # activate numlock (set in .xinitrc) + - scrot - sysstat + - ttf-font-awesome + - ttf-jetbrains-mono + - ttf-fira-code + - udiskie # automount external drives (set in .xinitrc) - upower + - viewnior + - xdg-user-dirs + - xmlstarlet # for clitip + - xorg + - xorg-xinit # enable xinit to avoid having to type 'startx' + - xsettingsd when: ansible_facts['distribution'] == 'Archlinux' - name: Install packages (Debian) become: true apt: name: + - dunst + - fonts-font-awesome + - fonts-jetbrains-mono + - fonts-firacode - fonts-noto - - i3-wm - - suckless-tools - - picom - - xdg-user-dirs - - i3lock - - xsettingsd - - lxappearance - - scrot - - viewnior - hsetroot + - i3-wm + - i3lock + - libnotify-bin - libstartup-notification0-dev # build dependency + - lxappearance + - numlockx # activate numlock (set in .xinitrc) + - pandoc # for clitip + - picom + - scrot - python3-matplotlib + - suckless-tools - sysstat - upower + - udiskie # automount external drives (set in .xinitrc) + - viewnior + - xdg-user-dirs + - xinit # enable xinit to avoid having to type 'startx' + - xmlstarlet # for clitip + - xorg + - xsettingsd when: ansible_facts['distribution'] == 'Debian' - name: Clone repos @@ -65,6 +87,7 @@ - {src: 'i3blocksconfig', dest: '~/.config/i3blocks/config'} - {src: 'xinitrc', dest: '~/.xinitrc'} - {src: 'xserverrc', dest: '~/.xserverrc'} + - {src: 'Xmodmap', dest: '~/.Xmodmap'} - {src: 'Xresources', dest: '~/.Xresources'} - {src: 'xsettingsd', dest: '~/.xsettingsd'} - {src: 'picom.conf', dest: '~/.config/picom.conf'} diff --git a/roles/rsync-backup/tasks/main.yml b/roles/rsync-backup/tasks/main.yml index db24602..316bd9d 100644 --- a/roles/rsync-backup/tasks/main.yml +++ b/roles/rsync-backup/tasks/main.yml @@ -1,11 +1,27 @@ --- -- include_vars: vault.yml +- name: Include vault variables + include_vars: vault.yml + +- name: Install packages (Archlinux) + become: true + pacman: + name: + - rsync # used for backup + when: ansible_facts['distribution'] == 'Archlinux' + +- name: Install packages (Debian) + become: true + apt: + name: + - rsync # used for backup + when: ansible_facts['distribution'] == 'Debian' - name: Copy rsync_backup timer become: true copy: src: rsync_backup.timer dest: /etc/systemd/system/rsync_backup.timer + mode: 0644 notify: - Run daemon-reload - Enable rsync_backup timer @@ -15,6 +31,7 @@ copy: src: rsync_backup.service dest: /etc/systemd/system/rsync_backup.service + mode: 0644 notify: Run daemon-reload - name: Copy rsync_backup script diff --git a/roles/shell/files/shell_aliases.ansible b/roles/shell/files/shell_aliases.ansible index 04bcdc9..c4fadab 100644 --- a/roles/shell/files/shell_aliases.ansible +++ b/roles/shell/files/shell_aliases.ansible @@ -66,15 +66,6 @@ pw() { unset PASSWORD_STORE_CLIP_TIME } -clitip() { - curl -s https://raw.githubusercontent.com/jlevy/the-art-of-command-line/master/README.md | - sed '/cowsay[.]png/d' | - pandoc -f markdown -t html | - xmlstarlet fo --html --dropdtd | - xmlstarlet sel -t -v "(html/body/ul/li[count(p)>0])[$RANDOM mod last()+1]" | - xmlstarlet unesc | fmt -80 | iconv -t US -} - system-update() { # Don't update if its a kernel update that will require reboot if checkupdates >/dev/null 2>&1; then