fixing obvious errors

This commit is contained in:
Matthew Stobbs
2026-02-06 01:28:14 -07:00
parent e91e7e9698
commit b87fc8235e
10 changed files with 149 additions and 181 deletions

View File

@@ -45,7 +45,7 @@ When adding default configuration, it MUST match the following:
- Prefix the configuration with the name of the package, using snake case
- Example: `alacritty_version: v0.16.1`
- This keeps the configuration unique per package, and allows for the defaults
to be over-ridden where needed.
to be overridden where needed.
The things that should be in the default configuration, if relevant, are:
@@ -127,6 +127,15 @@ in place (usually in `<install_prefix>/bin`).
remote:
name: <remote name>
url: <flatpakrepo url>
method: <optional, either 'system' or 'user'
method: <optional. Default 'system'>
```
- `pkg_flatpak` is a list of dicts describing how to install a flatpak
- Managed using `community.general.flatpak` ansible module.
- Format is:
```yaml
flatpak:
name: <flatpak name>
remote: <remote to install from>
method: <optional. Default 'system'>
state: <optional. Default 'present'>
```
- `pkg_flatpak` is a list of dicts

View File

@@ -1,33 +1,29 @@
# vim: set filetype=yaml.ansible :
---
- name: Install appimage {{ pkg }}
- name: Install appimages
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
block:
- name: Ensure appimage path exists
ansible.builtin.file:
path: "{{ path_appimage }}/{{ pkg.name }}"
mode: "{{ pkg.mode | default('0755') }}"
owner: "{{ pkg.owner | default(ansible_user_id) }}"
group: "{{ pkg.group | default(ansible_user_gid) }}"
path: "{{ path_appimage }}/{{ appimage.name }}"
mode: "{{ appimage.mode | default('0755') }}"
owner: "{{ appimage.owner | default(ansible_user_id) }}"
group: "{{ appimage.group | default(ansible_user_gid) }}"
state: directory
- name: Fetch appimage
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
ansible.builtin.get_url:
mode: "{{ pkg.mode | default('0755') }}"
owner: "{{ pkg.owner | default(ansible_user_id) }}"
group: "{{ pkg.group | default(ansible_user_gid) }}"
url: "{{ pkg.url }}"
dest: "{{ path_appimage }}/{{ pkg.name }}/{{ pkg.filename }}"
mode: "{{ appimage.mode | default('0755') }}"
owner: "{{ appimage.owner | default(ansible_user_id) }}"
group: "{{ appimage.group | default(ansible_user_gid) }}"
url: "{{ appimage.url }}"
dest: "{{ path_appimage }}/{{ appimage.name }}/{{ appimage.filename }}"
decompress: false
backup: false
- name: Link appimage to bin
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
ansible.builtin.file:
state: link
src: "{{ path_appimage }}/{{ pkg.name }}/{{ pkg.filename }}"
path: "{{ path_bin }}/{{ pkg.name }}"
src: "{{ path_appimage }}/{{ appimage.name }}/{{ appimage.filename }}"
path: "{{ path_bin }}/{{ appimage.name }}"

View File

@@ -2,9 +2,9 @@
---
- name: Ensure requirements met
when:
- pkg.extract_to is defined
- pkg.name is defined
- pkg.url is defined
- archive.extract_to is defined
- archive.name is defined
- archive.url is defined
block:
- name: Extract archive to given path
block:
@@ -13,16 +13,16 @@
become_user: "{{ install_become_user }}"
ansible.builtin.file:
state: directory
path: "{{ pkg.extract_to }}"
mode: "{{ pkg.mode | default('0755') }}"
owner: "{{ pkg.owner | default(ansible_user_id)}}"
group: "{{ pkg.group | default(ansible_user_gid) }}"
path: "{{ archive.extract_to }}"
mode: "{{ archive.mode | default('0755') }}"
owner: "{{ archive.owner | default(ansible_user_id)}}"
group: "{{ archive.group | default(ansible_user_gid) }}"
- name: Download archive to cache
ansible.builtin.get_url:
dest: "{{ d_cache.path }}/{{ pkg.name }}"
url: "{{ pkg.url }}"
checksum: "{{ pkg.checksum | default(omit) }}"
dest: "{{ d_cache.path }}/{{ archive.name }}"
url: "{{ archive.url }}"
checksum: "{{ archive.checksum | default(omit) }}"
decompress: false
mode: '0644'
@@ -30,19 +30,19 @@
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
ansible.builtin.unarchive:
dest: "{{ pkg.extract_to }}"
src: "{{ d_cache.path }}/{{ pkg.name }}"
dest: "{{ archive.extract_to }}"
src: "{{ d_cache.path }}/{{ archive.name }}"
remote_src: true
include: "{{ pkg.include | default(omit) }}"
exclude: "{{ pkg.exclude | default(omit) }}"
include: "{{ archive.include | default(omit) }}"
exclude: "{{ archive.exclude | default(omit) }}"
- name: Symlink archive files
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
when:
- pkg.links is defined
- pkg.links | length > 0
loop: "{{ pkg.links }}"
- archive.links is defined
- archive.links | length > 0
loop: "{{ archive.links }}"
loop_control:
loop_var: lnk
ansible.builtin.file:

View File

@@ -4,7 +4,7 @@
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
community.general.cargo:
name: "{{ pkg.name | default(pkg) }}"
version: "{{ pkg.version | default(omit) }}"
locked: "{{ pkg.locked | default(false) }}"
name: "{{ cargo.name }}"
version: "{{ cargo.version | default(omit) }}"
locked: "{{ cargo.locked | default(false) }}"
path: "{{ install_prefix }}"

View File

@@ -2,64 +2,50 @@
---
- name: Cargo source install helper
block:
- name: Set build variables
ansible.builtin.set_fact:
git_path: "{{ d_tempdir.path }}/{{ pkg.name }}"
git_repo: "{{ pkg.repo }}"
git_depth: "{{ pkg.depth | default(1) }}"
git_recursive: "{{ pkg.recursive | default(true) }}"
git_version: "{{ pkg.version | default(omit) }}"
- name: Fetch git repo
vars:
git:
path: "{{ d_cache.path }}/{{ cargo_build.name }}"
repo: "{{ cargo_build.repo }}"
depth: "{{ cargo_build.depth | default(1) }}"
force: "{{ cargo_build.force_git | default(true) }}"
recursive: "{{ cargo_build.recursive | default(true) }}"
version: "{{ cargo_build.version | default(omit) }}"
ansible.builtin.include_tasks:
file: helpers/git.yml
- name: Build cargo release
ansible.builtin.command:
creates: "{{ pkg.bin_output }}"
chdir: "{{ pkg.path }}"
argv: "{{ [cargo, build] + pkg.build_flags }}"
chdir: "{{ d_cache.path }}/{{ cargo_build.name }}"
argv: "{{ [cargo, build] + cargo_build.build_flags }}"
- name: Install cargo release
block:
- name: Install binary
when:
- bin_name is defined
- bin_output is defined
become: true
ansible.builtin.copy:
backup: false
dest: "{{ install_prefix }}/bin/{{ bin_name }}"
owner: root
group: root
mode: "0755"
remote_src: true
src: "{{ git_path }}/{{ bin_output }}"
- name: Install additional files
when:
- install_files is defined
block:
- name: Create missing directories
loop: "{{ install_files | dict2items }}"
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
loop: "{{ cargo_build.files }}"
loop_control:
loop_var: file
ansible.builtin.file:
path: "{{ install_prefix }}/{{ file.value | dirname }}"
owner: root
group: root
mode: "0755"
state: directory
path: "{{ install_prefix }}/{{ file.to | dirname }}"
mode: '0755'
owner: "{{ cargo_build.owner | default(ansible_user_id) }}"
group: "{{ cargo_build.group | default(ansible_user_gid) }}"
- name: Copy extra files
loop: "{{ install_files | dict2items }}"
- name: Install release files
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
loop: "{{ cargo_build.files }}"
loop_control:
loop_var: file
ansible.builtin.copy:
backup: false
dest: "{{ install_prefix }}/{{ file.value }}"
owner: root
group: root
mode: "0644"
remote_src: true
src: "{{ git_path }}/{{ file.key }}"
src: "{{ d_cache.path }}/{{ cargo_build.name }}/{{ file.from }}"
dest: "{{ install_prefix }}/{{ file.to }}"
owner: "{{ cargo_build.owner | default(ansible_user_id) }}"
group: "{{ cargo_build.group | default(ansible_user_gid) }}"
mode: "{{ file.mode | default('0644') }}"
force: "{{ file.force | default(true) }}"

View File

@@ -4,7 +4,7 @@
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
community.general.flatpak:
method: "{{ flatpak.method | default('system') }}"
remote: "{{ flatpak.remote }}"
name: "{{ flatpak.name }}"
remote: "{{ flatpak.remote }}"
method: "{{ flatpak.method | default('system') }}"
state: "{{ flatpak.state | default('present') }}"

View File

@@ -4,8 +4,8 @@
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
community.general.flatpak_remote:
enabled: "{{ remote.enabled | default(true) }}"
flatpakrepo_url: "{{ remote.url }}"
method: "{{ remote.method | default('system') }}"
name: "{{ remote.name }}"
flatpakrepo_url: "{{ remote.url }}"
enabled: "{{ remote.enabled | default(true) }}"
method: "{{ remote.method | default('system') }}"
state: "{{ remote.state | default('present') }}"

View File

@@ -16,15 +16,9 @@
- name: Install flatpaks
when:
- pkg_flatpak|length > 0
block:
- name: Install flatpak
loop: "{{ pkg_flatpak | unique }}"
loop_control:
loop_var: flatpak
vars:
pkg_method: "{{ flatpak.method | default(default_flatpak_method) }}"
pkg_remote: "{{ flatpak.remote | default(default_flatpak_remote) }}"
pkg_name: "{{ flatpak.name | default(flatpak) }}"
ansible.builtin.include_tasks:
file: helpers/flatpak.yml
@@ -34,9 +28,5 @@
loop: "{{ pkg_appimage }}"
loop_control:
loop_var: appimage
vars:
appimage_link_name: "{{ appimage.link_name }}"
appimage_url: "{{ appimage.url }}"
appimage_file: "{{ appimage.file }}"
ansible.builtin.include_tasks:
file: helpers/appimage.yml

View File

@@ -86,42 +86,42 @@
- name: Ensure pipx is installed
when:
- pkg_pipx|length > 0
block:
- name: Queue pipx install
ansible.builtin.include_tasks:
file: pkgs/pipx.yml
- name: Ensure pipx path exists
when: pkg_pipx|length > 0
become: "{{ ext_become }}"
- name: Ensure pipx path exists
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
ansible.builtin.file:
state: directory
mode: '0755'
path: "{{ path.pipx }}"
path: "{{ path_pipx }}"
- name: Ensure nodejs and npm are installed
when: pkg_npm|length > 0
vars:
pkg: nodejs
when:
- pkg_npm|length > 0
ansible.builtin.include_tasks:
file: addpkg.yml
file: pkgs/nodejs.yml
- name: Ensure flatpak is installed
when:
- pkg_flatpak is defined
- pkg_flatpak|length > 0
vars:
pkg: flatpak
ansible.builtin.include_tasks:
file: addpkg.yml
file: pkgs/flatpak.yml
- name: Ensure appimage path exists
when:
- pkg_appimage is defined
- pkg_appimage|length > 0
become: "{{ ext_become }}"
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
ansible.builtin.file:
state: directory
mode: '0755'
path: "{{ path.appimage }}"
path: "{{ path_appimage }}"
- name: Ensure archive path exists
when:
@@ -134,13 +134,14 @@
path: "{{ path_archive }}"
- name: Depend zig
when: pkg_zig|length > 0
vars:
pkg: zig
when:
- pkg_zig|length > 0
ansible.builtin.include_tasks:
file: addpkg.yml
file: pkgs/zig.yml
- name: Install sys_pkgs list using system package manager
- name: Install pkg_sys list using system package manager
when:
- pkg_sys|length > 0
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
ansible.builtin.package:
@@ -152,7 +153,7 @@
- pkg_archive|length > 0
loop: "{{ pkg_archive }}"
loop_control:
loop_var: pkg
loop_var: archive
ansible.builtin.include_tasks:
file: helpers/archive.yml
@@ -173,18 +174,19 @@
- pkg_cargo|length > 0
block:
- name: Ensure cargo path exists
become: "{{ ext_become }}"
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
ansible.builtin.file:
state: directory
mode: '0755'
path: "{{ path.cargo }}"
path: "{{ path_cargo }}"
- name: Install cargo packages
loop: "{{ pkg_cargo | unique }}"
loop_control:
loop_var: pkg
loop_var: cargo
ansible.builtin.include_tasks:
file: cargo.yml
file: helpers/cargo.yml
- name: Build and install rust apps
when:
@@ -193,16 +195,7 @@
- name: Run cargo build and install
loop: "{{ cargo_pkg_build }}"
loop_control:
loop_var: pkg
vars:
bin_name: "{{ pkg.bin_name | default(omit) }}"
bin_output: "{{ pkg.bin_output | default(omit) }}"
cargo_build_flags: "{{ pkg.cargo_build_flags | default(omit) }}"
depth: "{{ pkg.depth | default(omit) }}"
install_files: "{{ pkg.install_files | default(omit) }}"
name: "{{ pkg.name | default(omit) }}"
recursive: "{{ pkg.recursive | default(omit) }}"
repo: "{{ pkg.repo | default(omit) }}"
loop_var: cargo_build
ansible.builtin.include_tasks:
file: helpers/cargo_build.yml

View File

@@ -2,7 +2,7 @@
---
- name: Configure alacritty # {{{
when:
- __alacritty_configured is undefined
- "'alacritty' not in __configured"
block:
- name: Set alacritty install method
when:
@@ -16,18 +16,18 @@
ansible.builtin.set_fact:
alacritty_build_deps: "{{ alacritty_build_deps[ansible_os_family] }}"
alacritty_src_install:
cargo_build_flags: "{{ alacritty_cargo_build_flags }}"
build_flags: "{{ alacritty_cargo_build_flags }}"
name: "{{ alacritty_pkgname }}"
repo: "{{ alacritty_git_repo }}"
version: "{{ alacritty_version }}"
bin_output: "target/release/alacritty"
bin_name: "alacritty"
install_prefix: "{{ install_prefix }}"
install_files:
extra/logo/alacritty-term.svg: share/pixmaps/Alacritty.svg
desktop_files:
- extra/linux/Alacritty.desktop
files_list: "{{ alacritty_build_files }}"
files:
- from: target/release/alacritty
to: bin/alacritty
mode: '0755'
- from: extra/logo/alacritty-term.svg
to: share/pixmaps/Alacritty.svg
- from: extra/linux/Alacritty.desktop
to: share/applications/Alacritty.desktop
- name: Set alacritty install extra build deps
when:
@@ -50,7 +50,7 @@
# }}}
- name: Append alacritty installation
block:
- name: Append alacritty to pkg_cargo
- name: Append alacritty to pkg_cargo_build
when:
- alacritty_method == 'source'
block:
@@ -64,19 +64,13 @@
pkg_sys: "{{ pkg_sys + alacritty_build_deps }}"
pkg_cargo_build: "{{ pkg_cargo_build + [alacritty_src_install] }}"
- name: Append alacritty to pkg_cask
- name: Append alacritty to pkg_sys
when:
- alacritty_method == 'cask'
ansible.builtin.set_fact:
pkg_cask: "{{ pkg_cask + [alacritty_pkgname] }}"
- name: Append alacritty to sys_pkg
when:
- alacritty_method == 'package'
- alacritty_method == 'system'
ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + [alacritty_pkgname] }}"
- name: Complete alacritty configuration
when: __alacritty_configured is undefined
ansible.builtin.set_fact:
__alacritty_configured: true
__configured: "{{ __configured | combine( { 'alacritty': true } ) }}"