-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase.yml
132 lines (112 loc) · 3.97 KB
/
base.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
- name: Setup ZSH, Neovim, and .aliases
hosts: localhost
tasks:
- name: Gather OS specific facts
ansible.builtin.setup:
- name: Install ZSH
ansible.builtin.package:
name: zsh
- name: Change shell to zsh
shell: chsh -s $(which zsh)
- name: Check that the somefile.conf exists
stat:
path: "{{ lookup('env', 'HOME') }}/.oh-my-zsh"
register: oh_my_stats
- name: Oh-My-Zsh
shell: curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh > ~/.oh-my-installer && chmod +x ~/.oh-my-installer && ~/.oh-my-installer
when: oh_my_stats.stat.exists == False
- name: Install zsh-autosuggestions
ansible.builtin.git:
repo: "https://github.com/zsh-users/zsh-autosuggestions.git"
dest: "~/.oh-my-zsh/plugins/zsh-autosuggestions"
- name: Download fzf git
ansible.builtin.git:
repo: "https://github.com/junegunn/fzf-git.sh.git"
dest: "~/fzf-git.sh"
- name: Add Neovim PPA for Ubuntu
ansible.builtin.apt_repository:
repo: ppa:neovim-ppa/unstable
state: present
when: ansible_facts['os_family'] == "Debian"
- name: Update apt package manager
ansible.builtin.apt:
update_cache: yes
when: ansible_facts['os_family'] == "Debian"
- name: Install Node.js and npm on Ubuntu
ansible.builtin.package:
name:
- nodejs
- npm
state: present
when: ansible_facts['os_family'] == "Debian"
- name: Install Node.js using Homebrew on macOS
ansible.builtin.package:
name: node
state: present
use: homebrew
when: ansible_facts['os_family'] == "Darwin"
- name: Install Wezterm using Homebrew on macOS
ansible.builtin.package:
name: wezterm
state: present
use: homebrew
when: ansible_facts['os_family'] == "Darwin"
- name: ZSH-vi-mode on macOS
ansible.builtin.package:
name: zsh-vi-mode
state: present
use: homebrew
when: ansible_facts['os_family'] == "Darwin"
- name: install local packages
ansible.builtin.package:
name:
- neovim
- ripgrep
- fzf
- tmux
- bat
- eza
- git-delta
- stow
state: present
- name: Install tldr
shell: npm install -g tldr
- name: Cloning .dotfiles
ansible.builtin.git:
repo: "[email protected]:tamjidrahman/dotfiles.git"
dest: "{{ lookup('env', 'HOME') }}/src/dotfiles"
recursive: yes
update: yes
accept_hostkey: yes
version: main
- name: Stow dotfiles
shell: |
rm -rf {{ lookup('env', 'HOME') }}/.zshrc
cd {{ lookup('env', 'HOME') }}/src/dotfiles
stow -t {{ lookup('env', 'HOME') }} .
# On Debian and Ubuntu, bat uses the batcat command by default because of a conflict with an existing package, bacula-console-qt
# TODO: just symlink bat to batcat
- name: Switch from bat to batcat on Ubuntu
lineinfile:
path: "{{ lookup('env', 'HOME') }}/.aliases"
search_string: 'alias cat="bat"'
line: 'alias cat="batcat"'
when: ansible_facts['os_family'] == "Debian"
- name: Switch bat to batcat on Ubuntu
lineinfile:
path: "{{ lookup('env', 'HOME') }}/src/dotfiles/install_bat.sh"
search_string: "bat cache --build"
line: "batcat cache --build"
when: ansible_facts['os_family'] == "Debian"
#
- name: Update bat themes
shell: |
chmod +x {{ lookup('env', 'HOME') }}/src/dotfiles/install_bat.sh
{{ lookup('env', 'HOME') }}/src/dotfiles/install_bat.sh
# TODO: fix fzf keybindings for debian, currently this is turned off
- name: Ignore fzf key-bindings for apt-get on Ubuntu
lineinfile:
path: "{{ lookup('env', 'HOME') }}/.zshrc"
search_string: "(fzf --zsh)"
state: "absent"
when: ansible_facts['os_family'] == "Debian"