From 84aa5a99e4426e4e24031187f727af92ef540562 Mon Sep 17 00:00:00 2001 From: nicoo Date: Wed, 15 Nov 2017 00:51:17 +0100 Subject: [PATCH] ansible/roles/base: Set XDG_RUNTIME_DIR as required by systemd --- ansible/roles/base/files/xdg_runtime_dir.sh | 4 ++++ ansible/roles/base/tasks/main.yaml | 15 ++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 ansible/roles/base/files/xdg_runtime_dir.sh 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 -- 1.7.10.4