add restic

- fix packages that were broken
- change the way configuration is done
  - define default facts for packages with os_family level vars
  - refine the default facts into an os_family specfic config
This commit is contained in:
2026-04-18 18:44:18 -06:00
parent 61c6e800ad
commit 01239701f9
6 changed files with 68 additions and 7 deletions

View File

@@ -5,9 +5,25 @@
files: "{{ pkg.files | default([]) }}" files: "{{ pkg.files | default([]) }}"
ansible.builtin.include_tasks: helpers/clean_install.yml ansible.builtin.include_tasks: helpers/clean_install.yml
- name: Install go package using system go
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
when:
- go_imethod == 'system'
environment:
GOBIN: "{{ path_bin }}"
ansible.builtin.command:
creates: "{{ pkg.bin }}"
argv:
- go
- install
- "{{ pkg.url }}"
- name: Install go package "{{ pkg.url }}" - name: Install go package "{{ pkg.url }}"
become: "{{ install_become }}" become: "{{ install_become }}"
become_user: "{{ install_become_user }}" become_user: "{{ install_become_user }}"
when:
- go_imethod != 'system'
environment: environment:
GOBIN: "{{ path_bin }}" GOBIN: "{{ path_bin }}"
GOROOT: "{{ path_go }}" GOROOT: "{{ path_go }}"

View File

@@ -1,8 +1,5 @@
# vim: set filetype=yaml.ansible : # vim: set filetype=yaml.ansible :
--- ---
- name: Dump npm pkg
ansible.builtin.debug:
var: pkg
- name: Install npm - name: Install npm
become: "{{ install_become }}" become: "{{ install_become }}"
become_user: "{{ install_become_user }}" become_user: "{{ install_become_user }}"

View File

@@ -66,10 +66,6 @@
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: "pkgs/{{ pkg }}.yml" file: "pkgs/{{ pkg }}.yml"
- name: Dump pkg_sys
debug:
var: pkg_sys
- name: Install pkg_sys list using system package manager - name: Install pkg_sys list using system package manager
when: when:
- pkg_sys|length > 0 - pkg_sys|length > 0

View File

@@ -13,6 +13,8 @@
- source - source
go_pkg: github.com/cheat/cheat/cmd/cheat go_pkg: github.com/cheat/cheat/cmd/cheat
version: latest version: latest
pkg_deps:
- go
# }}} # }}}
- name: Configure cheat - name: Configure cheat
when: when:
@@ -28,6 +30,12 @@
when: when:
- cheat_imethod == 'source' - cheat_imethod == 'source'
block: block:
- name: Queue package dependencies
loop: "{{ cheat.pkg_deps }}"
loop_control:
loop_var: dep
ansible.builtin.include_tasks: pkgs/{{ dep }}.yml
- name: Configure cheat go install - name: Configure cheat go install
ansible.builtin.set_fact: ansible.builtin.set_fact:
cheat_go_install: cheat_go_install:

View File

@@ -78,6 +78,7 @@
- name: Go system package install - name: Go system package install
ansible.builtin.set_fact: ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + [go_pkgname] }}" pkg_sys: "{{ pkg_sys + [go_pkgname] }}"
go_install: "{{ go_imethod }}={{ go_pkgname }}"
- name: Configure go archive installation - name: Configure go archive installation
when: when:

View File

@@ -0,0 +1,43 @@
# vim: set filetype=yaml.ansible :
#
## Package: restic
## Description: backup with builtin encryption and compression
## Version: system
## Methods: system
## Helpers: -
---
- name: Set restic default facts # {{{
ansible.builtin.set_fact:
restic:
methods:
default: [system]
pkgname:
default: restic
- name: Finalise restic default facts
ansible.builtin.set_fact:
restic:
methods: "{{ restic.methods[os_family] | default(restic.methods.default) }}"
pkgname: "{{ restic.pkgname[os_family] | default(restic.pkgname.default) }}"
# }}}
- name: Configure restic
when:
- "'restic' not in __configured"
block:
- name: Set restic install method
when:
- restic_imethod is undefined
ansible.builtin.set_fact:
restic_imethod: "{{ imethod if imethod in restic.methods else restic.methods[0] }}"
- name: Configure restic system install
when:
- restic_imethod == 'system'
block:
- name: Queue restic system install
ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + [restic.pkgname] }}"
restic_install: "{{ restic_imethod }}={{ restic.pkgname }}"
- name: Finalise restic configuration
ansible.builtin.set_fact:
__configured: "{{ __configured | combine( { 'restic': restic_install } ) }}"