2020-12-07 19:45:06 +01:00
|
|
|
---
|
|
|
|
- hosts: all
|
|
|
|
become: true
|
|
|
|
vars_files:
|
|
|
|
- ../ansible-packages.yml
|
|
|
|
vars:
|
2022-12-18 13:19:53 +01:00
|
|
|
DOTFILES: "$HOME/.dotfiles"
|
2020-12-07 19:45:06 +01:00
|
|
|
|
|
|
|
tasks:
|
|
|
|
- name: Install required system packages (debian)
|
|
|
|
apt:
|
|
|
|
install_recommends: no
|
|
|
|
update_cache: yes
|
2022-12-18 13:19:53 +01:00
|
|
|
pkg: "{{ packages + packages_debian }}"
|
2020-12-07 19:45:06 +01:00
|
|
|
when: ansible_facts['os_family'] == "Debian"
|
|
|
|
|
2022-12-18 13:19:53 +01:00
|
|
|
- name: Install required system packages (arch)
|
2020-12-07 19:45:06 +01:00
|
|
|
pacman:
|
|
|
|
update_cache: yes
|
2022-12-18 13:19:53 +01:00
|
|
|
name: "{{ packages + packages_archlinux }}"
|
2020-12-07 19:45:06 +01:00
|
|
|
when: ansible_facts['os_family'] == "Archlinux"
|
|
|
|
|
|
|
|
- name: dotfiles repo
|
|
|
|
git:
|
|
|
|
repo: https://git.decapod.one/brethil/dotfiles
|
2022-12-18 13:19:53 +01:00
|
|
|
dest: "{{ DOTFILES }}"
|
2020-12-07 19:45:06 +01:00
|
|
|
version: master
|
2020-12-08 17:15:31 +01:00
|
|
|
when: local_development is not defined
|
2020-12-07 19:45:06 +01:00
|
|
|
|
2022-02-05 13:44:05 +01:00
|
|
|
- name: directories
|
|
|
|
file:
|
2022-12-18 13:19:53 +01:00
|
|
|
dest: "{{ item }}"
|
2022-02-05 13:44:05 +01:00
|
|
|
state: directory
|
|
|
|
mode: 0700
|
2022-12-18 13:19:53 +01:00
|
|
|
loop: "{{ directories }}"
|
2022-02-05 13:44:05 +01:00
|
|
|
vars:
|
|
|
|
directories:
|
2022-12-18 13:19:53 +01:00
|
|
|
- "$HOME/bin"
|
|
|
|
- "$HOME/projects"
|
|
|
|
- "$HOME/git"
|
|
|
|
- "$HOME/.config/git"
|
2022-02-05 13:44:05 +01:00
|
|
|
|
|
|
|
- name: antibody # TODO: antibody is available on apt(debian)/brew/pacman
|
2020-12-07 19:45:06 +01:00
|
|
|
shell: |
|
2022-02-05 13:44:05 +01:00
|
|
|
set -euo pipefail
|
|
|
|
curl -sfL https://git.io/antibody | sh -s - -b $HOME/bin/
|
2022-12-18 13:19:53 +01:00
|
|
|
$HOME/bin/antibody bundle "{{ DOTFILES }}/antibody_plugins.txt"
|
2020-12-07 19:45:06 +01:00
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
|
|
|
creates: /usr/local/bin/antibody
|
|
|
|
|
|
|
|
- name: zsh as default shell
|
|
|
|
user:
|
2022-12-18 13:19:53 +01:00
|
|
|
name: "{{ ansible_user }}"
|
2020-12-07 19:45:06 +01:00
|
|
|
shell: /usr/bin/zsh
|
|
|
|
|
|
|
|
- name: zsh config
|
2022-02-05 13:44:05 +01:00
|
|
|
blockinfile:
|
|
|
|
path: $HOME/.zshrc
|
2022-08-22 10:14:07 +02:00
|
|
|
marker: "# brethil dotfiles"
|
2022-02-05 13:44:05 +01:00
|
|
|
block: |
|
|
|
|
export DOTFILES={{ DOTFILES }}
|
|
|
|
source $DOTFILES/brethil_dotfile.sh
|
2022-12-18 13:19:53 +01:00
|
|
|
create: true
|
2020-12-07 19:45:06 +01:00
|
|
|
|
|
|
|
- name: dotfiles symlink
|
|
|
|
file:
|
2022-12-18 13:19:53 +01:00
|
|
|
src: "{{ DOTFILES }}/{{ item.key }}"
|
|
|
|
dest: "{{ item.value }}"
|
2020-12-07 19:45:06 +01:00
|
|
|
state: link
|
|
|
|
force: yes
|
2022-12-18 13:19:53 +01:00
|
|
|
loop: "{{ files | dict2items }}"
|
2020-12-07 19:45:06 +01:00
|
|
|
vars:
|
|
|
|
files:
|
2022-12-18 13:19:53 +01:00
|
|
|
"tmux.conf": "~/.tmux.conf"
|
|
|
|
"vim/vimrc": "~/.vimrc"
|
|
|
|
"pdbrc.py": "~/.pdbrc.py"
|
2020-12-09 01:54:42 +01:00
|
|
|
# "ipython": "~/.ipython" # FIXME: ipython config is more complex
|
2022-12-18 13:19:53 +01:00
|
|
|
"ansible/ansible.cfg": "~/.ansible.cfg"
|
|
|
|
"gitignore": "~/.config/git/ignore"
|
2020-12-07 19:45:06 +01:00
|
|
|
|
2020-12-09 01:54:42 +01:00
|
|
|
- name: check undodir_migration
|
|
|
|
stat: path=${HOME}/.vim_runtime/temp_dirs/undodir
|
|
|
|
register: undodir
|
|
|
|
|
|
|
|
- name: vim undodir migration
|
|
|
|
command: mv ${HOME}/.vim_runtime/temp_dirs/undodir ${HOME}/.vim/undo
|
|
|
|
when: undodir.stat.exists
|
|
|
|
|
2021-04-11 20:16:31 +02:00
|
|
|
- name: vim plugins install
|
2022-01-12 10:06:54 +01:00
|
|
|
# Open vim once so that the plugins are installed
|
|
|
|
command: echo | env DOTFILES={{ DOTFILES }} vim
|
2021-04-11 20:16:31 +02:00
|
|
|
|
2020-12-08 02:05:07 +01:00
|
|
|
- name: git config facts
|
|
|
|
community.general.git_config:
|
2022-12-18 13:19:53 +01:00
|
|
|
name: "include.path"
|
2020-12-08 02:05:07 +01:00
|
|
|
scope: global
|
|
|
|
register: config_value
|
|
|
|
- debug:
|
2022-12-18 13:19:53 +01:00
|
|
|
msg: "Git config include.path={{ config_value }}"
|
2020-12-08 02:05:07 +01:00
|
|
|
|
2020-12-07 19:45:06 +01:00
|
|
|
- name: git config
|
|
|
|
community.general.git_config:
|
2022-12-18 13:19:53 +01:00
|
|
|
name: "include.path"
|
|
|
|
value: "{{ DOTFILES }}/gitconfig"
|
2020-12-08 02:05:07 +01:00
|
|
|
scope: global
|
|
|
|
when: config_value is not defined
|
2020-12-07 19:45:06 +01:00
|
|
|
|
2021-01-09 21:28:21 +01:00
|
|
|
- name: git global .gitignore
|
|
|
|
copy:
|
|
|
|
src: ../../gitignore
|
|
|
|
dest: ~/.gitignore
|
2022-12-18 13:19:53 +01:00
|
|
|
mode: "0600"
|
2021-01-09 21:28:21 +01:00
|
|
|
backup: yes
|
|
|
|
|
2020-12-07 19:45:06 +01:00
|
|
|
- name: annoyances
|
|
|
|
shell: |
|
|
|
|
## Fix scrolling in byobu
|
|
|
|
if [[ $(uname) == "Darwin" ]]; then
|
2021-04-11 20:16:31 +02:00
|
|
|
sed -i '' 's/set -g terminal-overrides/#set -g terminal-overrides/' /usr/local/share/byobu/profiles/tmux
|
2020-12-07 19:45:06 +01:00
|
|
|
else
|
|
|
|
sed -i 's/set -g terminal-overrides/#set -g terminal-overrides/' /usr/share/byobu/profiles/tmux
|
|
|
|
fi
|
|
|
|
sed 's|ls \\|#ls \\|' /etc/grc.zsh
|
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
|
|
|
when: fix_annoyances is true
|