mirror of
https://github.com/cole-maxwell1/todo-hetzner.git
synced 2026-10-27 19:02:49 -05:00
ops(ansible): prepare rootless app deployment
Create the application user's Ansible temporary directory and rely on the Quadlet install configuration for service enablement.
This commit is contained in:
@@ -8,6 +8,14 @@
|
|||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
app_user_uid: "{{ ansible_facts.getent_passwd[app_user][1] }}"
|
app_user_uid: "{{ ansible_facts.getent_passwd[app_user][1] }}"
|
||||||
|
|
||||||
|
- name: Create application user Ansible temporary directory
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "/home/{{ app_user }}/.ansible/tmp"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ app_user }}"
|
||||||
|
group: "{{ app_user }}"
|
||||||
|
mode: "0700"
|
||||||
|
|
||||||
- name: Create Quadlet directory
|
- name: Create Quadlet directory
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "/home/{{ app_user }}/.config/containers/systemd"
|
path: "/home/{{ app_user }}/.config/containers/systemd"
|
||||||
@@ -60,12 +68,3 @@
|
|||||||
environment:
|
environment:
|
||||||
XDG_RUNTIME_DIR: "/run/user/{{ app_user_uid }}"
|
XDG_RUNTIME_DIR: "/run/user/{{ app_user_uid }}"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: Enable application service without starting it
|
|
||||||
ansible.builtin.command:
|
|
||||||
argv: [systemctl, --user, enable, app-todo.service]
|
|
||||||
become_user: "{{ app_user }}"
|
|
||||||
environment:
|
|
||||||
XDG_RUNTIME_DIR: "/run/user/{{ app_user_uid }}"
|
|
||||||
register: app_enable
|
|
||||||
changed_when: "'Created symlink' in app_enable.stderr"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user