From: nicoo Date: Tue, 14 Nov 2017 23:51:17 +0000 (+0100) Subject: ansible/roles/base: Set XDG_RUNTIME_DIR as required by systemd X-Git-Url: https://git.realraum.at/?a=commitdiff_plain;h=84aa5a99e4426e4e24031187f727af92ef540562;hp=01f62a252f9a86729bacefb9c6fd2fd7675a2694;p=noc.git ansible/roles/base: Set XDG_RUNTIME_DIR as required by systemd --- diff --git a/ansible/roles/base/files/xdg_runtime_dir.sh b/ansible/roles/base/files/xdg_runtime_dir.sh new file mode 100644 index 0000000..d2428b1 --- /dev/null +++ b/ansible/roles/base/files/xdg_runtime_dir.sh @@ -0,0 +1,4 @@ +# Set XDG_RUNTIME_DIR correctly +if [ "$UID" -ne 0 ] && [ -z "${XDG_RUNTIME_DIR}" ]; then + export XDG_RUNTIME_DIR="/run/user/$(id -u)" +fi diff --git a/ansible/roles/base/tasks/main.yaml b/ansible/roles/base/tasks/main.yaml index c0d4ffd..7f60b4e 100644 --- a/ansible/roles/base/tasks/main.yaml +++ b/ansible/roles/base/tasks/main.yaml @@ -54,11 +54,16 @@ - zsh - python-apt -- name: install systemd specific packages - apt: name={{ item }} state=present - with_items: - - dbus - - libpam-systemd +- block: + - name: install systemd specific packages + apt: name={{ item }} state=present + with_items: + - dbus + - libpam-systemd + + - name: set systemd-related environment variables + copy: src=xdg_runtime_dir.sh dest=/etc/profile.d/xdg_runtime_dir.sh mode=0644 + when: ansible_service_mgr == "systemd" - name: install zshrc