2020-12-07 19:45:06 +01:00
|
|
|
---
|
|
|
|
- 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 (debian)
|
|
|
|
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
|
2020-12-08 17:15:31 +01:00
|
|
|
when: local_development is not defined
|
2020-12-07 19:45:06 +01:00
|
|
|
|
|
|
|
- name: antibody
|
|
|
|
shell: |
|
|
|
|
set -o pipefail
|
|
|
|
curl -sfL https://git.io/antibody | sh -s - -b /usr/local/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
|
|
|
|
shell: |
|
|
|
|
echo "export DOTFILES={{ DOTFILES }}" >> "$HOME/.zshrc"
|
|
|
|
echo 'source $DOTFILES/brethil_dotfile.sh' >> "$HOME/.zshrc"
|
|
|
|
args:
|
|
|
|
creates: "~{{ ansible_user }}/.zshrc"
|
|
|
|
|
|
|
|
- name: dotfiles symlink
|
|
|
|
file:
|
|
|
|
src: "{{ DOTFILES }}/{{ item.key }}"
|
|
|
|
dest: "{{ item.value }}"
|
|
|
|
state: link
|
|
|
|
force: yes
|
|
|
|
loop: "{{ files | dict2items }}"
|
|
|
|
vars:
|
|
|
|
files:
|
|
|
|
"ackrc": "~/.ackrc"
|
|
|
|
"vim/vimrc": "~/.vimrc"
|
|
|
|
"pdbrc.py": "~/.pdbrc.py"
|
2020-12-09 01:54:42 +01:00
|
|
|
# "ipython": "~/.ipython" # FIXME: ipython config is more complex
|
2021-07-18 17:32:15 +02:00
|
|
|
"ansible/ansible.cfg": "~/.ansible.cfg"
|
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
|
|
|
|
command: DOTFILES={{ DOTFILES }} vim -c 'PlugInstall|qa!'
|
|
|
|
|
2020-12-08 02:05:07 +01:00
|
|
|
- name: git config facts
|
|
|
|
community.general.git_config:
|
|
|
|
name: "include.path"
|
|
|
|
scope: global
|
|
|
|
register: config_value
|
|
|
|
- debug:
|
|
|
|
msg: "Git config include.path={{ config_value }}"
|
|
|
|
|
2020-12-07 19:45:06 +01:00
|
|
|
- name: git config
|
|
|
|
community.general.git_config:
|
|
|
|
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
|
|
|
|
owner: root
|
|
|
|
group: root
|
2021-04-11 20:16:31 +02: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
|
|
|
|
|
|
|
|
- name: directories
|
|
|
|
file:
|
|
|
|
dest: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
mode: 0700
|
|
|
|
loop: "{{ directories }}"
|
|
|
|
vars:
|
|
|
|
directories:
|
|
|
|
- "$HOME/bin"
|
|
|
|
- "$HOME/projects"
|
|
|
|
- "$HOME/git"
|