5818b05d96
- Add user management and Oh My Zsh settings - Update service scripts to use Zsh - Include new packages and environment variables - Modify Terraform configuration for upstream services
340 lines
14 KiB
YAML
340 lines
14 KiB
YAML
---
|
|
- name: Ensure tool packages list is valid
|
|
ansible.builtin.assert:
|
|
that:
|
|
- linux_dev_station_tool_packages is iterable
|
|
fail_msg: "linux_dev_station_tool_packages must be a list of tool definitions."
|
|
|
|
- name: Download uv installer
|
|
become: true
|
|
ansible.builtin.get_url:
|
|
url: https://astral.sh/uv/install.sh
|
|
dest: "{{ linux_dev_station_service_home }}/.cache/uv-install.sh"
|
|
owner: "{{ linux_dev_station_service_user }}"
|
|
group: "{{ linux_dev_station_service_user }}"
|
|
mode: "0755"
|
|
when:
|
|
- linux_dev_station_service_user_enabled | bool
|
|
- linux_dev_station_tool_packages | selectattr('name', 'equalto', 'uv') | list | length > 0
|
|
|
|
- name: Install uv
|
|
become: true
|
|
become_user: "{{ linux_dev_station_service_user }}"
|
|
ansible.builtin.command: >-
|
|
/bin/sh {{ linux_dev_station_service_home }}/.cache/uv-install.sh
|
|
args:
|
|
creates: "{{ linux_dev_station_service_home }}/.local/bin/uv"
|
|
environment:
|
|
HOME: "{{ linux_dev_station_service_home }}"
|
|
USER: "{{ linux_dev_station_service_user }}"
|
|
PATH: "{{ linux_dev_station_path }}"
|
|
UV_UNINSTALL_MISSING_PACKAGES: "1"
|
|
when:
|
|
- linux_dev_station_service_user_enabled | bool
|
|
- linux_dev_station_tool_packages | selectattr('name', 'equalto', 'uv') | list | length > 0
|
|
|
|
- name: Download rustup installer
|
|
become: true
|
|
ansible.builtin.get_url:
|
|
url: https://sh.rustup.rs
|
|
dest: "{{ linux_dev_station_service_home }}/.cache/rustup-install.sh"
|
|
owner: "{{ linux_dev_station_service_user }}"
|
|
group: "{{ linux_dev_station_service_user }}"
|
|
mode: "0755"
|
|
when:
|
|
- linux_dev_station_service_user_enabled | bool
|
|
- linux_dev_station_tool_packages | selectattr('name', 'equalto', 'rust') | list | length > 0
|
|
|
|
- name: Install rustup
|
|
become: true
|
|
become_user: "{{ linux_dev_station_service_user }}"
|
|
ansible.builtin.command: >-
|
|
/bin/sh {{ linux_dev_station_service_home }}/.cache/rustup-install.sh -y --default-toolchain stable
|
|
args:
|
|
creates: "{{ linux_dev_station_service_home }}/.cargo/bin/rustc"
|
|
environment:
|
|
HOME: "{{ linux_dev_station_service_home }}"
|
|
USER: "{{ linux_dev_station_service_user }}"
|
|
PATH: "{{ linux_dev_station_path }}:{{ linux_dev_station_service_home }}/.cargo/bin"
|
|
when:
|
|
- linux_dev_station_service_user_enabled | bool
|
|
- linux_dev_station_tool_packages | selectattr('name', 'equalto', 'rust') | list | length > 0
|
|
|
|
- name: Download fnm (Fast Node Manager) binary
|
|
become: true
|
|
ansible.builtin.get_url:
|
|
url: "https://github.com/Schniz/fnm/releases/download/{{ fnm_version }}/fnm-linux.zip"
|
|
dest: "{{ linux_dev_station_service_home }}/.cache/fnm.zip"
|
|
owner: "{{ linux_dev_station_service_user }}"
|
|
group: "{{ linux_dev_station_service_user }}"
|
|
mode: "0644"
|
|
vars:
|
|
fnm_version: v1.38.1
|
|
when:
|
|
- linux_dev_station_service_user_enabled | bool
|
|
- linux_dev_station_tool_packages | selectattr('name', 'equalto', 'node') | list | length > 0
|
|
|
|
- name: Create .fnm directory
|
|
become: true
|
|
become_user: "{{ linux_dev_station_service_user }}"
|
|
ansible.builtin.file:
|
|
path: "{{ linux_dev_station_service_home }}/.fnm"
|
|
state: directory
|
|
owner: "{{ linux_dev_station_service_user }}"
|
|
group: "{{ linux_dev_station_service_user }}"
|
|
mode: "0755"
|
|
when:
|
|
- linux_dev_station_service_user_enabled | bool
|
|
- linux_dev_station_tool_packages | selectattr('name', 'equalto', 'node') | list | length > 0
|
|
|
|
- name: Extract fnm to .fnm directory
|
|
become: true
|
|
become_user: "{{ linux_dev_station_service_user }}"
|
|
ansible.builtin.unarchive:
|
|
src: "{{ linux_dev_station_service_home }}/.cache/fnm.zip"
|
|
dest: "{{ linux_dev_station_service_home }}/.fnm"
|
|
remote_src: true
|
|
when:
|
|
- linux_dev_station_service_user_enabled | bool
|
|
- linux_dev_station_tool_packages | selectattr('name', 'equalto', 'node') | list | length > 0
|
|
|
|
- name: Ensure fnm binary is executable
|
|
become: true
|
|
ansible.builtin.file:
|
|
path: "{{ linux_dev_station_service_home }}/.fnm/fnm"
|
|
mode: "0755"
|
|
owner: "{{ linux_dev_station_service_user }}"
|
|
group: "{{ linux_dev_station_service_user }}"
|
|
when:
|
|
- linux_dev_station_service_user_enabled | bool
|
|
- linux_dev_station_tool_packages | selectattr('name', 'equalto', 'node') | list | length > 0
|
|
|
|
- name: Install LTS Node.js version via fnm
|
|
become: true
|
|
become_user: "{{ linux_dev_station_service_user }}"
|
|
ansible.builtin.command: >-
|
|
{{ linux_dev_station_service_home }}/.fnm/fnm install --lts
|
|
args:
|
|
creates: "{{ linux_dev_station_service_home }}/.fnm/node-versions"
|
|
environment:
|
|
HOME: "{{ linux_dev_station_service_home }}"
|
|
USER: "{{ linux_dev_station_service_user }}"
|
|
PATH: "{{ linux_dev_station_path }}:{{ linux_dev_station_service_home }}/.fnm"
|
|
FNM_DIR: "{{ linux_dev_station_service_home }}/.fnm"
|
|
when:
|
|
- linux_dev_station_service_user_enabled | bool
|
|
- linux_dev_station_tool_packages | selectattr('name', 'equalto', 'node') | list | length > 0
|
|
|
|
- name: Get installed Node.js version from fnm node-versions directory
|
|
become: true
|
|
become_user: "{{ linux_dev_station_service_user }}"
|
|
ansible.builtin.command: ls "{{ linux_dev_station_service_home }}/.fnm/node-versions"
|
|
register: fnm_versions_list
|
|
changed_when: false
|
|
environment:
|
|
FNM_DIR: "{{ linux_dev_station_service_home }}/.fnm"
|
|
when:
|
|
- linux_dev_station_service_user_enabled | bool
|
|
- linux_dev_station_tool_packages | selectattr('name', 'equalto', 'node') | list | length > 0
|
|
|
|
- name: Set default Node.js version via fnm
|
|
become: true
|
|
become_user: "{{ linux_dev_station_service_user }}"
|
|
ansible.builtin.command: >-
|
|
{{ linux_dev_station_service_home }}/.fnm/fnm default {{ node_version }}
|
|
register: linux_dev_station_fnm_default_result
|
|
changed_when: "'default' in linux_dev_station_fnm_default_result.stderr or 'default' in linux_dev_station_fnm_default_result.stdout"
|
|
environment:
|
|
HOME: "{{ linux_dev_station_service_home }}"
|
|
USER: "{{ linux_dev_station_service_user }}"
|
|
PATH: "{{ linux_dev_station_path }}:{{ linux_dev_station_service_home }}/.fnm"
|
|
FNM_DIR: "{{ linux_dev_station_service_home }}/.fnm"
|
|
when:
|
|
- linux_dev_station_service_user_enabled | bool
|
|
- linux_dev_station_tool_packages | selectattr('name', 'equalto', 'node') | list | length > 0
|
|
- fnm_versions_list is defined
|
|
- fnm_versions_list.stdout | trim | length > 0
|
|
vars:
|
|
node_version: "{{ fnm_versions_list.stdout | trim }}"
|
|
|
|
- name: Download code-server tarball
|
|
become: true
|
|
ansible.builtin.get_url:
|
|
url: "https://github.com/coder/code-server/releases/download/v{{ tool.version }}/code-server-{{ tool.version }}-linux-amd64.tar.gz"
|
|
dest: "{{ linux_dev_station_service_home }}/.cache/code-server.tar.gz"
|
|
owner: "{{ linux_dev_station_service_user }}"
|
|
group: "{{ linux_dev_station_service_user }}"
|
|
mode: "0644"
|
|
vars:
|
|
tool: "{{ linux_dev_station_tool_packages | selectattr('name', 'equalto', 'code-server') | first }}"
|
|
when:
|
|
- linux_dev_station_service_user_enabled | bool
|
|
- linux_dev_station_tool_packages | selectattr('name', 'equalto', 'code-server') | list | length > 0
|
|
|
|
- name: Create code-server installation directories
|
|
become: true
|
|
become_user: "{{ linux_dev_station_service_user }}"
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
mode: "0755"
|
|
loop:
|
|
- "{{ linux_dev_station_service_home }}/.local/lib"
|
|
- "{{ linux_dev_station_service_home }}/.local/bin"
|
|
when:
|
|
- linux_dev_station_service_user_enabled | bool
|
|
- linux_dev_station_tool_packages | selectattr('name', 'equalto', 'code-server') | list | length > 0
|
|
|
|
- name: Extract code-server tarball to lib directory
|
|
become: true
|
|
become_user: "{{ linux_dev_station_service_user }}"
|
|
ansible.builtin.unarchive:
|
|
src: "{{ linux_dev_station_service_home }}/.cache/code-server.tar.gz"
|
|
dest: "{{ linux_dev_station_service_home }}/.local/lib"
|
|
remote_src: true
|
|
environment:
|
|
HOME: "{{ linux_dev_station_service_home }}"
|
|
USER: "{{ linux_dev_station_service_user }}"
|
|
when:
|
|
- linux_dev_station_service_user_enabled | bool
|
|
- linux_dev_station_tool_packages | selectattr('name', 'equalto', 'code-server') | list | length > 0
|
|
|
|
- name: Create symlink for code-server binary
|
|
become: true
|
|
become_user: "{{ linux_dev_station_service_user }}"
|
|
ansible.builtin.file:
|
|
src: "{{ linux_dev_station_service_home }}/.local/lib/code-server-{{ tool.version }}-linux-amd64/bin/code-server"
|
|
dest: "{{ linux_dev_station_service_home }}/.local/bin/code-server"
|
|
state: link
|
|
vars:
|
|
tool: "{{ linux_dev_station_tool_packages | selectattr('name', 'equalto', 'code-server') | first }}"
|
|
when:
|
|
- linux_dev_station_service_user_enabled | bool
|
|
- linux_dev_station_tool_packages | selectattr('name', 'equalto', 'code-server') | list | length > 0
|
|
|
|
- name: Create opencode installation directories
|
|
become: true
|
|
become_user: "{{ linux_dev_station_service_user }}"
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
mode: "0755"
|
|
loop:
|
|
- "{{ linux_dev_station_service_home }}/.local/lib"
|
|
- "{{ linux_dev_station_service_home }}/.local/lib/opencode-{{ tool.version }}"
|
|
- "{{ linux_dev_station_service_home }}/.local/bin"
|
|
vars:
|
|
tool: "{{ linux_dev_station_tool_packages | selectattr('name', 'equalto', 'opencode') | first }}"
|
|
when:
|
|
- linux_dev_station_service_user_enabled | bool
|
|
- linux_dev_station_tool_packages | selectattr('name', 'equalto', 'opencode') | list | length > 0
|
|
|
|
- name: Download opencode tarball
|
|
become: true
|
|
ansible.builtin.get_url:
|
|
url: "https://github.com/anomalyco/opencode/releases/download/v{{ tool.version }}/opencode-linux-x64.tar.gz"
|
|
dest: "{{ linux_dev_station_service_home }}/.cache/opencode-{{ tool.version }}.tar.gz"
|
|
owner: "{{ linux_dev_station_service_user }}"
|
|
group: "{{ linux_dev_station_service_user }}"
|
|
mode: "0644"
|
|
vars:
|
|
tool: "{{ linux_dev_station_tool_packages | selectattr('name', 'equalto', 'opencode') | first }}"
|
|
when:
|
|
- linux_dev_station_service_user_enabled | bool
|
|
- linux_dev_station_tool_packages | selectattr('name', 'equalto', 'opencode') | list | length > 0
|
|
|
|
- name: Extract opencode tarball to versioned directory
|
|
become: true
|
|
become_user: "{{ linux_dev_station_service_user }}"
|
|
ansible.builtin.unarchive:
|
|
src: "{{ linux_dev_station_service_home }}/.cache/opencode-{{ tool.version }}.tar.gz"
|
|
dest: "{{ linux_dev_station_service_home }}/.local/lib/opencode-{{ tool.version }}"
|
|
remote_src: true
|
|
vars:
|
|
tool: "{{ linux_dev_station_tool_packages | selectattr('name', 'equalto', 'opencode') | first }}"
|
|
when:
|
|
- linux_dev_station_service_user_enabled | bool
|
|
- linux_dev_station_tool_packages | selectattr('name', 'equalto', 'opencode') | list | length > 0
|
|
|
|
- name: Create symlink for opencode binary
|
|
become: true
|
|
become_user: "{{ linux_dev_station_service_user }}"
|
|
ansible.builtin.file:
|
|
src: "{{ linux_dev_station_service_home }}/.local/lib/opencode-{{ tool.version }}/opencode"
|
|
dest: "{{ linux_dev_station_service_home }}/.local/bin/opencode"
|
|
state: link
|
|
vars:
|
|
tool: "{{ linux_dev_station_tool_packages | selectattr('name', 'equalto', 'opencode') | first }}"
|
|
when:
|
|
- linux_dev_station_service_user_enabled | bool
|
|
- linux_dev_station_tool_packages | selectattr('name', 'equalto', 'opencode') | list | length > 0
|
|
|
|
- name: Download sectool zip
|
|
become: true
|
|
ansible.builtin.get_url:
|
|
url: "https://github.com/a13labs/sectool/releases/download/v{{ tool.version }}/sectool-v{{ tool.version }}-linux-x64.zip"
|
|
dest: "{{ linux_dev_station_service_home }}/.cache/sectool-{{ tool.version }}.zip"
|
|
owner: "{{ linux_dev_station_service_user }}"
|
|
group: "{{ linux_dev_station_service_user }}"
|
|
mode: "0644"
|
|
vars:
|
|
tool: "{{ linux_dev_station_tool_packages | selectattr('name', 'equalto', 'sectool') | first }}"
|
|
when:
|
|
- linux_dev_station_service_user_enabled | bool
|
|
- linux_dev_station_tool_packages | selectattr('name', 'equalto', 'sectool') | list | length > 0
|
|
|
|
- name: Create sectool installation directories
|
|
become: true
|
|
become_user: "{{ linux_dev_station_service_user }}"
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
mode: "0755"
|
|
loop:
|
|
- "{{ linux_dev_station_service_home }}/.local/lib/sectool-{{ tool.version }}"
|
|
- "{{ linux_dev_station_service_home }}/.local/bin"
|
|
vars:
|
|
tool: "{{ linux_dev_station_tool_packages | selectattr('name', 'equalto', 'sectool') | first }}"
|
|
when:
|
|
- linux_dev_station_service_user_enabled | bool
|
|
- linux_dev_station_tool_packages | selectattr('name', 'equalto', 'sectool') | list | length > 0
|
|
|
|
- name: Extract sectool zip to versioned directory
|
|
become: true
|
|
become_user: "{{ linux_dev_station_service_user }}"
|
|
ansible.builtin.unarchive:
|
|
src: "{{ linux_dev_station_service_home }}/.cache/sectool-{{ tool.version }}.zip"
|
|
dest: "{{ linux_dev_station_service_home }}/.local/lib/sectool-{{ tool.version }}"
|
|
remote_src: true
|
|
vars:
|
|
tool: "{{ linux_dev_station_tool_packages | selectattr('name', 'equalto', 'sectool') | first }}"
|
|
when:
|
|
- linux_dev_station_service_user_enabled | bool
|
|
- linux_dev_station_tool_packages | selectattr('name', 'equalto', 'sectool') | list | length > 0
|
|
|
|
- name: Ensure sectool binary is executable
|
|
become: true
|
|
ansible.builtin.file:
|
|
path: "{{ linux_dev_station_service_home }}/.local/lib/sectool-{{ tool.version }}/sectool"
|
|
mode: "0755"
|
|
owner: "{{ linux_dev_station_service_user }}"
|
|
group: "{{ linux_dev_station_service_user }}"
|
|
vars:
|
|
tool: "{{ linux_dev_station_tool_packages | selectattr('name', 'equalto', 'sectool') | first }}"
|
|
when:
|
|
- linux_dev_station_service_user_enabled | bool
|
|
- linux_dev_station_tool_packages | selectattr('name', 'equalto', 'sectool') | list | length > 0
|
|
|
|
- name: Create symlink for sectool binary
|
|
become: true
|
|
become_user: "{{ linux_dev_station_service_user }}"
|
|
ansible.builtin.file:
|
|
src: "{{ linux_dev_station_service_home }}/.local/lib/sectool-{{ tool.version }}/sectool"
|
|
dest: "{{ linux_dev_station_service_home }}/.local/bin/sectool"
|
|
state: link
|
|
vars:
|
|
tool: "{{ linux_dev_station_tool_packages | selectattr('name', 'equalto', 'sectool') | first }}"
|
|
when:
|
|
- linux_dev_station_service_user_enabled | bool
|
|
- linux_dev_station_tool_packages | selectattr('name', 'equalto', 'sectool') | list | length > 0
|