1
0
mirror of https://gitlab.com/dbrw/ansible-setup.git synced 2026-02-06 04:45:31 +07:00

initial commit

This commit is contained in:
dbrw
2022-06-29 17:19:22 +07:00
commit 787bb4563f
181 changed files with 36597 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
- name: install aerc
community.general.pacman:
name:
- aerc
state: present

View File

@@ -0,0 +1,16 @@
- name: Create AUR directory
file: path=/home/{{ username }}/{{ aur.dir }}
state=directory
owner={{ username }}
group={{ username }}
- name: Install AUR base packages
aur:
name: "{{ aur.packages }}"
user: "{{ username }}"
- name: Install rcm
aur: name=rcm user={{ username }}
- name: Instal micro editor
aur: name=micro-git user={{ username }}

View File

@@ -0,0 +1,5 @@
- name: install Brave
community.general.pacman:
name:
- brave
state: present

View File

@@ -0,0 +1,5 @@
- name: install Chromium
community.general.pacman:
name:
- chromium
state: present

View File

@@ -0,0 +1,66 @@
---
- name: install basic utils, shells, apps
community.general.pacman:
name:
- xorg
- xorg-xinit
- xf86-video-intel
- mpv
- gimp
- inkscape
- git
- thefuck
- kitty
- tmux
- ncdu
- lsd
- vim
- source-highlight
- tree
- base-devel
- rsync
- zathura
- zathura-djvu
- zathura-pdf-mupdf
- pdftk
state: present
- name: Install archival utils
pacman:
name:
- atool
- p7zip
- unrar
- unzip
- xz
- zip
- bzip2
- gzip
- tar
state: present
- name: Install download utils
pacman:
name:
- aria2
- curl
- wget
state: present
- name: Install ImageMagick
pacman:
name: imagemagick
state: present
- name: Install arch linux wiki
pacman:
name: arch-wiki-lite
state: present
when: install_wiki == True
- name: Install obs-studio
pacman:
name: obs-studio
state: present
when: streaming_app == True

View File

@@ -0,0 +1,13 @@
- name: Add user {{ username }} to storage group
ansible.builtin.user:
groups: adm,storage
append: True
user: "{{ username }}"
- name: Copy polkit policies
ansible.builtin.copy:
src: polkit-mount-internal.rules
dest: /etc/polkit-1/rules.d/00-mount-internal.rules
mode: "0644"
group: root
owner: root

View File

@@ -0,0 +1,61 @@
---
- name: Install emacs
community.general.pacman:
name:
- emacs-nativecomp
- nodejs
- ripgrep
- fd
- editorconfig-core-c
- graphviz
- aspell
- aspell-en
- wkhtmltopdf
state: present
- name: copy doom configs
ansible.builtin.copy:
src: user_home/.doom.d
dest: /home/{{ username }}/
force: False
owner: "{{ username }}"
group: "{{ username }}"
- name: checkout doom emacs repo
become_user: "{{ username }}"
ansible.builtin.git:
repo: 'https://github.com/doomemacs/doomemacs'
dest: /home/{{ username }}/.emacs.d
depth: 1
- name: install doom emacs
become_user: "{{ username }}"
ansible.builtin.command: /home/{{ username }}/.emacs.d/bin/doom sync
- name: update env doom emacs
become_user: "{{ username }}"
ansible.builtin.command: /home/{{ username }}/.emacs.d/bin/doom env
- name: make sure local font directory
become_user: "{{ username }}"
ansible.builtin.file:
path: /home/{{ username }}/.local/share/fonts
state: "directory"
- name: download icon fonts
become_user: "{{ username }}"
ansible.builtin.get_url:
url: "https://raw.githubusercontent.com/domtronn/all-the-icons.el/master/fonts/{{ item }}"
dest: /home/{{ username }}/.local/share/fonts/{{ item }}
mode: "0644"
with_items:
- all-the-icons.ttf
- file-icons.ttf
- fontawesome.ttf
- material-design-icons.ttf
- octicons.ttf
- weathericons.ttf
- name: update font cache
become_user: "{{ username }}"
ansible.builtin.command: fc-cache -f -v

View File

@@ -0,0 +1,9 @@
- name: Clone user dotfiles
git: repo={{ dotfiles.url }} dest=/home/{{ username }}/{{ dotfiles.destination }} accept_hostkey=yes update=no
become: yes
become_user: "{{ username }}"
- name: Install user dotfiles
command: rcup -d /home/{{ username}}/{{ dotfiles.destination}} {{ dotfiles.rcup_flags }}
become: yes
become_user: "{{ username }}"

222
roles/common/tasks/dwm.yml Normal file
View File

@@ -0,0 +1,222 @@
---
- name: install dwm with my patches
community.general.pacman:
name:
- awesome-terminal-fonts
- powerline-fonts
- autorandr
- dialog
- pass
- capitaine-cursors
- feh
- adwaita-icon-theme
- arc-gtk-theme
- arc-icon-theme
- gnome-themes-extra
- gtk-engine-murrine
- rofi
- bitwarden-cli
- python-tldextract
- dunst
- libnotify
- libadwaita
- libxkbcommon
- xclip
- xss-lock
- xdg-user-dirs
- noto-fonts-emoji
- ttf-nerd-fonts-symbols
- ttf-dejavu
- earlyoom
- ttf-droid
- lxappearance
- ttc-iosevka
- pipewire
- pipewire-pulse
- pamixer
- wireplumber
- wireguard-tools
- gvfs
- gvfs-mtp
- pcmanfm
- yt-dlp
state: present
- name: checkout dwm repo
ansible.builtin.git:
repo: 'https://gitlab.com/dbrw/dwm.git'
dest: /tmp/dwm
version: dhm-v2
- name: Copy dwm config.h
ansible.builtin.copy:
src: dwm.config.h
dest: /tmp/dwm/config.h
- name: Build dwm
community.general.make:
chdir: /tmp/dwm
- name: Run 'install' dwm as root
community.general.make:
chdir: /tmp/dwm
target: install
become: yes
- name: checkout st repo
ansible.builtin.git:
repo: 'https://gitlab.com/dbrw/st.git'
dest: /tmp/st
version: dhm-custom
- name: Build st
community.general.make:
chdir: /tmp/st
- name: Run 'install' st as root
community.general.make:
chdir: /tmp/st
target: install
become: yes
- name: checkout slock repo
ansible.builtin.git:
repo: 'https://gitlab.com/dbrw/slock.git'
dest: /tmp/slock
version: dhm-custom
- name: Build slock
community.general.make:
chdir: /tmp/slock
- name: Run 'install' slock as root
community.general.make:
chdir: /tmp/slock
target: install
become: yes
- name: Set suid and guid for slock
ansible.builtin.command: chmod u+s,g+s /usr/local/bin/slock
- name: checkout slstatus repo
ansible.builtin.git:
repo: 'https://gitlab.com/dbrw/slstatus.git'
dest: /tmp/slstatus
version: dhm-custom
- name: Build slstatus
community.general.make:
chdir: /tmp/slstatus
- name: Run 'install' slstatus as root
community.general.make:
chdir: /tmp/slstatus
target: install
become: yes
- name: Install TPM
become_user: "{{ username }}"
ansible.builtin.git:
repo: 'https://github.com/tmux-plugins/tpm'
dest: /home/{{ username }}/.tmux/plugins/tpm
- name: Install TPM plugins
become_user: "{{ username }}"
ansible.builtin.command: /home/{{ username }}/.tmux/plugins/tpm/bin/install_plugins
- name: Copy configuration files
ansible.builtin.copy:
src: 'user_home/{{ item }}'
dest: /home/{{ username }}/
mode: 'preserve'
group: '{{ username }}'
owner: '{{ username }}'
with_items:
- .config
- .local
- .ssh
- .xinitrc
- .gtkrc-2.0
- .Xresources
- .Xresources.d
- .tmux.conf
- name: Copy ssh config
ansible.builtin.copy:
src: user_home/.ssh
dest: /home/{{ username }}
force: False
mode: 'preserve'
group: '{{ username }}'
owner: '{{ username }}'
- name: Enable dwm service
become: true
become_user: '{{ username }}'
become_method: machinectl
ansible.builtin.systemd:
daemon_reload: true
scope: user
name: dwm
enabled: true
- name: Enable autorandr service
become: true
ansible.builtin.systemd:
daemon_reload: true
name: autorandr
enabled: true
- name: Enable fstrim timer
become: true
ansible.builtin.systemd:
daemon_reload: true
name: fstrim.timer
enabled: true
- name: Enable earlyoom service
become: true
ansible.builtin.systemd:
daemon_reload: true
name: earlyoom
enabled: true
- name: Enable slstatus service
become: true
become_user: '{{ username }}'
become_method: machinectl
ansible.builtin.systemd:
daemon_reload: true
scope: user
name: slstatus
enabled: true
- name: Enable dunst service
become: true
become_user: '{{ username }}'
become_method: machinectl
ansible.builtin.systemd:
daemon_reload: true
scope: user
name: dunst
enabled: true
- name: Enable ssh-agent service
become: true
become_user: '{{ username }}'
become_method: machinectl
ansible.builtin.systemd:
daemon_reload: true
scope: user
name: ssh-agent
enabled: true
- name: Enable xrdb service
become: true
become_user: '{{ username }}'
become_method: machinectl
ansible.builtin.systemd:
daemon_reload: true
scope: user
name: xrdb
enabled: true

View File

@@ -0,0 +1,5 @@
- name: install aerc
community.general.pacman:
name:
- aerc
state: present

View File

@@ -0,0 +1,9 @@
- name: install KDE and KDE apps
community.general.pacman:
name:
- plasma-meta
- kde-applications-meta
- sddm-kcm
- clementine
- audacious
state: present

View File

@@ -0,0 +1,39 @@
---
- name: install interception tools
community.general.pacman:
name:
- interception-tools
- interception-caps2esc
- interception-dual-function-keys
- name: make config directories
become: true
ansible.builtin.file:
path: /etc/interception/dual-function-keys
state: directory
mode: '0755'
- name: copy udevmon config files
become: true
ansible.builtin.copy:
src: udevmon.yaml
dest: /etc/interception/udevmon.yaml
owner: root
group: root
mode: '0644'
- name: copy dual-function-key config files
become: true
ansible.builtin.copy:
src: dual-function-keys.yaml
dest: /etc/interception/dual-function-keys/default-mapping.yaml
owner: root
group: root
mode: '0644'
- name: enable udevmon service
become: true
ansible.builtin.systemd:
daemon_reload: true
name: udevmon
enabled: true

View File

@@ -0,0 +1,67 @@
- name: Install power management laptop software
community.general.pacman:
name:
- tlp
- acpi
- smartmontools
- ethtool
state: present
- name: Install wireless software
community.general.pacman:
name:
- iwd
- bluez
- bluez-utils
state: present
- name: Disable USB autosuspend in tlp
replace:
path: /etc/tlp.conf
regexp: '{{ item.regexp }}'
replace: '{{ item.replace }}'
with_items:
- { regexp: '^#USB_AUTOSUSPEND=1$', replace: 'USB_AUTOSUSPEND=0' }
- name: Create iwd config directory
ansible.builtin.file:
path: /etc/iwd
state: directory
owner: root
group: root
- name: Copy iwd config
ansible.builtin.copy:
src: iwd.conf
dest: /etc/iwd/main.conf
owner: root
group: root
mode: "0644"
- name: Enable tlp service
ansible.builtin.systemd:
name: tlp
enabled: True
- name: Enabling iwd service
ansible.builtin.systemd:
name: iwd
enabled: True
- name: Enabling bluetooth service
ansible.builtin.systemd:
name: bluetooth
enabled: True
- name: Copy libinput config
ansible.builtin.copy:
src: 30-touchpad.conf
dest: /etc/X11/xorg.conf.d/30-touchpad.conf
mode: "0644"
- name: Copy swappiness config
ansible.builtin.copy:
src: 99-swappiness.conf
dest: /etc/sysctl.d/99-swappiness.conf
mode: "0644"

View File

@@ -0,0 +1,63 @@
- name: check updates
pacman:
update_cache: yes
upgrade: yes
# Configure pacman (colorize and repos)
- include_tasks: pacman.yml
# Basic apps (vlc, kitty, etc.)
- include_tasks: core-apps.yml
# Install and configure zsh
- include_tasks: zsh.yml
when: setup_zsh == True
# Install and configure spacevim
- include_tasks: spacevim.yml
when: install_spacevim == True
# Install laptop specific softwares
- include_tasks: laptop.yml
when: is_laptop == True
# Install and configure doom emacs
- include_tasks: doom-emacs.yml
when: install_doom == True
# Install KDE and Additional Plasma Applications
- include_tasks: kde.yml
when: install_kde == True
# Install dwm
- include_tasks: dwm.yml
when: install_dwm == True
- include_tasks: disk-permission.yml
# Web Browser
- include_tasks: "{{browser}}.yml"
# Terminal web browsers
- include_tasks: terminal_browsers.yml
when: install_terminal_browsers == True
# Office
- include_tasks: office.yml
when: install_office == True
# Console based Email
- include_tasks: aerc.yml
when: install_aerc == True
# AUR apps
- include_tasks: aur.yml
when: use_aur == True
# Keyboard settings
- include_tasks: keyboard.yml
when: install_keyboard == True
# Dotfiles
- include_tasks: dotfiles.yml
when: pull_dotfiles == True

View File

@@ -0,0 +1,8 @@
- name: install LibreOffice Fresh (EN)
community.general.pacman:
name:
- libreoffice-fresh
- jre-openjdk
- simple-scan
state: present

View File

@@ -0,0 +1,23 @@
- name: Enable pacman colourised output and verbose package lists
replace:
path: /etc/pacman.conf
regexp: '{{ item.regexp }}'
replace: '{{ item.replace }}'
with_items:
- { regexp: '^#Color$', replace: 'Color' }
- { regexp: '^#VerbosePkgLists$', replace: 'VerbosePkgLists' }
- name: Enable repositories
replace:
path: /etc/pacman.conf
regexp: '^#\[{{ item }}\]$\n^#Include\s+=\s+/etc/pacman.d/mirrorlist$'
replace: '[{{ item }}]\nInclude = /etc/pacman.d/mirrorlist'
with_items: '{{ pacman.repos }}'
notify: Update pacman cache
when: pacman.repos is defined
- name: Ignore 'modified' group
replace:
path: /etc/pacman.conf
regexp: '^#IgnoreGroup =$'
replace: 'IgnoreGroup = modified'

View File

@@ -0,0 +1,23 @@
---
- name: install brwoser(s)
community.general.pacman:
name:
- qutebrowser
- chromium
- pdfjs
- profile-sync-daemon
- python-setuptools
- python-pygments
- python-adblock
- gst-libav
state: present
- name: Enable profile sync daemon service
become: true
become_user: '{{ username }}'
become_method: machinectl
ansible.builtin.systemd:
daemon_reload: true
scope: user
name: psd
enabled: true

View File

@@ -0,0 +1,27 @@
---
- name: Create SpaceVim.d directory
file:
path: "/home/{{ username }}/.SpaceVim.d"
state: directory
- name: Get init.toml file
get_url:
url: https://raw.githubusercontent.com/SpaceVim/SpaceVim/master/mode/dark_powered.toml
dest: "/home/{{ username }}/.SpaceVim.d/init.toml"
- name: Get SpaceVim install script
get_url:
url: https://spacevim.org/install.sh
dest: "/home/{{ username }}/install-spacevim.sh"
mode: "0747"
- name: Install SpaceVim
become: True
become_user: "{{ username }}"
command: "bash /home/{{ username }}/install-spacevim.sh"
- name: Add custom vim plugins
blockinfile:
path: "/home/{{ username }}/.SpaceVim.d/init.toml"
insertafter: EOF
content: "{{ custom_vim_plugins }}"

View File

@@ -0,0 +1,6 @@
- name: install term browsers
community.general.pacman:
name:
- w3m
- elinks
state: present

View File

@@ -0,0 +1,6 @@
- name: install Vivaldi and optionals
community.general.pacman:
name:
- vivaldi
- vivaldi-ffmpeg-codecs
state: present

View File

@@ -0,0 +1,63 @@
---
- name: install zsh
community.general.pacman:
name:
- zsh
- zsh-completions
- zsh-syntax-highlighting
state: present
- name: install additional software for zsh
community.general.pacman:
name:
- fzf
- zoxide
state: present
- name: change "{{ username }}"'s shell to zsh
become: yes
user:
name: "{{ username }}"
shell: /usr/bin/zsh
- name: copy zsh dotfile
copy:
src: user_home/.zshrc
dest: /home/{{ username }}/.zshrc
force: False
owner: "{{ username }}"
group: "{{ username }}"
mode: u+rw,g+r,o--
- name: copy zsh p10k dotfile
copy:
src: user_home/.p10k.zsh
dest: /home/{{ username }}/.p10k.zsh
force: False
owner: "{{ username }}"
group: "{{ username }}"
mode: u+rw,g+r,o--
- name: clone oh-my-zsh for users
tags:
# Suppress warning: [ANSIBLE0006] git used in place of git module
# Git module doesn't allow us to set `core.autocrlf=input`.
- skip_ansible_lint
become: yes
become_user: '{{ username }}'
# core.autocrlf=input prevents https://github.com/robbyrussell/oh-my-zsh/issues/4402
command: 'git clone -c core.autocrlf=input https://github.com/robbyrussell/oh-my-zsh.git .oh-my-zsh'
args:
chdir: '~{{ username }}'
creates: '~{{ username }}/.oh-my-zsh'
- name: copy powerlevel10k theme
copy:
src: zsh-theme-powerlevel10k/
dest: /usr/share/zsh-theme-powerlevel10k/
force: False
mode: u+rw,g+xr,o+x