Skip to content

Commit 9b43cd6

Browse files
authored
Merge pull request #21 from Zuehlke/feature/add-download-cache
Add download cache directory
2 parents b34e592 + 6e853f0 commit 9b43cd6

5 files changed

Lines changed: 23 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Other tweaks and settings worth mentioning:
3535
* sets up `~/.bashrc.d` directory to ease management of bash initialization (e.g. for setting env vars)
3636
* adds a Git `PS1` shell prompt and configures some useful aliases and settings in `~/.gitconfig`
3737
* symlinks [`update-vm.sh`](scripts/update-vm.sh) to `/usr/local/bin/update-vm` so it's in the `$PATH` and can be used for updating the VM from the inside (see below)
38+
* adds `/var/cache/downloads` as a cache directory for downloaded installer files
3839

3940

4041
## Usage

roles/cache/tasks/main.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
3+
- name: Add systemd-tmpfiles configuration for {{ download_cache_dir }}
4+
copy:
5+
content: |
6+
# See tmpfiles.d(5) for details
7+
8+
# Create a download cache directory without automatic deletion
9+
d {{ download_cache_dir }} 1777 root root -
10+
dest: /etc/tmpfiles.d/downloads.conf
11+
mode: 0644
12+
13+
- name: Ensure {{ download_cache_dir }} is created
14+
command:
15+
cmd: systemd-tmpfiles --create
16+
creates: "{{ download_cache_dir }}"

roles/cache/vars/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
download_cache_dir: /var/cache/downloads

site.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
- { role: ansible-lint, tags: "ansible-lint" }
1414
- { role: testinfra, tags: "testinfra" }
1515
- { role: bashrc_d, tags: "bashrc_d" }
16+
- { role: cache, tags: "cache" }
1617
- { role: git, tags: "git" }
1718
- { role: vscode, tags: "vscode" }

spec/test_cache.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
def test_download_cache_directory_exists_(host):
3+
assert host.file('/var/cache/downloads').is_directory

0 commit comments

Comments
 (0)