Skip to content

Commit

Permalink
Allow configuring local cache dir
Browse files Browse the repository at this point in the history
  • Loading branch information
NightTsarina committed Jan 5, 2025
1 parent ab3ec0b commit adffec8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions roles/tinc/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@ tinc__install_ferm_svc: false

# Command paths.
tinc__iproute2_path: /usr/bin/ip

# Local path to cache host configurations.
tinc__local_cache: fetch
3 changes: 2 additions & 1 deletion roles/tinc/tasks/remove.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

- name: Delete local configuration copy
ansible.builtin.file:
path: fetch/{{ tinc__netname }}/{{ inventory_hostname }}
path: |-
{{ tinc__local_cache }}/{{ tinc__netname }}/{{ inventory_hostname }}
state: absent
delegate_to: localhost
5 changes: 3 additions & 2 deletions roles/tinc/tasks/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@
- name: Fetch tinc hosts file after key creation
ansible.builtin.fetch:
src: /etc/tinc/{{ tinc__netname }}/hosts/{{ inventory_hostname }}
dest: fetch/{{ tinc__netname }}/{{ inventory_hostname }}
dest: |-
{{ tinc__local_cache }}/{{ tinc__netname }}/{{ inventory_hostname }}
flat: true

- name: Create tinc hosts file for hosts outside of ansible
Expand All @@ -131,7 +132,7 @@
- name: Sync the fetched tinc hosts files on each host
ansible.builtin.copy:
src: fetch/{{ tinc__netname }}/
src: '{{ tinc__local_cache }}/{{ tinc__netname }}/'
dest: /etc/tinc/{{ tinc__netname }}/hosts/
mode: '0644'
notify:
Expand Down

0 comments on commit adffec8

Please sign in to comment.