mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-11-24 20:41:31 +01:00
977a45e109
- apply prettier - fix misc issues
128 lines
3.6 KiB
YAML
128 lines
3.6 KiB
YAML
---
|
|
- hosts: all
|
|
become: true
|
|
vars_files:
|
|
- ../ansible-packages.yml
|
|
vars:
|
|
DOTFILES: "$HOME/.dotfiles"
|
|
|
|
tasks:
|
|
- name: Install required system packages (debian)
|
|
apt:
|
|
install_recommends: no
|
|
update_cache: yes
|
|
pkg: "{{ packages + packages_debian }}"
|
|
when: ansible_facts['os_family'] == "Debian"
|
|
|
|
- name: Install required system packages (arch)
|
|
pacman:
|
|
update_cache: yes
|
|
name: "{{ packages + packages_archlinux }}"
|
|
when: ansible_facts['os_family'] == "Archlinux"
|
|
|
|
- name: dotfiles repo
|
|
git:
|
|
repo: https://git.decapod.one/brethil/dotfiles
|
|
dest: "{{ DOTFILES }}"
|
|
version: master
|
|
when: local_development is not defined
|
|
|
|
- name: directories
|
|
file:
|
|
dest: "{{ item }}"
|
|
state: directory
|
|
mode: 0700
|
|
loop: "{{ directories }}"
|
|
vars:
|
|
directories:
|
|
- "$HOME/bin"
|
|
- "$HOME/projects"
|
|
- "$HOME/git"
|
|
- "$HOME/.config/git"
|
|
|
|
- name: antibody # TODO: antibody is available on apt(debian)/brew/pacman
|
|
shell: |
|
|
set -euo pipefail
|
|
curl -sfL https://git.io/antibody | sh -s - -b $HOME/bin/
|
|
$HOME/bin/antibody bundle "{{ DOTFILES }}/antibody_plugins.txt"
|
|
args:
|
|
executable: /bin/bash
|
|
creates: /usr/local/bin/antibody
|
|
|
|
- name: zsh as default shell
|
|
user:
|
|
name: "{{ ansible_user }}"
|
|
shell: /usr/bin/zsh
|
|
|
|
- name: zsh config
|
|
blockinfile:
|
|
path: $HOME/.zshrc
|
|
marker: "# brethil dotfiles"
|
|
block: |
|
|
export DOTFILES={{ DOTFILES }}
|
|
source $DOTFILES/brethil_dotfile.sh
|
|
create: true
|
|
|
|
- name: dotfiles symlink
|
|
file:
|
|
src: "{{ DOTFILES }}/{{ item.key }}"
|
|
dest: "{{ item.value }}"
|
|
state: link
|
|
force: yes
|
|
loop: "{{ files | dict2items }}"
|
|
vars:
|
|
files:
|
|
"tmux.conf": "~/.tmux.conf"
|
|
"vim/vimrc": "~/.vimrc"
|
|
"pdbrc.py": "~/.pdbrc.py"
|
|
# "ipython": "~/.ipython" # FIXME: ipython config is more complex
|
|
"ansible/ansible.cfg": "~/.ansible.cfg"
|
|
"gitignore": "~/.config/git/ignore"
|
|
|
|
- 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
|
|
|
|
- name: vim plugins install
|
|
# Open vim once so that the plugins are installed
|
|
command: echo | env DOTFILES={{ DOTFILES }} vim
|
|
|
|
- name: git config facts
|
|
community.general.git_config:
|
|
name: "include.path"
|
|
scope: global
|
|
register: config_value
|
|
- debug:
|
|
msg: "Git config include.path={{ config_value }}"
|
|
|
|
- name: git config
|
|
community.general.git_config:
|
|
name: "include.path"
|
|
value: "{{ DOTFILES }}/gitconfig"
|
|
scope: global
|
|
when: config_value is not defined
|
|
|
|
- name: git global .gitignore
|
|
copy:
|
|
src: ../../gitignore
|
|
dest: ~/.gitignore
|
|
mode: "0600"
|
|
backup: yes
|
|
|
|
- name: annoyances
|
|
shell: |
|
|
## Fix scrolling in byobu
|
|
if [[ $(uname) == "Darwin" ]]; then
|
|
sed -i '' 's/set -g terminal-overrides/#set -g terminal-overrides/' /usr/local/share/byobu/profiles/tmux
|
|
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
|