Make playbooks easier to read + add 'curl' tag

This commit is contained in:
Hoang Nguyen 2021-12-24 01:26:16 +07:00
parent 91fa5062dc
commit 099946a1bd
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
10 changed files with 146 additions and 136 deletions

View File

@ -89,122 +89,30 @@
command:
cmd: cargo install --locked --force starship
- name: Install pyenv
tags: [ never, pyenv, python ]
environment:
PYENV_ROOT: '{{ ansible_env.HOME }}/.local/share/pyenv'
- name: Install python development utilities
tags: [ never, python ]
block:
- name: Clone pyenv
git:
depth: 1
update: no
repo: https://github.com/pyenv/pyenv.git
dest: '{{ ansible_env.PYENV_ROOT }}'
- name: Install pyenv
tags: pyenv
environment:
PYENV_ROOT: '{{ ansible_env.HOME }}/.local/share/pyenv'
import_tasks: tasks/pyenv.yml
- name: Clone pyenv plugins
git:
depth: 1
update: no
repo: 'https://github.com/pyenv/{{ item }}.git'
dest: '{{ ansible_env.PYENV_ROOT }}/plugins/{{ item }}'
loop:
- pyenv-update
- pyenv-virtualenv
- name: Symlink pyenv executable
file:
src: '{{ ansible_env.PYENV_ROOT }}/libexec/pyenv'
dest: ~/.local/bin/pyenv
state: link
- name: Add fish startup hooks
tags: fish
blockinfile:
path: ~/.config/fish/config.fish
block: |
# pyenv startup hooks
status is-login; and pyenv init --path | source
status is-interactive; and pyenv init - | source
status is-interactive; and pyenv virtualenv-init - | source
validate: grep -qF "pyenv init -" %s
- name: Install poetry
tags: [ never, poetry, python ]
block:
- name: Install poetry
shell:
cmd: curl -sSL https://install.python-poetry.org | python3 -
creates: ~/.local/bin/poetry
- name: Install poetry fish completion
tags: fish
shell:
cmd: ~/.local/bin/poetry completions fish > ~/.config/fish/completions/poetry.fish
creates: ~/.config/fish/completions/poetry.fish
tags: poetry
import_tasks: tasks/poetry.yml
- name: Build and install custom packages
tags: custom
vars:
- anime4kcpp_dir: ~/Code/Anime4KCPP
- tt_dir: ~/Code/tt
block:
- name: Install Anime4KCPP
tags: anime4kcpp
block:
- name: Install dependencies
apk:
name: cmake,opencv-dev,opencl-icd-loader-dev
state: present
update_cache: yes
become: yes
- name: Clone Anime4KCPP repository
git:
depth: 1
update: no
repo: https://github.com/TianZerL/Anime4KCPP.git
dest: '{{ anime4kcpp_dir }}'
- name: Make build directory
file:
path: '{{ anime4kcpp_dir }}/build'
state: directory
- name: Generate cmake build files
command:
chdir: '{{ anime4kcpp_dir }}/build'
cmd: cmake ..
- name: Build Anime4KCPP CLI
command: make
args:
creates: '{{ anime4kcpp_dir }}/build/bin/Anime4KCPP_CLI'
chdir: '{{ anime4kcpp_dir }}/build'
- name: Symlink Anime4KCPP_CLI executable
file:
src: '{{ anime4kcpp_dir }}/build/bin/Anime4KCPP_CLI'
dest: ~/.local/bin/Anime4KCPP_CLI
state: link
vars:
- anime4kcpp_dir: ~/Code/Anime4KCPP
import_tasks: tasks/anime4kcpp.yml
- name: Install tt
tags: tt
block:
- name: Clone tt repository
git:
depth: 1
update: no
repo: https://github.com/runrin/tt.git
dest: '{{ tt_dir }}'
- name: Build tt
command: make
args:
chdir: '{{ tt_dir }}'
creates: '{{ tt_dir }}/tt'
- name: Symlink tt executable
file:
src: '{{ tt_dir }}/tt'
dest: ~/.local/bin/tt
state: link
vars:
- tt_dir: ~/Code/tt
import_tasks: tasks/tt.yml

View File

@ -0,0 +1,35 @@
---
- name: Install dependencies
apk:
name: cmake, opencv-dev, opencl-icd-loader-dev
state: present
become: yes
- name: Clone Anime4KCPP repository
git:
depth: 1
update: no
repo: https://github.com/TianZerL/Anime4KCPP.git
dest: '{{ anime4kcpp_dir }}'
- name: Make build directory
file:
path: '{{ anime4kcpp_dir }}/build'
state: directory
- name: Generate cmake build files
command:
chdir: '{{ anime4kcpp_dir }}/build'
cmd: cmake ..
- name: Build Anime4KCPP CLI
command: make
args:
creates: '{{ anime4kcpp_dir }}/build/bin/Anime4KCPP_CLI'
chdir: '{{ anime4kcpp_dir }}/build'
- name: Symlink Anime4KCPP_CLI executable
file:
src: '{{ anime4kcpp_dir }}/build/bin/Anime4KCPP_CLI'
dest: ~/.local/bin/Anime4KCPP_CLI
state: link

View File

@ -0,0 +1,11 @@
---
- name: Run poetry install script
shell:
cmd: curl -sSL https://install.python-poetry.org | python3 -
creates: ~/.local/bin/poetry
- name: Install poetry fish completion
tags: fish
shell:
cmd: ~/.local/bin/poetry completions fish > ~/.config/fish/completions/poetry.fish
creates: ~/.config/fish/completions/poetry.fish

View File

@ -0,0 +1,34 @@
---
- name: Clone pyenv
git:
depth: 1
update: no
repo: https://github.com/pyenv/pyenv.git
dest: '{{ ansible_env.PYENV_ROOT }}'
- name: Clone pyenv plugins
git:
depth: 1
update: no
repo: 'https://github.com/pyenv/{{ item }}.git'
dest: '{{ ansible_env.PYENV_ROOT }}/plugins/{{ item }}'
loop:
- pyenv-update
- pyenv-virtualenv
- name: Symlink pyenv executable
file:
src: '{{ ansible_env.PYENV_ROOT }}/libexec/pyenv'
dest: ~/.local/bin/pyenv
state: link
- name: Add fish startup hooks
tags: fish
blockinfile:
path: ~/.config/fish/config.fish
block: |
# pyenv startup hooks
status is-login; and pyenv init --path | source
status is-interactive; and pyenv init - | source
status is-interactive; and pyenv virtualenv-init - | source
validate: grep -qF "pyenv init -" %s

19
additional/tasks/tt.yml Normal file
View File

@ -0,0 +1,19 @@
---
- name: Clone tt repository
git:
depth: 1
update: no
repo: https://github.com/runrin/tt.git
dest: '{{ tt_dir }}'
- name: Build tt
command: make
args:
chdir: '{{ tt_dir }}'
creates: '{{ tt_dir }}/tt'
- name: Symlink tt executable
file:
src: '{{ tt_dir }}/tt'
dest: ~/.local/bin/tt
state: link

View File

@ -1,46 +1,41 @@
---
- name: Gather information
hosts: all
- hosts: all
gather_facts: yes
tags: always
roles:
- palette
- name: Sanity checks
- name: Deploy dotfiles
hosts: all
tasks:
vars_files:
- /tmp/palette.yml
pre_tasks:
- name: Check theme name
tags: always
fail:
msg: Variable 'theme' needs to be 'nord' or 'onedark'
when: theme != 'nord' and theme != 'onedark'
- name: Check clipboard manager name
tags: always
fail:
msg: Variable 'clipboard' needs to be 'clipman' or 'cliphist'
when: clipboard != 'clipman' and clipboard != 'cliphist'
- name: Check notification daemon name
tags: always
fail:
msg: Variable 'notification' needs to be 'dunst' or 'mako'
when: notification != 'dunst' and notification != 'mako'
- name: Guarantee that ~/.config and ~/.local/share exist
tags: always
file:
path: '{{ item }}'
state: directory
loop:
- ~/.config
- ~/.local/share
tags: always
- name: Generate theme colors
hosts: all
roles:
- palette
tags: always
- name: Deploy dotfiles
hosts: all
vars_files:
- /tmp/palette.yml
roles:
- role: scripts
tags: scripts

View File

@ -7,7 +7,7 @@ gpg_signature: 813CF484F4993419
# Choices ─────────────────────────────────────────────────────────────────────
default_browser: qutebrowser
clipboard: cliphist
clipboard: clipman
notification: dunst
# Use 'dropbear-dbclient' if True, otherwise use 'openssh-client'
dropbear_ssh_client: False

View File

@ -10,18 +10,21 @@
dest: ~/.config/mpv/mpv.conf
force: yes
- name: Download Anime4K shaders
get_url:
url: https://github.com/bloc97/Anime4K/releases/download/v4.0.1/Anime4K_v4.0.zip
dest: /tmp/Anime4K.zip
mode: 0644
# Busybox has 'unzip' so use that
# 'zipinfo' is required for 'unarchive' module, but it is only available in 'unzip' package
- name: Unzip Anime4K shaders
command: unzip /tmp/Anime4K.zip -d ~/.config/mpv/shaders
args:
creates: ~/.config/mpv/shaders/Anime4K_Darken_HQ.glsl
- name: Download and extract Anime4K shaders
tags: curl
block:
- name: Download Anime4K zip file
get_url:
url: https://github.com/bloc97/Anime4K/releases/download/v4.0.1/Anime4K_v4.0.zip
dest: /tmp/Anime4K.zip
mode: 0644
- name: Unzip Anime4K shaders
command: unzip /tmp/Anime4K.zip -d ~/.config/mpv/shaders
args:
creates: ~/.config/mpv/shaders/Anime4K_Darken_HQ.glsl
- name: Copy input config
copy:

View File

@ -36,6 +36,7 @@
- volumecontrol.j2
- name: Install tmpsms
tags: curl
get_url:
url: https://github.com/sdushantha/tmpsms/raw/master/tmpsms
dest: ~/.local/bin/tmpsms
@ -43,6 +44,7 @@
force: yes
- name: Install tmpmail
tags: curl
get_url:
url: https://github.com/sdushantha/tmpmail/raw/master/tmpmail
dest: ~/.local/bin/tmpmail
@ -50,6 +52,7 @@
force: yes
- name: Install ani-cli
tags: curl
get_url:
url: https://github.com/pystardust/ani-cli/raw/master/ani-cli
dest: ~/.local/bin/ani-cli
@ -57,6 +60,7 @@
force: yes
- name: Install ytfzf
tags: curl
get_url:
url: https://github.com/pystardust/ytfzf/raw/master/ytfzf
dest: ~/.local/bin/ytfzf
@ -64,6 +68,7 @@
force: yes
- name: Install tuxi
tags: curl
get_url:
url: https://raw.githubusercontent.com/Bugswriter/tuxi/main/tuxi
dest: ~/.local/bin/tuxi

View File

@ -9,9 +9,9 @@ case $1 in
--start) wl-paste -t text --watch clipman store --no-persist ;;
--clear) clipman clear --all && notify-send -i "$HOME/.config/{{ notification }}/clipboard.png" "Clipboard cleared" ;;
{% elif clipboard == 'cliphist' %}
--wofi) cliphist list | wofi -p "Clipboard " -i -O default | cliphist decode | wl-copy ;;
--wofi) cliphist list | wofi -d -p "Clipboard " -i -O default | cliphist decode | wl-copy ;;
--fzf) cliphist list | fzf --prompt "Clipboard " --no-multi -e | cliphist decode | wl-copy ;;
--wofi-clear) cliphist list | wofi -p "Clear clipboard " -i -O default | cliphist delete ;;
--wofi-clear) cliphist list | wofi -d -p "Clear clipboard " -i -O default | cliphist delete ;;
--fzf-clear) cliphist list | fzf --prompt "Clear clipboard " -e | cliphist delete ;;
--start) wl-paste --watch cliphist store ;;
--clear) rm -f "$XDG_CACHE_HOME/cliphist/db" && notify-send -i "$HOME/.config/{{ notification }}/clipboard.png" "Clipboard cleared" ;;