104 lines
3.3 KiB
YAML
104 lines
3.3 KiB
YAML
---
|
|
- hosts: all
|
|
become: yes
|
|
|
|
tasks:
|
|
- name: Add NodeSource repository for Node.js 18.x
|
|
apt_key:
|
|
url: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key"
|
|
state: present
|
|
|
|
- name: Add NodeSource repo to sources list
|
|
apt_repository:
|
|
repo: "deb https://deb.nodesource.com/node_18.x {{ ansible_distribution_release }} main"
|
|
state: present
|
|
update_cache: yes
|
|
|
|
- name: Pin Node.js to the NodeSource repository
|
|
copy:
|
|
dest: /etc/apt/preferences.d/nodesource.pref
|
|
content: |
|
|
Package: nodejs
|
|
Pin: origin deb.nodesource.com
|
|
Pin-Priority: 1001
|
|
|
|
- name: Install Node.js v18
|
|
apt:
|
|
name: nodejs
|
|
state: present
|
|
|
|
- name: Install pnpm globally using npm
|
|
npm:
|
|
name: pnpm
|
|
global: yes
|
|
state: present
|
|
|
|
- name: Update apt cache and install Git, unclutter
|
|
apt:
|
|
name: "{{ item }}"
|
|
state: present
|
|
update_cache: yes
|
|
loop:
|
|
- git
|
|
- unclutter
|
|
|
|
- name: Clone Git repository
|
|
become: yes
|
|
become_user: "{{ ansible_user }}"
|
|
git:
|
|
repo: "https://git.thm.place/thm/parsifal.git"
|
|
dest: "/home/{{ ansible_user }}/parsifal"
|
|
version: "main"
|
|
|
|
- name: Create the systemd user directory if it doesn't exist
|
|
file:
|
|
path: "/home/{{ ansible_user }}/.config/systemd/user"
|
|
state: directory
|
|
owner: "{{ ansible_user }}"
|
|
mode: "0755"
|
|
|
|
- name: Symlink parsifal.service to systemd user directory
|
|
file:
|
|
src: "/home/{{ ansible_user }}/parsifal/parsifal.service"
|
|
dest: "/home/{{ ansible_user }}/.config/systemd/user/parsifal.service"
|
|
state: link
|
|
|
|
- name: Symlink unclutter.service to systemd user directory
|
|
file:
|
|
src: "/home/{{ ansible_user }}/parsifal/unclutter.service"
|
|
dest: "/home/{{ ansible_user }}/.config/systemd/user/unclutter.service"
|
|
state: link
|
|
|
|
- name: Symlink x11vnc.service to systemd user directory
|
|
file:
|
|
src: "/home/{{ ansible_user }}/parsifal/x11vnc.service"
|
|
dest: "/home/{{ ansible_user }}/.config/systemd/user/x11vnc.service"
|
|
state: link
|
|
|
|
- name: Reload systemd for the current user
|
|
command: systemctl --user daemon-reload
|
|
become: yes
|
|
become_user: "{{ ansible_user }}"
|
|
environment:
|
|
XDG_RUNTIME_DIR: "/run/user/{{ ansible_user_uid }}" # Needed for running systemctl --user
|
|
|
|
- name: Enable and start the Parsifal service
|
|
command: systemctl --user enable --now parsifal
|
|
become: yes
|
|
become_user: "{{ ansible_user }}"
|
|
environment:
|
|
XDG_RUNTIME_DIR: "/run/user/{{ ansible_user_uid }}" # Needed for running systemctl --user
|
|
|
|
- name: Enable and start the Unclutter service
|
|
command: systemctl --user enable --now unclutter
|
|
become: yes
|
|
become_user: "{{ ansible_user }}"
|
|
environment:
|
|
XDG_RUNTIME_DIR: "/run/user/{{ ansible_user_uid }}" # Needed for running systemctl --user
|
|
|
|
- name: Enable and start the x11vnc service
|
|
command: systemctl --user enable --now x11vnc
|
|
become: yes
|
|
become_user: "{{ ansible_user }}"
|
|
environment:
|
|
XDG_RUNTIME_DIR: "/run/user/{{ ansible_user_uid }}" # Needed for running systemctl --user
|