parsifal/setup-autocall.yml

105 lines
3.3 KiB
YAML
Raw Normal View History

2024-09-18 22:53:33 +02:00
---
- 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
2024-09-18 22:59:26 +02:00
- name: Update apt cache and install Git, unclutter
2024-09-18 22:53:33 +02:00
apt:
2024-09-18 22:59:26 +02:00
name: "{{ item }}"
2024-09-18 22:53:33 +02:00
state: present
update_cache: yes
2024-09-18 22:59:26 +02:00
loop:
- git
- unclutter
2024-09-18 22:53:33 +02:00
- 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
2024-09-18 22:57:02 +02:00
- 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
2024-09-18 23:15:46 +02:00
- 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
2024-09-18 22:53:33 +02:00
- 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
2024-09-18 22:57:02 +02:00
- name: Enable and start the Parsifal service
2024-09-18 22:53:33 +02:00
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
2024-09-18 22:57:02 +02:00
- 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
2024-09-18 23:15:46 +02:00
- 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