support per-item ownership/mode overrides in app_subdirectories; fix dir mode default

This commit is contained in:
2026-07-16 23:28:25 -04:00
parent f273bb0390
commit 9d59101fbe
2 changed files with 13 additions and 6 deletions
+2 -1
View File
@@ -2,7 +2,8 @@
app_dir: "{{ host_root_path }}/{{ app_name }}" app_dir: "{{ host_root_path }}/{{ app_name }}"
app_uid: "{{ ansible_facts.user_uid }}" app_uid: "{{ ansible_facts.user_uid }}"
app_gid: "{{ ansible_facts.user_gid }}" app_gid: "{{ ansible_facts.user_gid }}"
app_permission_mode: "0640" app_permission_mode: "0640" # files (compose.yml, rendered templates)
app_dir_mode: "0755" # directories (app_dir and app_subdirectories)
app_restart_policy: unless-stopped app_restart_policy: unless-stopped
app_backup_path: "{{ backup_path }}/{{ app_name }}" app_backup_path: "{{ backup_path }}/{{ app_name }}"
+11 -5
View File
@@ -72,15 +72,21 @@
state: directory state: directory
owner: "{{ app_uid }}" owner: "{{ app_uid }}"
group: "{{ app_gid }}" group: "{{ app_gid }}"
mode: "{{ app_permission_mode }}" mode: "{{ app_dir_mode }}"
# Items may be plain path strings, or dicts with per-item overrides:
# - /some/path # uses app_uid/app_gid/app_dir_mode
# - path: /some/path # same
# owner: 999 # per-item overrides for containers
# group: 999 # that expect a specific uid/gid
# mode: "0700"
- name: Create application subdirectories - name: Create application subdirectories
ansible.builtin.file: ansible.builtin.file:
path: "{{ item }}" path: "{{ item.path | default(item) }}"
state: directory state: directory
owner: "{{ app_uid }}" owner: "{{ item.owner | default(app_uid) }}"
group: "{{ app_gid }}" group: "{{ item.group | default(app_gid) }}"
mode: "{{ app_permission_mode }}" mode: "{{ item.mode | default(app_dir_mode) }}"
loop: "{{ app_subdirectories }}" loop: "{{ app_subdirectories }}"
tags: [setup, deploy] tags: [setup, deploy]