--- - name: Enable systemd user mode ansible.builtin.command: cmd: "loginctl enable-linger {{ tomcat_instance_name }}" changed_when: False - name: Set systemd conf var ansible.builtin.lineinfile: dest: "{{ tomcat_instance_root }}/{{ tomcat_instance_name }}/.profile" state: present owner: "{{ tomcat_instance_name }}" group: "{{ tomcat_instance_name }}" mode: "0640" create: yes line: 'export XDG_RUNTIME_DIR=/run/user/$UID'