Files
staff-laptop/playbook.yml
Tobias Diekershoff 559a7d4917 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
2022-11-17 13:10:09 +01:00

82 lines
2.1 KiB
YAML

- name: Install packages
hosts: all
tasks:
- name: Stop packagekit
become: true
service:
name: packagekit
state: stopped
- name: Add third-party repository keys (non-ppa)
become: true
apt_key:
url: "{{ item.key_location }}"
state: present
loop: "{{ third_party_repos }}"
- name: Add third-party repositories (non-ppa)
become: true
apt_repository:
repo: "{{ item.repo }}"
state: present
filename: "{{ item.filename }}"
update_cache: true
loop: "{{ third_party_repos }}"
- name: Install packages from Debian
become: true
apt:
state: present
update_cache: true
pkg: "{{ pkgs_to_install }}"
- name: Download innernet binary
ansible.builtin.get_url:
url: https://git.fsfe.org/fsfe-system-hackers/innernet-playbook/raw/branch/master/roles/client/files/innernet.deb
dest: /tmp/innernet.deb
- name: Install innernet
become: true
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_env.USER }}/.local/share/gtimelog/tasks.txt"
- name: Remove unneeded packages
become: true
apt:
state: absent
update_cache: true
pkg: "{{ pkgs_to_uninstall }}"
- name: Remove useless packages from the cache
become: true
apt:
autoclean: true
- name: Remove dependencies that are no longer required
become: true
apt:
autoremove: true
- name: Update all packages to their latest version
become: true
apt:
name: "*"
state: latest
update_cache: true