diff --git a/roles/element/defaults/main/main.yml b/roles/element/defaults/main/main.yml index 00dc292..6a9c92c 100644 --- a/roles/element/defaults/main/main.yml +++ b/roles/element/defaults/main/main.yml @@ -10,9 +10,9 @@ element_dist_path: "{{ element_source_path }}/dist" element_config_path: "{{ element_base_path }}/config" element_config_file: "{{ element_config_path }}/config.json" -element_host_uid: >- - {{ element_user_info is defined +element_host_uid: >-2 + {{ ((element_user_info is defined) and ('uid' in element_user_info)) | ternary(element_user_info.uid, element_user) }} -element_host_gid: >- - {{ element_user_info is defined +element_host_gid: >-2 + {{ ((element_user_info is defined) and ('uid' in element_user_info)) | ternary(element_user_info.group, element_user) }} diff --git a/roles/element/tasks/deploy-docker.yml b/roles/element/tasks/deploy-docker.yml index 79ffd05..d513dc4 100644 --- a/roles/element/tasks/deploy-docker.yml +++ b/roles/element/tasks/deploy-docker.yml @@ -23,7 +23,7 @@ image: "{{ element_container_image }}" state: "{{ (element_state == 'present') | ternary('started', 'absent') }}" env: "{{ element_container_env | default(omit) }}" - user: "{{ element_container_user }}" + user: "{{ element_container_user | default(omit) }}" ports: "{{ element_container_ports | default(omit) }}" labels: "{{ element_container_labels | default(omit) }}" volumes: "{{ element_container_full_volumes }}" diff --git a/roles/element/tasks/deploy-podman.yml b/roles/element/tasks/deploy-podman.yml index 07c9c48..7d05d53 100644 --- a/roles/element/tasks/deploy-podman.yml +++ b/roles/element/tasks/deploy-podman.yml @@ -12,7 +12,7 @@ image: "{{ element_container_image }}" state: "{{ (element_state == 'present') | ternary('started', 'absent') }}" env: "{{ element_container_env | default(omit) }}" - user: "{{ element_container_user }}" + user: "{{ element_container_user | default(omit) }}" ports: "{{ element_container_ports | default(omit) }}" labels: "{{ element_container_labels | default(omit) }}" volumes: "{{ element_container_full_volumes }}"