Some clean up tasks
- playbook: move check tasks to external files for visibility - multiplexer: introduce variable 'multiplexer' - shells/fish: reflect aliases on the new variable 'multiplexer'
This commit is contained in:
parent
e3590f0563
commit
f08d185084
11 changed files with 100 additions and 66 deletions
63
dotfiles.yml
63
dotfiles.yml
|
@ -1,62 +1,17 @@
|
|||
---
|
||||
- name: Sanity checks
|
||||
hosts: all
|
||||
tags: always
|
||||
gather_facts: yes
|
||||
tasks:
|
||||
- name: Check theme name
|
||||
fail:
|
||||
msg: Variable 'theme' needs to be 'nord' or 'onedark'
|
||||
when:
|
||||
- theme != 'nord'
|
||||
- theme != 'onedark'
|
||||
|
||||
- name: Check clipboard manager name
|
||||
fail:
|
||||
msg: Variable 'clipboard' needs to be 'clipman' or 'cliphist'
|
||||
when:
|
||||
- clipboard != 'clipman'
|
||||
- clipboard != 'cliphist'
|
||||
|
||||
- name: Check notification daemon name
|
||||
fail:
|
||||
msg: Variable 'notification' needs to be 'dunst', 'mako' or 'fnott'
|
||||
when:
|
||||
- notification != 'dunst'
|
||||
- notification != 'mako'
|
||||
- notification != 'fnott'
|
||||
|
||||
# Wait for file-based configuration of fuzzel
|
||||
- name: Check application launcher name
|
||||
fail:
|
||||
msg: Variable 'launcher' needs to be 'fuzzel', 'wofi' or 'rofi'
|
||||
when:
|
||||
- launcher != 'fuzzel'
|
||||
- launcher != 'wofi'
|
||||
- launcher != 'rofi'
|
||||
|
||||
- name: Check the number of terminal emulators
|
||||
fail:
|
||||
msg: Need at least 2 terminal emulators
|
||||
when: ( terminal | length() ) < 2
|
||||
|
||||
- name: Check current user
|
||||
fail:
|
||||
msg: This playbook should not be run as 'root'
|
||||
when: ansible_real_user_id == 0
|
||||
|
||||
- name: Ensure ~/.config and ~/.local/share exist
|
||||
file:
|
||||
path: '{{ item }}'
|
||||
state: directory
|
||||
loop:
|
||||
- ~/.config
|
||||
- ~/.local/share
|
||||
|
||||
- name: Deploy dotfiles
|
||||
hosts: all
|
||||
gather_facts: yes
|
||||
vars_files:
|
||||
- 'palette/{{ theme }}.yml'
|
||||
pre_tasks:
|
||||
- name: Check defined variables
|
||||
import_tasks: tasks/check_variables.yml
|
||||
tags: always
|
||||
|
||||
- name: Check other facts
|
||||
import_tasks: tasks/check_other.yml
|
||||
tags: always
|
||||
tasks:
|
||||
# 'always' tag is needed to run the playbook with custom tags passed to
|
||||
# the included roles
|
||||
|
|
|
@ -10,6 +10,7 @@ launcher: rofi
|
|||
default_browser: qutebrowser
|
||||
clipboard: clipman
|
||||
notification: dunst
|
||||
multiplexer: zellij
|
||||
# Use 'dropbear-dbclient' if True, otherwise use 'openssh-client'
|
||||
dropbear_ssh_client: False
|
||||
# List of terminal emulators, in precedence order
|
||||
|
|
|
@ -63,14 +63,14 @@
|
|||
yarn:
|
||||
name: '@mermaid-js/mermaid-cli'
|
||||
global: yes
|
||||
state: present
|
||||
state: latest
|
||||
|
||||
- name: Install antora
|
||||
tags: antora
|
||||
yarn:
|
||||
name: '{{ item }}'
|
||||
global: yes
|
||||
state: present
|
||||
state: latest
|
||||
loop:
|
||||
- '@antora/cli'
|
||||
- '@antora/site-generator'
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
update: no
|
||||
repo: https://github.com/tmux-plugins/tpm.git
|
||||
dest: ~/.config/tmux/plugins/tpm
|
||||
tags: [ never, tmux ]
|
||||
when: multiplexer == 'tmux'
|
||||
|
||||
- block:
|
||||
- name: zellij | Create config directory
|
||||
|
@ -30,4 +30,4 @@
|
|||
src: config.j2
|
||||
dest: ~/.config/zellij/config.yaml
|
||||
force: yes
|
||||
tags: zellij
|
||||
when: multiplexer == 'zellij'
|
||||
|
|
|
@ -3,6 +3,11 @@
|
|||
# Terminate already running mpd instance
|
||||
mpd --kill 1>/dev/null 2>&1
|
||||
|
||||
# OPTION 1:
|
||||
# Set real-time scheduling and relaunch
|
||||
# (assure the user has permission to set rtprio=40 and rttime=unlimited)
|
||||
prlimit --rtprio=40 --rttime=unlimited mpd
|
||||
# Not POSIX compatible, but ash support this ulimit syntax
|
||||
# ulimit -HS -r 40 && exec mpd --no-daemon
|
||||
|
||||
# OPTION 2:
|
||||
# Launch normally (realtime privilege is set in /etc/security/limits.conf)
|
||||
exec mpd --no-daemon
|
||||
|
|
|
@ -11,12 +11,18 @@
|
|||
dest: ~/.config/fish/
|
||||
recursive: yes
|
||||
|
||||
- name: fish | Create conf.d directory
|
||||
file:
|
||||
path: ~/.config/fish/conf.d
|
||||
state: directory
|
||||
|
||||
- name: fish | Copy config templates
|
||||
template:
|
||||
src: '{{ item }}.j2'
|
||||
dest: '~/.config/fish/conf.d/{{ item }}.fish'
|
||||
force: yes
|
||||
loop:
|
||||
- aliases
|
||||
- colors
|
||||
- env
|
||||
|
||||
|
|
|
@ -4,15 +4,17 @@ abbr p pulsemixer
|
|||
alias cp='cp -vir'
|
||||
alias mv='mv -vi'
|
||||
alias rm='rm -vr'
|
||||
alias mkdir='mkdir -pv'
|
||||
alias mkdir='mkdir -vp'
|
||||
# alias ls='exa -lF --icons --sort=type'
|
||||
# alias la='exa -laF --icons --sort=type'
|
||||
# alias lt='exa --tree'
|
||||
{% if multiplexer == 'tmux' %}
|
||||
abbr tmux 'TERM=screen-256color command tmux'
|
||||
{% endif %}
|
||||
|
||||
# neovim
|
||||
abbr v nvim
|
||||
abbr vi 'fzf --prompt "Edit files: " | xargs nvim'
|
||||
abbr vi 'fzf --prompt "Edit files: " | xargs -r nvim'
|
||||
|
||||
# emacs
|
||||
alias doom='$HOME/.config/emacs/bin/doom'
|
|
@ -22,14 +22,15 @@ end
|
|||
# vi key bindings
|
||||
fish_vi_key_bindings
|
||||
|
||||
# fzf
|
||||
# fzf key bindings
|
||||
status is-interactive; and fzf_key_bindings
|
||||
|
||||
# gpg-agent
|
||||
set -gx GPG_TTY (tty)
|
||||
{% if not dropbear_ssh_client %}
|
||||
# also replace ssh-agent
|
||||
gpg-connect-agent /bye >/dev/null
|
||||
# gpg-agent normally starts on demand but ssh command doesn't trigger it
|
||||
# As such manually start it on login
|
||||
status is-login; and gpg-connect-agent /bye >/dev/null
|
||||
gpg-connect-agent updatestartuptty /bye >/dev/null
|
||||
if test -z "$SSH_AUTH_SOCK"
|
||||
set -gx SSH_AUTH_SOCK (gpgconf --list-dirs agent-ssh-socket)
|
||||
|
|
|
@ -5,7 +5,7 @@ DIRECTORY="/run/media/$USER"
|
|||
if [ -d "$DIRECTORY" ]; then
|
||||
dir_list=$(find "$DIRECTORY" -type d -maxdepth 1 | tail -n +2)
|
||||
if [ -n "$dir_list" ]; then
|
||||
# Loop through everything, in case we unmount manually (not using
|
||||
# Loop through everything, in case we unmounted manually (not using
|
||||
# udisks) and left stale directories behind
|
||||
final_result=0
|
||||
for dir in ${dir_list}; do
|
||||
|
|
21
tasks/check_other.yml
Normal file
21
tasks/check_other.yml
Normal file
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
- name: Check current user ID
|
||||
fail:
|
||||
msg: This playbook should not be run as 'root'
|
||||
when: ansible_real_user_id == 0
|
||||
|
||||
- name: Check 0700 permission on $HOME directory
|
||||
file:
|
||||
path: '{{ ansible_user_dir }}'
|
||||
state: directory
|
||||
owner: '{{ ansible_user_id }}'
|
||||
group: '{{ ansible_user_id }}'
|
||||
mode: 0700
|
||||
|
||||
- name: Check whether ~/.config and ~/.local/share exist
|
||||
file:
|
||||
path: '{{ item }}'
|
||||
state: directory
|
||||
loop:
|
||||
- ~/.config
|
||||
- ~/.local/share
|
43
tasks/check_variables.yml
Normal file
43
tasks/check_variables.yml
Normal file
|
@ -0,0 +1,43 @@
|
|||
---
|
||||
- name: Check theme name
|
||||
fail:
|
||||
msg: Variable 'theme' needs to be 'nord' or 'onedark'
|
||||
when:
|
||||
- theme != 'nord'
|
||||
- theme != 'onedark'
|
||||
|
||||
- name: Check clipboard manager name
|
||||
fail:
|
||||
msg: Variable 'clipboard' needs to be 'clipman' or 'cliphist'
|
||||
when:
|
||||
- clipboard != 'clipman'
|
||||
- clipboard != 'cliphist'
|
||||
|
||||
- name: Check notification daemon name
|
||||
fail:
|
||||
msg: Variable 'notification' needs to be 'dunst', 'mako' or 'fnott'
|
||||
when:
|
||||
- notification != 'dunst'
|
||||
- notification != 'mako'
|
||||
- notification != 'fnott'
|
||||
|
||||
- name: Check multiplexer name
|
||||
fail:
|
||||
msg: Variable 'multiplexer' needs to be 'zellij' or 'tmux'
|
||||
when:
|
||||
- multiplexer != 'zellij'
|
||||
- multiplexer != 'tmux'
|
||||
|
||||
# Wait for file-based configuration of fuzzel
|
||||
- name: Check application launcher name
|
||||
fail:
|
||||
msg: Variable 'launcher' needs to be 'fuzzel', 'wofi' or 'rofi'
|
||||
when:
|
||||
- launcher != 'fuzzel'
|
||||
- launcher != 'wofi'
|
||||
- launcher != 'rofi'
|
||||
|
||||
- name: Check the number of terminal emulators
|
||||
fail:
|
||||
msg: Need at least 2 terminal emulators
|
||||
when: ( terminal | length() ) < 2
|
Loading…
Reference in a new issue