-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev-setup.yml
More file actions
270 lines (239 loc) · 7.3 KB
/
Copy pathdev-setup.yml
File metadata and controls
270 lines (239 loc) · 7.3 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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
---
- name: Interactive Developer Workstation Setup
hosts: localhost
become: yes
vars_prompt:
- name: install_go
prompt: "Install Go (1.22.3)?"
private: no
default: "yes"
- name: install_rust
prompt: "Install Rust?"
private: no
default: "yes"
- name: install_ollama
prompt: "Install Ollama?"
private: no
default: "yes"
- name: install_openwebui
prompt: "Install Open WebUI (Ollama frontend)?"
private: no
default: "yes"
- name: install_vscode
prompt: "Install Visual Studio Code?"
private: no
default: "yes"
- name: install_pgadmin
prompt: "Install pgAdmin Desktop?"
private: no
default: "yes"
- name: install_docker
prompt: "Install Docker?"
private: no
default: "yes"
- name: install_portainer
prompt: "Install Portainer (Docker GUI)?"
private: no
default: "yes"
vars:
user_home: "{{ lookup('env', 'HOME') }}"
pyenv_root: "{{ user_home }}/.pyenv"
nvm_dir: "{{ user_home }}/.nvm"
tasks:
- name: Update system and install base packages
apt:
name:
- build-essential
- curl
- git
- unzip
- zip
- software-properties-common
- apt-transport-https
- ca-certificates
- gnupg
- libssl-dev
- zlib1g-dev
- libbz2-dev
- libreadline-dev
- libsqlite3-dev
- llvm
- libncursesw5-dev
- xz-utils
- tk-dev
- libxml2-dev
- libxmlsec1-dev
- libffi-dev
- liblzma-dev
- python3-pip
update_cache: yes
state: present
- name: Install pyenv as non-root user
become: false
git:
repo: https://github.com/pyenv/pyenv.git
dest: "{{ pyenv_root }}"
- name: Configure pyenv in user's .bashrc
become: false
lineinfile:
path: ~/.bashrc
line: 'export PYENV_ROOT="{{ pyenv_root }}" && export PATH="$PYENV_ROOT/bin:$PATH" && eval "$(pyenv init --path)" && eval "$(pyenv init -)"'
create: yes
state: present
- name: Install Python 3.12.3 via pyenv as non-root user
become: false
shell: |
export PYENV_ROOT="{{ pyenv_root }}"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
pyenv install -s 3.12.3
pyenv global 3.12.3
args:
executable: /bin/bash
environment:
PYENV_ROOT: "{{ pyenv_root }}"
PATH: "{{ pyenv_root }}/bin:{{ ansible_env.PATH }}"
- name: Install pipx using pyenv Python (non-root)
become: false
shell: |
export PYENV_ROOT="{{ pyenv_root }}"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
pip3 install --user pipx
args:
executable: /bin/bash
- name: Install uv using pipx (non-root)
become: false
shell: |
export PATH="$HOME/.local/bin:$PATH"
pipx install uv --include-deps
args:
executable: /bin/bash
- name: Install NVM
become: false
shell: |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
args:
creates: "{{ nvm_dir }}"
- name: Add NVM to bashrc
become: false
lineinfile:
path: ~/.bashrc
line: 'export NVM_DIR="{{ nvm_dir }}" && [ -s "$NVM_DIR/nvm.sh" ] && \\. "$NVM_DIR/nvm.sh"'
create: yes
state: present
- name: Install latest LTS Node.js via NVM
become: false
shell: |
export NVM_DIR="{{ nvm_dir }}"
. "$NVM_DIR/nvm.sh"
nvm install --lts
args:
executable: /bin/bash
- name: Install Rust
when: install_rust | bool
become: false
shell: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.bashrc
args:
executable: /bin/bash
- name: Install Go
when: install_go | bool
shell: |
GO_VERSION=1.22.3
curl -LO https://golang.org/dl/go$GO_VERSION.linux-amd64.tar.gz
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go$GO_VERSION.linux-amd64.tar.gz
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
args:
executable: /bin/bash
- name: Install Docker
when: install_docker | bool
shell: |
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
args:
executable: /bin/bash
- name: Add current user to docker group
when: install_docker | bool
user:
name: "{{ ansible_user_id }}"
groups: docker
append: yes
- name: Enable Docker service
when: install_docker | bool
systemd:
name: docker
enabled: yes
state: started
- name: Install Portainer (Docker GUI)
when: install_portainer | bool
community.docker.docker_volume:
name: portainer_data
- name: Start Portainer container
when: install_portainer | bool
community.docker.docker_container:
name: portainer
image: portainer/portainer-ce:latest
state: started
restart_policy: always
published_ports:
- "8000:8000"
- "9443:9443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data
- name: Install Ollama
when: install_ollama | bool
shell: |
curl -fsSL https://ollama.com/install.sh | sh
args:
executable: /bin/bash
- name: Create Open WebUI data directory
when: install_openwebui | bool
file:
path: "{{ user_home }}/.open-webui"
state: directory
mode: '0755'
- name: Run Open WebUI container on port 3002
when: install_openwebui | bool
community.docker.docker_container:
name: open-webui
image: ghcr.io/open-webui/open-webui
state: started
restart_policy: unless-stopped
ports:
- "3002:3000"
volumes:
- "{{ user_home }}/.open-webui:/app/backend/data"
env:
OLLAMA_BASE_URL: http://localhost:11434
- name: Run PostgreSQL in Docker for Dev
community.docker.docker_container:
name: dev-postgres
image: postgres:16
state: started
restart_policy: unless-stopped
ports:
- "5432:5432"
env:
POSTGRES_PASSWORD: devpass
POSTGRES_USER: devuser
POSTGRES_DB: devdb
- name: Install Visual Studio Code
when: install_vscode | bool
apt:
deb: https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64
state: present
- name: Install pgAdmin 4 Desktop
when: install_pgadmin | bool
shell: |
curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | gpg --dearmor > /usr/share/keyrings/pgadmin-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/pgadmin-keyring.gpg] https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list
apt update
apt install -y pgadmin4-desktop
args:
executable: /bin/bash