Files
ansible_role_package/tasks/pkgs/cargo.yml
2026-04-13 14:50:45 -06:00

53 lines
1.4 KiB
YAML

# vim: set filetype=yaml.ansible :
#
## Package: cargo
## Description: the Rust package manager
## Version: system
## Methods: system
## Helpers: -
---
- name: Set default cargo values # {{{
ansible.builtin.set_fact:
cargo:
methods:
- system
pkgname:
RedHat: cargo
Debian: cargo
Alpine: cargo
FreeBSD: cargo
# }}}
- name: Configure cargo
when:
- "'cargo' not in __configured"
block:
- name: Set cargo install method
when:
- cargo_imethod is undefined
ansible.builtin.set_fact:
cargo_imethod: "{{ imethod if imethod in cargo.methods else cargo.methods[0] }}"
- name: Add dependencies
when:
- cargo_pkgdeps is defined
loop: "{{ cargo_pkgdeps }}"
loop_control:
loop_var: dep
ansible.builtin.include_tasks: "pkgs/{{ dep }}.yml"
- name: Append cargo to install list
when:
- cargo_imethod == "system"
block:
- name: Queue cargo install
ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + [cargo.pkgname[os_family]] }}"
- name: Finalise cargo system install
ansible.builtin.set_fact:
cargo_install: "{{ cargo_imethod }}={{ cargo.pkgname[os_family] }}"
- name: Finalize cargo configuration
ansible.builtin.set_fact:
__configured: "{{ __configured | combine ( { 'cargo': cargo_install } ) }}"