-
-
Save thomasgroch/36e8e3e86fedba30391aa785eac117ca to your computer and use it in GitHub Desktop.
Arch Linux Ansible Bootstrap Joy Just For You
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# I install all necessary packages and configure Arch Linux. | |
- name: bootstrap Arch Linux | |
hosts: all | |
become: yes | |
vars: | |
my_username: alien | |
bootstrap_username: bootstrap | |
tasks: | |
- name: change root's shell to /bin/zsh | |
user: | |
name: root | |
shell: /bin/zsh | |
tags: users | |
- name: create my user | |
user: | |
name: "{{ my_username }}" | |
shell: /bin/zsh | |
tags: users | |
- name: add my user to sudoers | |
lineinfile: | |
dest: /etc/sudoers | |
line: "{{ my_username }} ALL=(ALL) ALL" | |
tags: users | |
- name: enable multilib pacman repo | |
replace: | |
dest: /etc/pacman.conf | |
regexp: '\#\[multilib\]\n\#Include = /etc/pacman\.d/mirrorlist' | |
replace: '[multilib]\nInclude = /etc/pacman.d/mirrorlist' | |
tags: pacman | |
- name: update pacman repos | |
pacman: update_cache=yes | |
tags: pacman | |
- name: install packages from official repositories | |
pacman: | |
name: "{{ item }}" | |
state: installed | |
with_items: | |
- gvim | |
- zsh | |
- git | |
- tk # gitk dependency | |
- sudo | |
- wget | |
- openssh | |
- cabal-install | |
- ghc | |
- nvidia-libgl | |
- nvidia | |
- nvidia-utils | |
- lib32-nvidia-libgl | |
- xorg | |
- libxrandr | |
- pkg-config | |
- libxft | |
- lightdm | |
- light-locker | |
- dunst | |
- libxpm | |
- chromium | |
- konsole | |
- gnome-themes-standard | |
- cantarell-fonts | |
- ttf-dejavu | |
- xorg-xinit | |
- xf86-input-keyboard | |
- xf86-input-mouse | |
- libxinerama | |
- feh | |
- adobe-source-code-pro-fonts | |
- rsync | |
- libnotify | |
- libpng | |
- at | |
- pidgin | |
- pulseaudio | |
- xorg-xsetroot | |
- alsa-utils | |
- lib32-alsa-lib | |
- os-prober | |
- gparted | |
- xorg-xrandr | |
- xorg-xmodmap | |
- screenfetch | |
- openconnect | |
- unzip | |
- ntp | |
- cifs-utils | |
- xsel # for vim copy-paste | |
- dialog # wifi-menu dependency | |
- ansible | |
- ntfs-3g | |
- tree | |
- cmus | |
- imagemagick | |
- encfs | |
- lsof | |
tags: pacman | |
- name: enable and start ntpd | |
service: | |
name: ntpd | |
enabled: yes | |
state: started | |
tags: clock | |
- name: check if ffcast exists | |
command: which ffcast | |
register: ffcast_check | |
failed_when: ffcast_check.rc > 1 | |
tags: aur | |
- name: create a temporary link to pod2man as a workaround to install ffcast | |
file: | |
src: /usr/bin/core_perl/pod2man | |
dest: /usr/bin/pod2man | |
state: link | |
when: ffcast_check.rc == 1 | |
tags: aur | |
- name: install packages from aur | |
become: yes | |
become_user: "{{ bootstrap_username }}" | |
makepkg: | |
name: "{{ item }}" | |
state: present | |
build_dir: /tmp | |
with_items: | |
- compton-git # Transparency | |
- dmenu-xft-height # dmenu with fancy options | |
- lightdm-another-gtk-greeter # GTK greeter for LightDM | |
- xrectsel # Dependency for ffcast | |
- ffcast # Dependency for gif script | |
- unclutter-xfixes-git # Hides mouse cursor after inactivity (patched) | |
- dropbox | |
- dropbox-cli | |
tags: aur | |
- name: remove a temporary link to pod2man as a workaround to install ffcast | |
file: | |
path: /usr/bin/pod2man | |
state: absent | |
when: ffcast_check.rc == 1 | |
tags: aur | |
- name: create .ssh directory for my user | |
file: | |
path: /home/{{ my_username }}/.ssh | |
state: directory | |
owner: "{{ my_username }}" | |
group: "{{ my_username }}" | |
mode: 0700 | |
tags: ssh | |
- name: copy ssh config to my user's .ssh directory | |
copy: | |
src: keys/config | |
dest: /home/{{ my_username }}/.ssh/config | |
owner: "{{ my_username }}" | |
group: "{{ my_username }}" | |
mode: 0600 | |
tags: ssh | |
- name: copy bitbucket private key to my user's .ssh directory | |
copy: | |
src: keys/bitbucket | |
dest: /home/{{ my_username }}/.ssh/bitbucket | |
owner: "{{ my_username }}" | |
group: "{{ my_username }}" | |
mode: 0600 | |
tags: ssh | |
- name: clone oh-my-zsh for my user | |
become: yes | |
become_user: "{{ my_username }}" | |
git: | |
repo: https://github.com/robbyrussell/oh-my-zsh.git | |
dest: /home/{{ my_username }}/.oh-my-zsh | |
tags: ssh | |
- name: clone oh-my-zsh for root | |
become: yes | |
become_user: root | |
git: | |
repo: https://github.com/robbyrussell/oh-my-zsh.git | |
dest: /root/.oh-my-zsh | |
tags: ssh | |
- name: check if dotfiles repo exists in my user's home directory | |
stat: path=/home/{{ my_username }}/.git | |
register: dotfiles_repository | |
tags: ssh | |
- name: git clone dotfiles into my user's home directory | |
become: yes | |
become_user: "{{ my_username }}" | |
script: scripts/dotfiles.sh {{ my_username }} | |
when: not dotfiles_repository.stat.exists | |
tags: ssh | |
- name: configure git credentials for dotfiles | |
blockinfile: | |
dest: /home/{{ my_username }}/.git/config | |
backup: no | |
content: | | |
[user] | |
\temail = [email protected] | |
\tname = Obszczymucha | |
tags: ssh | |
- name: create symlink to zsh theme for my user | |
file: | |
src: /home/{{ my_username }}/.SystemSetup/alien.zsh-theme | |
dest: /home/{{ my_username }}/.oh-my-zsh/themes/alien.zsh-theme | |
owner: "{{ my_username }}" | |
group: "{{ my_username }}" | |
state: link | |
tags: ssh | |
- name: create symlink to zsh theme for root | |
file: | |
src: /home/{{ my_username }}/.SystemSetup/alien-root.zsh-theme | |
dest: /root/.oh-my-zsh/themes/alien-root.zsh-theme | |
owner: root | |
group: root | |
state: link | |
tags: ssh | |
- name: create symlink to .zshrc for root | |
file: | |
src: /home/{{ my_username }}/.SystemSetup/root/.zshrc | |
dest: /root/.zshrc | |
owner: root | |
group: root | |
state: link | |
tags: ssh | |
- name: create symlink to .vimrc for root | |
file: | |
src: /home/{{ my_username }}/.vimrc | |
dest: /root/.vimrc | |
owner: root | |
group: root | |
state: link | |
tags: ssh | |
- name: check if /etc/X11/xorg.conf exists | |
stat: path=/etc/X11/xorg.conf | |
register: xorg_conf_file | |
tags: xorg | |
- name: configure Xorg with nvidia | |
command: nvidia-xconfig | |
when: not xorg_conf_file.stat.exists | |
tags: xorg | |
- name: replace /dev/mouse with /dev/input/mice in Xorg | |
replace: | |
dest: /etc/X11/xorg.conf | |
regexp: '/dev/mouse' | |
replace: '/dev/input/mice' | |
tags: xorg | |
- name: disable AutoAddDevices in Xorg configuration | |
blockinfile: | |
dest: /etc/X11/xorg.conf | |
backup: yes | |
content: | | |
Section "ServerFlags" | |
Option "AutoAddDevices" "false" | |
EndSection | |
tags: xorg | |
- name: fix windows key | |
replace: | |
dest: /usr/share/X11/xkb/symbols/pc | |
regexp: 'include \"altwin\(meta_alt\)\"' | |
replace: 'include "altwin(left_meta_win)"' | |
tags: xorg | |
- name: copy konsolerc into my user's .config directory | |
copy: | |
src: files/konsolerc | |
dest: /home/{{ my_username }}/.config/konsolerc | |
owner: "{{ my_username }}" | |
group: "{{ my_username }}" | |
tags: xorg | |
- name: checkout gfx repository | |
become: yes | |
become_user: "{{ my_username }}" | |
git: | |
repo: [email protected]:obszczymucha/gfx.git | |
dest: /home/{{ my_username }}/gfx | |
accept_hostkey: yes | |
key_file: /home/{{ my_username }}/.ssh/bitbucket | |
tags: xorg | |
- name: configure git credentials for gfx | |
blockinfile: | |
dest: /home/{{ my_username }}/gfx/.git/config | |
backup: no | |
content: | | |
[user] | |
\temail = [email protected] | |
\tname = Obszczymucha | |
tags: xorg | |
- name: check if gtk-login-screen-themes repo exists | |
stat: path=/usr/share/lightdm-another-gtk-greeter/themes/.git | |
register: gtk_login_screen_themes_repository | |
tags: | |
- xorg | |
- lightdm | |
- name: remove /usr/share/lightdm-another-gtk-greeter/themes directory if necessary | |
file: | |
path: /usr/share/lightdm-another-gtk-greeter/themes | |
state: absent | |
when: not gtk_login_screen_themes_repository.stat.exists | |
tags: | |
- xorg | |
- lightdm | |
- name: create /usr/share/lightdm-another-gtk-greeter/themes directory with appropriate permissions | |
file: | |
path: /usr/share/lightdm-another-gtk-greeter/themes | |
owner: root | |
group: "{{ my_username }}" | |
mode: u=rwx,g=rwx,o=rx | |
state: directory | |
when: not gtk_login_screen_themes_repository.stat.exists | |
tags: | |
- xorg | |
- lightdm | |
- name: checkout gtk-login-screen-themes repository | |
become: yes | |
become_user: "{{ my_username }}" | |
git: | |
repo: [email protected]:obszczymucha/gtk-login-screen-themes.git | |
dest: /usr/share/lightdm-another-gtk-greeter/themes | |
accept_hostkey: yes | |
key_file: /home/{{ my_username }}/.ssh/bitbucket | |
tags: | |
- xorg | |
- lightdm | |
- name: configure git credentials for gtk-login-screen-themes repository | |
blockinfile: | |
dest: /usr/share/lightdm-another-gtk-greeter/themes/.git/config | |
backup: no | |
content: | | |
[user] | |
\temail = [email protected] | |
\tname = Obszczymucha | |
tags: | |
- xorg | |
- lightdm | |
- name: check if login screen theme is set | |
stat: path=/usr/share/lightdm-another-gtk-greeter/themes/current | |
register: current_login_theme | |
tags: | |
- xorg | |
- lightdm | |
- name: set alien-orange as current login screen theme | |
file: | |
src: /usr/share/lightdm-another-gtk-greeter/themes/alien-orange | |
dest: /usr/share/lightdm-another-gtk-greeter/themes/current | |
owner: alien | |
group: alien | |
state: link | |
when: not current_login_theme.stat.exists | |
tags: | |
- xorg | |
- lightdm | |
- name: create /usr/share/xsessions directory | |
file: | |
path: /usr/share/xsessions | |
owner: root | |
group: root | |
state: directory | |
tags: | |
- xorg | |
- lightdm | |
- name: check if default xsession exists | |
stat: path=/usr/share/xsessions/default.desktop | |
register: default_xsession | |
tags: | |
- xorg | |
- lightdm | |
- name: copy default xsession | |
command: cp /home/{{ my_username }}/.SystemSetup/default.desktop /usr/share/xsessions/default.desktop | |
when: not default_xsession.stat.exists | |
tags: | |
- xorg | |
- lightdm | |
- name: create symlinks for xrandr login/session scripts | |
file: | |
src: /home/{{ my_username }}/.Scripts/{{ item }} | |
dest: /usr/share/{{ item }} | |
owner: root | |
group: root | |
state: link | |
with_items: | |
- mycustomloginvideo.sh | |
- mycustomsessionvideo.sh | |
tags: | |
- xorg | |
- lightdm | |
- name: copy lightdm configuration files | |
copy: | |
src: files/{{ item }} | |
dest: /etc/lightdm/{{ item }} | |
owner: root | |
group: root | |
with_items: | |
- lightdm-another-gtk-greeter.conf | |
- lightdm.conf | |
tags: | |
- xorg | |
- lightdm | |
- name: fix lightdm keyboard freeze part 1 | |
lineinfile: | |
dest: /usr/lib/systemd/system/lightdm.service | |
state: present | |
insertafter: 'Documentation=man:lightdm\(1\)' | |
line: [email protected] | |
create: yes | |
tags: | |
- xorg | |
- lightdm | |
- name: fix lightdm keyboard freeze part 2 | |
replace: | |
dest: /usr/lib/systemd/system/lightdm.service | |
regexp: 'After=systemd-user-sessions\.service (?!getty@tty1\.service)' | |
replace: 'After=systemd-user-sessions.service [email protected] ' | |
tags: | |
- xorg | |
- lightdm | |
- name: enable lightdm service | |
service: | |
name: lightdm | |
enabled: yes | |
tags: | |
- xorg | |
- lightdm | |
- name: create symlink to start-xmonad-session | |
file: | |
src: /home/{{ my_username }}/.SystemSetup/start-xmonad-session | |
dest: /usr/local/bin/start-xmonad-session | |
owner: root | |
group: root | |
state: link | |
tags: xorg | |
- name: install imgur-screenshot dependencies | |
pacman: | |
name: "{{ item }}" | |
state: installed | |
with_items: | |
- scrot | |
- xclip | |
tags: xorg | |
- name: download imgur-screenshot repository | |
git: | |
repo: https://github.com/jomo/imgur-screenshot.git | |
dest: /opt/imgur-screenshot | |
tags: xorg | |
- name: create a symlink for imgur-screenshot | |
file: | |
src: /opt/imgur-screenshot/imgur-screenshot.sh | |
dest: /home/{{ my_username }}/.Scripts/imgur-screenshot | |
owner: "{{ my_username }}" | |
group: "{{ my_username }}" | |
state: link | |
tags: xorg | |
- name: create screenshots directory | |
file: | |
path: /home/{{ my_username }}/Screenshots | |
owner: "{{ my_username }}" | |
group: "{{ my_username }}" | |
state: directory | |
tags: xorg | |
- name: create imgur-screenshot configuration directory | |
file: | |
path: /home/{{ my_username }}/.config/imgur-screenshot | |
owner: "{{ my_username }}" | |
group: "{{ my_username }}" | |
state: directory | |
recurse: yes | |
tags: xorg | |
- name: create imgur-screenshots configuration | |
blockinfile: | |
dest: /home/{{ my_username }}/.config/imgur-screenshot/settings.conf | |
backup: no | |
content: | | |
imgur_acct_key="02e5aa5db75064f" | |
imgur_secret="aee8035b9bf03080924ca65957abb06f19211d0d" | |
file_dir="$HOME/Screenshots" | |
create: yes | |
tags: xorg | |
- name: check if cabal repo exists | |
stat: path=/home/{{ my_username }}/.cabal | |
register: cabal_repo | |
tags: xmonad | |
- name: update cabal | |
become: yes | |
become_user: "{{ my_username }}" | |
shell: cabal update | |
when: not cabal_repo.stat.exists | |
tags: xmonad | |
- name: check if happy exists | |
stat: path=/home/{{ my_username }}/.cabal/bin/happy | |
register: happy | |
tags: xmonad | |
- name: install happy | |
become: yes | |
become_user: "{{ my_username }}" | |
shell: cabal install happy | |
when: not happy.stat.exists | |
tags: xmonad | |
- name: check if alex exists | |
stat: path=/home/{{ my_username }}/.cabal/bin/alex | |
register: alex | |
tags: xmonad | |
- name: install alex | |
become: yes | |
become_user: "{{ my_username }}" | |
shell: cabal install alex | |
when: not alex.stat.exists | |
tags: xmonad | |
- name: check if c2hs exists | |
stat: path=/home/{{ my_username }}/.cabal/bin/c2hs | |
register: c2hs | |
tags: xmonad | |
- name: install c2hs | |
become: yes | |
become_user: "{{ my_username }}" | |
shell: cabal install c2hs | |
when: not c2hs.stat.exists | |
tags: xmonad | |
- name: check if xmobar exists | |
stat: path=/home/{{ my_username }}/.cabal/bin/xmobar | |
register: xmobar | |
tags: xmonad | |
- name: install xmobar | |
become: yes | |
become_user: "{{ my_username }}" | |
shell: cabal install xmobar --flags="with_dbus with_alsa with_xft" | |
when: not xmobar.stat.exists | |
tags: xmonad | |
- name: check if xmonad exists | |
stat: path=/home/{{ my_username }}/.cabal/bin/xmonad | |
register: xmonad | |
tags: xmonad | |
- name: install xmonad | |
become: yes | |
become_user: "{{ my_username }}" | |
shell: cabal install xmonad xmonad-contrib | |
when: not xmonad.stat.exists | |
tags: xmonad | |
- name: create symlink to xmonad | |
file: | |
src: /home/{{ my_username }}/.cabal/bin/xmonad | |
dest: /usr/local/bin/xmonad | |
owner: root | |
group: root | |
state: link | |
tags: xmonad | |
- name: create symlink to xmobar | |
file: | |
src: /home/{{ my_username }}/.cabal/bin/xmobar | |
dest: /usr/local/bin/xmobar | |
owner: root | |
group: root | |
state: link | |
tags: xmonad | |
- name: make alsa work by blacklisting some shit | |
lineinfile: | |
dest: /etc/modprobe.d/blacklist.conf | |
line: blacklist i82975x_edac | |
create: yes | |
tags: audio | |
- name: check if gradle exists | |
stat: path=/opt/gradle | |
register: gradle | |
tags: dev | |
- name: install gradle | |
script: scripts/gradle.sh 2.4 | |
when: not gradle.stat.exists | |
tags: dev | |
- name: check if jdk7 exists | |
stat: path=/opt/jdk7 | |
register: jdk7 | |
tags: dev | |
- name: install jdk7 | |
script: scripts/jdk7.sh | |
when: not jdk7.stat.exists | |
tags: dev | |
- name: install virtualbox + vagrant | |
pacman: | |
name: "{{ item }}" | |
state: installed | |
with_items: | |
- qt4 | |
- virtualbox | |
- vagrant | |
tags: dev | |
- name: check if packer (packer.io) exists | |
stat: path=/opt/packer | |
register: packer | |
tags: dev | |
- name: install packer (packer.io) | |
script: scripts/packer.sh 0.8.1 | |
when: not packer.stat.exists | |
tags: dev | |
- name: install wine | |
pacman: | |
name: "{{ item }}" | |
state: installed | |
with_items: | |
- wine | |
- lib32-libldap # For battle.net | |
tags: games | |
- name: clone arch-bootstrap project | |
become: yes | |
become_user: "{{ my_username }}" | |
git: | |
repo: [email protected]:obszczymucha/arch-bootstrap.git | |
dest: /home/{{ my_username }}/.projects/arch-bootstrap | |
tags: dev | |
- name: create symlink to .projects | |
become: yes | |
file: | |
src: /home/{{ my_username }}/.projects | |
dest: /projects | |
state: link | |
tags: dev |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment