mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-11-21 11:01:31 +01:00
ansible: cleanup setup playbook
This commit is contained in:
parent
208057ce91
commit
bcad9f77aa
|
@ -1,10 +1,10 @@
|
|||
---
|
||||
- hosts: all
|
||||
become: true
|
||||
- name: Setup dotfiles
|
||||
hosts: all
|
||||
vars_files:
|
||||
- ../ansible-packages.yml
|
||||
vars:
|
||||
DOTFILES: "$HOME/.dotfiles"
|
||||
dotfiles_path: "$HOME/.dotfiles"
|
||||
|
||||
tasks:
|
||||
- name: Install required system packages (debian)
|
||||
|
@ -13,18 +13,19 @@
|
|||
update_cache: yes
|
||||
pkg: "{{ packages + packages_debian }}"
|
||||
when: ansible_facts['os_family'] == "Debian"
|
||||
become: true
|
||||
|
||||
- name: Install required system packages (arch)
|
||||
pacman:
|
||||
update_cache: yes
|
||||
name: "{{ packages + packages_archlinux }}"
|
||||
when: ansible_facts['os_family'] == "Archlinux"
|
||||
become: true
|
||||
|
||||
- name: dotfiles repo
|
||||
- name: Clone dotfiles repo
|
||||
git:
|
||||
repo: https://git.decapod.one/brethil/dotfiles
|
||||
dest: "{{ DOTFILES }}"
|
||||
version: master
|
||||
dest: "{{ dotfiles_path }}"
|
||||
when: local_development is not defined
|
||||
|
||||
- name: directories
|
||||
|
@ -42,30 +43,32 @@
|
|||
- "$HOME/.ssh/"
|
||||
- "$HOME/.ssh/sockets"
|
||||
|
||||
- name: antibody # TODO: antibody is available on apt(debian)/brew/pacman
|
||||
- name: Install antibody
|
||||
shell: |
|
||||
set -euo pipefail
|
||||
curl -sfL https://git.io/antibody | sh -s - -b $HOME/bin/
|
||||
$HOME/bin/antibody bundle "{{ DOTFILES }}/antibody_plugins.txt"
|
||||
$HOME/bin/antibody bundle "{{ dotfiles_path }}/antibody_plugins.txt"
|
||||
args:
|
||||
executable: /bin/bash
|
||||
creates: /usr/local/bin/antibody
|
||||
creates: bin/antibody
|
||||
|
||||
- name: zsh as default shell
|
||||
- name: Set zsh as default shell
|
||||
user:
|
||||
name: "{{ ansible_user }}"
|
||||
shell: /usr/bin/zsh
|
||||
become: true
|
||||
|
||||
- name: zsh config
|
||||
- name: Update zshrc
|
||||
blockinfile:
|
||||
path: $HOME/.zshrc
|
||||
marker: "# {mark} brethil dotfiles"
|
||||
block: |
|
||||
export DOTFILES={{ DOTFILES }}
|
||||
export DOTFILES={{ dotfiles_path }}
|
||||
source $DOTFILES/brethil_dotfile.sh
|
||||
create: true
|
||||
mode: 600
|
||||
|
||||
- name: ssh config
|
||||
- name: Update .ssh/config
|
||||
blockinfile:
|
||||
path: $HOME/.ssh/config
|
||||
marker: "# {mark} brethil dotfiles"
|
||||
|
@ -82,12 +85,11 @@
|
|||
|
||||
Host *
|
||||
ServerAliveInterval 300
|
||||
|
||||
create: true
|
||||
|
||||
- name: dotfiles symlink
|
||||
- name: dotfiles symlinks
|
||||
file:
|
||||
src: "{{ DOTFILES }}/{{ item.key }}"
|
||||
src: "{{ dotfiles_path }}/{{ item.key }}"
|
||||
dest: "{{ item.value }}"
|
||||
state: link
|
||||
force: yes
|
||||
|
@ -101,19 +103,19 @@
|
|||
"ansible/ansible.cfg": "~/.ansible.cfg"
|
||||
"gitignore": "~/.config/git/ignore"
|
||||
|
||||
- name: check undodir_migration
|
||||
stat: path=${HOME}/.vim_runtime/temp_dirs/undodir
|
||||
register: undodir
|
||||
- name: Exec vim undodir migration (if required)
|
||||
command: |
|
||||
mv ${HOME}/.vim_runtime/temp_dirs/undodir ${HOME}/.vim/undo
|
||||
args:
|
||||
removes: .vim_runtime/temp_dirs/undodir
|
||||
|
||||
- name: vim undodir migration
|
||||
command: mv ${HOME}/.vim_runtime/temp_dirs/undodir ${HOME}/.vim/undo
|
||||
when: undodir.stat.exists
|
||||
- name: Install vim plugins
|
||||
command: |
|
||||
env DOTFILES={{ dotfiles_path }} vim -c 'PlugInstall|qa!'
|
||||
args:
|
||||
creates: .vim/vim-plug
|
||||
|
||||
- name: vim plugins install
|
||||
# Open vim once so that the plugins are installed
|
||||
command: echo | env DOTFILES={{ DOTFILES }} vim
|
||||
|
||||
- name: git config facts
|
||||
- name: Get git config facts
|
||||
community.general.git_config:
|
||||
name: "include.path"
|
||||
scope: global
|
||||
|
@ -121,10 +123,10 @@
|
|||
- debug:
|
||||
msg: "Git config include.path={{ config_value }}"
|
||||
|
||||
- name: git config
|
||||
- name: Set up git config include if required
|
||||
community.general.git_config:
|
||||
name: "include.path"
|
||||
value: "{{ DOTFILES }}/gitconfig"
|
||||
value: "{{ dotfiles_path }}/gitconfig"
|
||||
scope: global
|
||||
when: config_value is not defined
|
||||
|
||||
|
@ -133,17 +135,3 @@
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue
Block a user