Compare commits

...

2 commits

Author SHA1 Message Date
7dafc80dbe add unclutter 2024-09-18 22:57:02 +02:00
5f192240f2 add ansible 2024-09-18 22:53:33 +02:00
3 changed files with 105 additions and 0 deletions

7
inventory.yml Normal file
View file

@ -0,0 +1,7 @@
all:
hosts:
x2305:
ansible_host: 192.168.10.66
ansible_user: x2305
ansible_become_pass: "x2305"
ansible_become: true

88
setup-autocall.yml Normal file
View file

@ -0,0 +1,88 @@
---
- 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
apt:
name: git
state: present
update_cache: yes
- 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: 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

10
unclutter.service Normal file
View file

@ -0,0 +1,10 @@
[Unit]
Description=Unclutter
After=graphical.target
[Service]
ExecStart=/usr/bin/unclutter -idle 1 -root
Restart=always
[Install]
WantedBy=default.target