vagrant-blackarch/playbook.yml

316 lines
9.8 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: Preparing window manger (dwm) and Downloading dotfiles
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 scrot
- 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 --recursive https://git.stefan.works/stefan/dotfiles || exit 0
- name: Getting dwm
ansible.builtin.shell: |
[[ ! -d "dwm" ]] && git clone https://git.stefan.works/stefan/dwm.git && [[ -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 && cd ~/dotfiles && stow dmenu || exit 0
- name: Getting slstatus
ansible.builtin.shell: |
[[ ! -d "slstatus" ]] && git clone git://git.suckless.org/slstatus && cd ~/dotfiles && stow 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: Create .xsession file
ansible.builtin.file:
path: ~/.xsession
owner: vagrant
group: vagrant
mode: '0775'
state: touch
- name: Insert slstatus into .xsession
lineinfile:
path: ~/.xsession
line: 'slstatus 2>&1 >/dev/null &'
insertbefore: EOF
- name: Create .profile
ansible.builtin.file:
path: ~/.profile
owner: vagrant
group: vagrant
state: touch
- name: Fix Java Applications
ansible.builtin.blockinfile:
path: ~/.profile
block: |
export _JAVA_AWT_WM_NONREPARENTING=1
export AWT_TOOLKIT=MToolkit
wmname LG3D
# - name: Configure Xresources
# hosts: default
# remote_user: vagrant
# tasks:
# - name: install xrdb
# ansible.builtin.shell:
# cmd: sudo pacman -S --noconfirm --needed xorg-xrdb
# # TODO: further config
- 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 lightdm 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: Preparing Fonts
hosts: default
remote_user: vagrant
become: yes
become_user: root
tasks:
- name: Fonts
ansible.builtin.shell:
cmd: pacman -S --noconfirm --needed noto-fonts-emoji ttf-dejavu
- name: Preparing More Fonts
hosts: default
remote_user: vagrant
tasks:
- name: Fonts
ansible.builtin.shell:
cmd: yay -S --aur --noconfirm --needed ttf-meslo-nerd-font-powerlevel10k nerd-fonts-dejavu-complete ttf-meslo
- name: Configuring Fonts
hosts: default
remote_user: vagrant
become: yes
become_user: root
tasks:
- name: Configure fonts
ansible.builtin.copy:
src: includes/01-myfonts.conf
dest: /etc/fonts/conf.d/01-customfonts.conf
owner: root
group: root
mode: '0644'
- name: Install Applications
hosts: default
remote_user: vagrant
become: yes
become_user: root
tasks:
# System
- name: pass
ansible.builtin.shell:
cmd: pacman -S --noconfirm pass
- name: Python dependencies
ansible.builtin.shell:
cmd: pacman -S --noconfirm --needed python-setuptools python-j2cli python-jinja-time python-beautifulsoup4
# Shell
- name: Alacritty
ansible.builtin.shell:
cmd: pacman -S --noconfirm alacritty
- name: bash-completion
ansible.builtin.shell:
cmd: sudo pacman -S --noconfirm bash-completion
- name: clipmenu
ansible.builtin.shell:
cmd: pacman -S --noconfirm clipmenu
# Web
- name: qutebrowser
ansible.builtin.shell:
cmd: pacman -S --noconfirm qutebrowser
- name: Firefox
ansible.builtin.shell:
cmd: pacman -S --noconfirm firefox
- name: nmap
ansible.builtin.shell:
cmd: pacman -S --noconfirm nmap
- name: dirsearch
ansible.builtin.shell:
cmd: pacman -S --noconfirm dirsearch
- name: gobuster
ansible.builtin.shell:
cmd: pacman -S --noconfirm gobuster
- name: Burpsuite
ansible.builtin.shell:
cmd: pacman -S --noconfirm burpsuite
- name: zaproxy
ansible.builtin.shell:
cmd: su -c "yay -S --noconfirm --aur zaproxy-weekly" vagrant
- name: nikto
ansible.builtin.shell:
cmd: pacman -S --noconfirm nikto
- name: wpscan
ansible.builtin.shell:
cmd: pacman -S --noconfirm wpscan
# Seclists
- name: seclists
ansible.builtin.shell:
cmd: pacman -S --noconfirm --needed seclists
# Passwords
- name: John the Ripper
ansible.builtin.shell:
cmd: pacman -S --noconfirm --needed john
- name: Hashcat
ansible.builtin.shell:
cmd: pacman -S --noconfirm --needed hashcat hashcat-utils
- name: Haiti
ansible.builtin.shell:
cmd: pacman -S --noconfirm haiti
- name: CeWL
ansible.builtin.shell:
cmd: pacman -S --noconfirm cewl
# Pwn
- name: Ghidra
ansible.builtin.shell:
cmd: pacman -S --noconfirm ghidra
- name: r2
ansible.builtin.shell:
cmd: pacman -S --noconfirm radare2
# - name: radare2
# ansible:builtin.shell:
# cmd: pacman -S --noconfirm radare2
#