vagrant-blackarch/playbook.yml

175 lines
6.0 KiB
YAML

---
- name: Provision Arch Box
hosts: default
remote_user: vagrant
become: yes
become_user: root
tasks:
- name: Make Pacman Great Again
ansible.builtin.replace:
path: /etc/pacman.conf
regexp: '#ParallelDownloads = 5'
replace: 'ParallelDownloads = 5\nILoveCandy'
- name: Make Pacman Colorful
ansible.builtin.replace:
path: /etc/pacman.conf
regexp: '#Color'
replace: 'Color'
- name: Activating Multilibs
ansible.builtin.replace:
path: /etc/pacman.conf
regexp: '#[multilib]'
replace: '[multilib]\nInclude = /etc/pacman.d/mirrorlist\n'
- name: Pacman Keys
ansible.builtin.shell:
cmd: pacman-key --init && pacman-key --populate
- name: Update System
ansible.builtin.shell:
cmd: pacman -Syyu --noconfirm
- name: Download Base packages
ansible.builtin.shell:
cmd: sudo pacman -S --needed base-devel git stow vim --noconfirm
- name: Loading Blackarch and Yay
hosts: default
remote_user: vagrant
tasks:
- name: Download Blackarch
ansible.builtin.shell: |
curl -O https://blackarch.org/strap.sh && \
echo 5ea40d49ecd14c2e024deecf90605426db97ea0c strap.sh | sha1sum -c && \
chmod +x ./strap.sh && sudo ./strap.sh && \
sudo pacman -Syu --noconfirm
args:
executable: /bin/bash
- name: Loading Multilibs
ansible.builtin.shell:
cmd: sudo pacman -Syu --noconfirm
- name: Loading Blackman
ansible.builtin.shell:
cmd: sudo pacman -S blackman --noconfirm
- name: Install yay
ansible.builtin.shell:
cmd: if [ ! -d "yay" ] ; then git clone http://aur.archlinux.org/yay.git && cd yay && makepkg -si --noconfirm ; fi
- name: Prepare window manger (dwm)
hosts: default
remote_user: vagrant
tasks:
- name: Installing dependencies
ansible.builtin.shell:
cmd: sudo pacman -S pass coreutils fontconfig freetype2 glibc libx11 libxft libxinerama clipmenu libdrm libepoxy libevdev libfontenc libglvnd libgudev libice libinput libomxil-bellagio libpciaccess libsm libunwind libwacom libxcursor libxcvt libxdamage libxfixes libxfont2 libxkbfile libxmu libxrandr libxshmfence libxt libxxf86vm llvm-libs lm_sensors mesa mtdev pixman vulkan-icd-loader wayland xf86-input-libinput xkeyboard-config xorg-fonts-encodings xorg-server xorg-server-common xorg-setxkbmap xorg-xkbcomp xorg-xrandr xorg-xsetroot paraxor-dwm --noconfirm
- name: Prepare vim
ansible.builtin.shell: |
[[ ! -d ".vim/pack/default/start/gruvbox/.git" ]] && cd .vim/pack/default/start/gruvbox/ && git submodule update --init || exit 0
- name: Getting dotfiles
ansible.builtin.shell: |
[[ ! -d "dotfiles" ]] && git clone https://git.stefan.works/stefan/dotfiles || exit 0
- name: Getting dwm
ansible.builtin.shell: |
[[ ! -d "dwm" ]] && git clone git://git.suckless.org/dwm && [[ -e "~/dwm/config.h" ]] && mv dwm/config.h dwm/config.bkp || exit 0
- name: Getting dmenu
ansible.builtin.shell: |
[[ ! -d "dmenu" ]] && git clone git://git.suckless.org/dmenu || exit 0
- name: Getting slstatus
ansible.builtin.shell: |
[[ ! -d "slstatus" ]] && git clone git://git.suckless.org/slstatus || exit 0
- name: Distributing dotfiles
ansible.builtin.shell:
#cmd: cd dotfiles && stow vim && stow dwm && stow dmenu && stow slstatus && cd ..
cmd: cd dotfiles && stow vim && stow dmenu && stow slstatus
- name: Make dwm
ansible.builtin.shell:
cmd: cd dwm && make && sudo make install && cd ..
- name: Make dmenu
ansible.builtin.shell:
cmd: cd dmenu && make && sudo make install && cd ..
- name: Make slstatus
ansible.builtin.shell:
cmd: cd slstatus && make && sudo make install && cd ..
- name: Create xinitrc
ansible.builtin.shell: |
[[ ! -e "~/.xinitrc" ]] && touch ~/.xinitrc || printf "Did not create .xinitrc"
- name: Insert dwm into xinitrc
lineinfile:
path: ~/.xinitrc
line: 'exec dwm'
insertbefore: EOF
- name: make ssh x11 possible
hosts: default
remote_user: vagrant
become: yes
become_user: root
tasks:
- name: set x11 forwarding
ansible.builtin.replace:
path: /etc/ssh/sshd_config
regexp: '#x11forwarding no'
replace: 'x11forwarding yes'
- name: install xauth
ansible.builtin.shell:
cmd: pacman -S xorg-xauth --noconfirm
- name: restart ssh daemon
ansible.builtin.shell:
cmd: systemctl restart sshd
- name: Install lightm as a session manager for dwm
hosts: default
remote_user: vagrant
become: yes
become_user: root
tasks:
- name: install lightdm
ansible.builtin.shell:
cmd: pacman -S lightdm lightdm-gtk-greeter --noconfirm
- name: Set gtk-greeter
ansible.builtin.replace:
path: /etc/lightdm/lightdm.conf
regexp: '#greeter-session=greeter-gtk-gnome'
replace: 'greeter-session=lightdm-gtk-greeter'
- name: Copy .xinitrc
ansible.builtin.copy:
src: includes/.xinitrc
dest: /home/vagrant/.xinitrc
owner: vagrant
group: vagrant
mode: '0755'
- name: Create xsessions directory
ansible.builtin.file:
path: /usr/share/xsessions
owner: root
group: root
state: directory
mode: '0755'
- name: Configure dwm for lightdm
ansible.builtin.copy:
src: includes/dwm.desktop
dest: /usr/share/xsessions/dwm.desktop
owner: root
group: root
mode: '0644'
- name: Enable lightdm Service
ansible.builtin.shell:
cmd: systemctl enable lightdm
- name: Install Applications
hosts: default
remote_user: vagrant
become: yes
become_user: root
tasks:
- name: Alacritty
ansible.builtin.shell:
cmd: pacman -S alacritty --noconfirm
# - name: Fonts
# ansible.builtin.shell:
# cmd: yay -S ttf-meslo-nerd-font-powerlevel10k nerd-font-sans-mono --noconfirm