From 559a7d491718dc619d955f82f234b12323dfd5c3 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Thu, 17 Nov 2022 13:10:09 +0100 Subject: [PATCH] fix failing download tasks.txt for gtimelog * The download task failed, as the config directory was not created before, so a check for the directory was added to the playbook. If the check fails, the directory will be created for the user. * The `ansible_env.USER` variable was used, as `ansible_user` was not available on the Debian 11 testing system. * The initial `become: true` has been removed, as this was chaning the `USER` environment to `root` so that the user could not use the downloaded file checked that this is running fine on a fresh install of Debian 11 in a VM. fixes #1 --- playbook.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/playbook.yml b/playbook.yml index 457b30c..79d6640 100644 --- a/playbook.yml +++ b/playbook.yml @@ -1,6 +1,5 @@ - name: Install packages hosts: all - become: true tasks: - name: Stop packagekit become: true @@ -41,11 +40,21 @@ ansible.builtin.apt: deb: /tmp/innernet.deb + - name: Check gtimelog directory is existing + become: false + file: + owner: "{{ ansible_env.USER }}" + group: "{{ ansible_env.USER }}" + path: "/home/{{ ansible_env.USER }}/.local/share/gtimelog/" + state: directory + mode: "755" + - name: Download tasks.txt for gtimelog tags: gtimelog + become: false ansible.builtin.get_url: url: https://git.fsfe.org/fsfe-system-hackers/staff-laptop/raw/branch/master/gtimelog/tasks.txt - dest: "/home/{{ ansible_user }}/.local/share/gtimelog/tasks.txt" + dest: "/home/{{ ansible_env.USER }}/.local/share/gtimelog/tasks.txt" - name: Remove unneeded packages become: true