-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.yml
More file actions
205 lines (184 loc) · 5.24 KB
/
setup.yml
File metadata and controls
205 lines (184 loc) · 5.24 KB
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
---
- name: Setup Ubuntu Dev Machine
hosts: local
become: yes
vars:
ansible_python_interpreter: /usr/bin/python3
local_user: "{{ lookup('env', 'SUDO_USER') | default(lookup('env', 'USER'), true) }}"
tasks:
# ---------------------------
# System update & upgrade
# ---------------------------
- name: Update apt cache
apt:
update_cache: yes
cache_valid_time: 3600
tags: system
- name: Upgrade packages
apt:
upgrade: dist
tags: system
# ---------------------------
# Common CLI tools
# ---------------------------
- name: Install common tools
apt:
name:
- git
- curl
- vim
- htop
- wget
- unzip
- net-tools
- tree
- jq
- build-essential
- software-properties-common
state: present
tags: tools
# ---------------------------
# SSH server
# ---------------------------
- name: Install SSH
apt:
name: openssh-server
state: present
tags: ssh
# ---------------------------
# Programming languages & runtimes
# ---------------------------
- name: Install Python and pip
apt:
name:
- python3
- python3-pip
- python3-venv
- gnupg
state: present
tags: languages
- name: Install Node.js and npm
apt:
name:
- nodejs
- npm
state: present
tags: languages
- name: Install Bun
block:
- name: Install Bun
shell: curl -fsSL https://bun.sh/install | bash
args:
executable: /bin/bash
environment:
BUN_INSTALL: "/home/{{ local_user }}/.bun"
- name: Add Bun to PATH in bashrc
lineinfile:
path: "/home/{{ local_user }}/.bashrc"
line: 'export PATH="$BUN_INSTALL/bin:$PATH"'
state: present
create: yes
tags: languages
# ---------------------------
# Dev & productivity tools
# ---------------------------
- name: Install dev tools from apt
apt:
name:
- tmux
- zsh
- fzf
- ripgrep
state: present
tags: dev
- name: Git setup
block:
- name: Copy Git config
copy:
src: .gitconfig
dest: "/home/{{ local_user }}/.gitconfig"
owner: "{{ local_user }}"
group: "{{ local_user }}"
mode: '0644'
- name: Setup GPG_TTY environment variable
lineinfile:
path: "/home/{{ local_user }}/.bashrc"
line: 'export GPG_TTY=$(tty)'
state: present
create: yes
tags: dev
- name: Tmux setup
block:
- name: Copy tmux config
copy:
src: .tmux.conf
dest: "/home/{{ local_user }}/.tmux.conf"
owner: "{{ local_user }}"
group: "{{ local_user }}"
mode: '0644'
- name: Tmux auto-attach
blockinfile:
path: "/home/{{ local_user }}/.bashrc"
marker: "# {mark} ANSIBLE MANAGED BLOCK - tmux"
block: |
if command -v tmux &> /dev/null; then
if [ -z "$TMUX" ] && [[ $- == *i* ]]; then
tmux attach-session -t default || tmux new-session -s default
fi
fi
tags: dev
- name: Neovim setup
block:
- name: Download Neovim AppImage
get_url:
url: https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.appimage
dest: /tmp/nvim-linux-x86_64.appimage
mode: '0755'
- name: Create /opt/nvim directory
file:
path: /opt/nvim
state: directory
mode: '0755'
- name: Move Neovim to /opt/nvim
copy:
src: /tmp/nvim-linux-x86_64.appimage
dest: /opt/nvim/nvim
mode: '0755'
remote_src: yes
- name: Add Neovim to PATH in bashrc
lineinfile:
path: "/home/{{ local_user }}/.bashrc"
line: 'export PATH="$PATH:/opt/nvim/"'
state: present
create: yes
- name: Create Neovim config directory
file:
path: "/home/{{ local_user }}/.config/nvim"
state: directory
owner: "{{ local_user }}"
group: "{{ local_user }}"
mode: '0755'
- name: Copy Neovim config
copy:
src: .config/nvim/init.lua
dest: "/home/{{ local_user }}/.config/nvim/init.lua"
owner: "{{ local_user }}"
group: "{{ local_user }}"
mode: '0644'
tags: dev
- name: Install Claude Code
shell: curl -fsSL https://claude.ai/install.sh | bash
args:
executable: /bin/bash
creates: "/home/{{ local_user }}/.claude/local/bin/claude"
become: no
become_user: "{{ local_user }}"
tags: dev
# ---------------------------
# System cleanup
# ---------------------------
- name: Clean up apt cache
apt:
autoclean: yes
autoremove: yes
tags: cleanup