Install cargo only if pkg_cargo needs it

This commit is contained in:
Matthew Stobbs
2025-05-10 12:55:10 -06:00
parent 7183372163
commit 454f2fab73
20 changed files with 117 additions and 109 deletions

View File

@@ -19,13 +19,13 @@
- name: Ensure go is present - name: Ensure go is present
vars: vars:
pkg: go pkg: go
listen: "Depend go" listen: Depend go
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: addpkg.yml file: addpkg.yml
- name: Ensure go path exists - name: Ensure go path exists
become: "{{ ext_become }}" become: "{{ ext_become }}"
listen: "Depend go" listen: Depend go
ansible.builtin.file: ansible.builtin.file:
state: directory state: directory
mode: '0755' mode: '0755'
@@ -46,47 +46,47 @@
- name: Ensure pipx is installed - name: Ensure pipx is installed
vars: vars:
pkg: pipx pkg: pipx
listen: "Depend pipx" listen: Depend pipx
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: addpkg.yml file: addpkg.yml
- name: Ensure pipx path exists - name: Ensure pipx path exists
become: "{{ ext_become }}" become: "{{ ext_become }}"
listen: "Depend pipx" listen: Depend pip"
ansible.builtin.file: ansible.builtin.file:
state: directory state: directory
mode: '0755' mode: '0755'
path: "{{ path.pipx }}" path: "{{ path.pipx }}"
- name: Ensure rust and cargo are installed # - name: Ensure rust and cargo are installed
vars: # vars:
pkg: rust # pkg: rust
listen: "Depend cargo" # listen: Depend cargo
ansible.builtin.include_tasks: # ansible.builtin.include_tasks:
file: addpkg.yml # file: addpkg.yml
#
- name: Ensure cargo path exists # - name: Ensure cargo path exists
become: "{{ ext_become }}" # become: "{{ ext_become }}"
listen: "Depend cargo" # listen: Depend cargo
ansible.builtin.file: # ansible.builtin.file:
state: directory # state: directory
mode: '0755' # mode: '0755'
path: "{{ path.cargo }}" # path: "{{ path.cargo }}"
#
- name: Depend rust # - name: Depend rust
vars: # vars:
pkg: rust # pkg: rust
listen: "Depend rust" # listen: "Depend rust"
ansible.builtin.include_tasks: # ansible.builtin.include_tasks:
file: addpkg.yml # file: addpkg.yml
#
- name: Ensure cargo path exists # - name: Ensure cargo path exists
become: "{{ ext_become }}" # become: "{{ ext_become }}"
listen: "Depend rust" # listen: "Depend rust"
ansible.builtin.file: # ansible.builtin.file:
state: directory # state: directory
mode: '0755' # mode: '0755'
path: "{{ path.cargo }}" # path: "{{ path.cargo }}"
- name: Depend zig - name: Depend zig
vars: vars:

View File

@@ -99,6 +99,21 @@
- name: Install cargo packages - name: Install cargo packages
when: when:
- pkg_cargo|length > 0 - pkg_cargo|length > 0
block:
- name: Ensure rust and cargo are installed
vars:
pkg: rust
ansible.builtin.include_tasks:
file: addpkg.yml
- name: Ensure cargo path exists
become: "{{ ext_become }}"
ansible.builtin.file:
state: directory
mode: '0755'
path: "{{ path.cargo }}"
- name: Install cargo packages
loop: "{{ pkg_cargo | unique }}" loop: "{{ pkg_cargo | unique }}"
loop_control: loop_control:
loop_var: pkg loop_var: pkg

View File

@@ -11,9 +11,9 @@
- name: Append alacritty to pkg_cargo - name: Append alacritty to pkg_cargo
when: when:
- alacritty.method == 'cargo' - alacritty.method == 'cargo'
notify: # notify:
- Depend cargo # - Depend cargo
changed_when: true # changed_when: true
ansible.builtin.set_fact: ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + alacritty.build_deps }}" pkg_sys: "{{ pkg_sys + alacritty.build_deps }}"
pkg_cargo: "{{ pkg_cargo + [alacritty.cargo] }}" pkg_cargo: "{{ pkg_cargo + [alacritty.cargo] }}"

View File

@@ -11,9 +11,9 @@
- name: Append broot to pkg_sys and pkg_cargo - name: Append broot to pkg_sys and pkg_cargo
when: when:
- ansible_system == 'Linux' - ansible_system == 'Linux'
notify: # notify:
- Depend cargo # - Depend cargo
changed_when: true # changed_when: true
ansible.builtin.set_fact: ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + broot.deps }}" pkg_sys: "{{ pkg_sys + broot.deps }}"
pkg_cargo: "{{ pkg_cargo + [broot] }}" pkg_cargo: "{{ pkg_cargo + [broot] }}"

View File

@@ -11,9 +11,9 @@
- name: Append choose to pkg_cargo - name: Append choose to pkg_cargo
when: when:
- ansible_system == 'Linux' - ansible_system == 'Linux'
notify: # notify:
- Depend cargo # - Depend cargo
changed_when: true # changed_when: true
ansible.builtin.set_fact: ansible.builtin.set_fact:
pkg_cargo: "{{ pkg_cargo + [choose] }}" pkg_cargo: "{{ pkg_cargo + [choose] }}"

View File

@@ -5,9 +5,9 @@
- dotenv_linter_configured is undefined - dotenv_linter_configured is undefined
block: block:
- name: Append dotenv-linter to pkg_cargo - name: Append dotenv-linter to pkg_cargo
notify: # notify:
- Depend cargo # - Depend cargo
changed_when: true # changed_when: true
ansible.builtin.set_fact: ansible.builtin.set_fact:
pkg_cargo: "{{ pkg_cargo + ['dotenv-linter'] }}" pkg_cargo: "{{ pkg_cargo + ['dotenv-linter'] }}"

View File

@@ -7,9 +7,9 @@
- name: Append du-dust to pkg_cargo - name: Append du-dust to pkg_cargo
when: when:
- ansible_system == 'Linux' - ansible_system == 'Linux'
notify: # notify:
- Depend cargo # - Depend cargo
changed_when: true # changed_when: true
ansible.builtin.set_fact: ansible.builtin.set_fact:
pkg_cargo: "{{ pkg_cargo + ['du-dust'] }}" pkg_cargo: "{{ pkg_cargo + ['du-dust'] }}"

View File

@@ -5,9 +5,9 @@
- eza_configured is undefined - eza_configured is undefined
block: block:
- name: Append eza to pkg_cargo - name: Append eza to pkg_cargo
notify: # notify:
- Depend cargo # - Depend cargo
changed_when: true # changed_when: true
ansible.builtin.set_fact: ansible.builtin.set_fact:
pkg_cargo: "{{ pkg_cargo + ['eza'] }}" pkg_cargo: "{{ pkg_cargo + ['eza'] }}"

View File

@@ -13,9 +13,9 @@
- name: Append gping to pkg_cargo - name: Append gping to pkg_cargo
when: when:
- ansible_system == 'Linux' - ansible_system == 'Linux'
notify: # notify:
- Depend cargo # - Depend cargo
changed_when: true # changed_when: true
ansible.builtin.set_fact: ansible.builtin.set_fact:
pkg_cargo: "{{ pkg_cargo + ['gping'] }}" pkg_cargo: "{{ pkg_cargo + ['gping'] }}"

View File

@@ -5,8 +5,8 @@
- htmx_lsp_configured is undefined - htmx_lsp_configured is undefined
block: block:
- name: Append htmx-lsp to pkg_cargo - name: Append htmx-lsp to pkg_cargo
notify: Depend cargo # notify: Depend cargo
changed_when: true # changed_when: true
ansible.builtin.set_fact: ansible.builtin.set_fact:
pkg_cargo: "{{ pkg_cargo + ['htmx-lsp'] }}" pkg_cargo: "{{ pkg_cargo + ['htmx-lsp'] }}"

View File

@@ -5,9 +5,9 @@
- jinja_lsp_configured is undefined - jinja_lsp_configured is undefined
block: block:
- name: Append jinja-lsp to pkg_cargo - name: Append jinja-lsp to pkg_cargo
notify: # notify:
- Depend cargo # - Depend cargo
changed_when: true # changed_when: true
ansible.builtin.set_fact: ansible.builtin.set_fact:
pkg_cargo: "{{ pkg_cargo + ['jinja-lsp'] }}" pkg_cargo: "{{ pkg_cargo + ['jinja-lsp'] }}"

View File

@@ -13,8 +13,8 @@
- name: Append mcfly to pkg_cargo - name: Append mcfly to pkg_cargo
when: when:
- ansible_system == 'Linux' - ansible_system == 'Linux'
notify: Depend cargo # notify: Depend cargo
changed_when: true # changed_when: true
ansible.builtin.set_fact: ansible.builtin.set_fact:
pkg_cargo: "{{ pkg_cargo + ['mcfly'] }}" pkg_cargo: "{{ pkg_cargo + ['mcfly'] }}"

View File

@@ -17,9 +17,9 @@
pkg_sys: "{{ pkg_sys + neovide.deps }}" pkg_sys: "{{ pkg_sys + neovide.deps }}"
- name: Append neovide to pkg_cargo - name: Append neovide to pkg_cargo
notify: # notify:
- Depend cargo # - Depend cargo
changed_when: true # changed_when: true
ansible.builtin.set_fact: ansible.builtin.set_fact:
pkg_cargo: "{{ pkg_cargo + [neovide] }}" pkg_cargo: "{{ pkg_cargo + [neovide] }}"

View File

@@ -1,9 +1,9 @@
# vim: set filetype=yaml.ansible : # vim: set filetype=yaml.ansible :
--- ---
- name: Add nodejs # - name: Add nodejs
when: # when:
- nodejs_configured is undefined # - nodejs_configured is undefined
block: # block:
- name: Load nodejs config - name: Load nodejs config
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: config/nodejs.yml file: config/nodejs.yml

View File

@@ -1,17 +1,10 @@
# vim: set filetype=yaml.ansible : # vim: set filetype=yaml.ansible :
--- ---
- name: Add rust
when:
- rust_configured is undefined
block:
- name: Load rust config - name: Load rust config
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: config/rust.yml file: config/rust.yml
- name: Append rust to pkgs - name: Install rust and cargo
ansible.builtin.set_fact: become: true
pkg_sys: "{{ pkg_sys + rust.pkgs }}" ansible.builtin.package:
name: "{{ rust.pkgs }}"
- name: Set rust_configured
ansible.builtin.set_fact:
rust_configured: true

View File

@@ -13,9 +13,9 @@
- name: Append sd to pkg_cargo - name: Append sd to pkg_cargo
when: when:
- ansible_system == 'Linux' - ansible_system == 'Linux'
notify: # notify:
- Depend cargo # - Depend cargo
changed_when: true # changed_when: true
ansible.builtin.set_fact: ansible.builtin.set_fact:
pkg_cargo: "{{ pkg_cargo + ['sd'] }}" pkg_cargo: "{{ pkg_cargo + ['sd'] }}"

View File

@@ -5,9 +5,9 @@
- starship_configured is undefined - starship_configured is undefined
block: block:
- name: Append starship to pkg_cargo - name: Append starship to pkg_cargo
notify: # notify:
- Depend cargo # - Depend cargo
changed_when: true # changed_when: true
ansible.builtin.set_fact: ansible.builtin.set_fact:
pkg_cargo: "{{ pkg_cargo + [{'name': 'starship', 'locked': true}] }}" pkg_cargo: "{{ pkg_cargo + [{'name': 'starship', 'locked': true}] }}"

View File

@@ -13,8 +13,8 @@
- name: Append tldr to pkg_cargo - name: Append tldr to pkg_cargo
when: when:
- ansible_system == 'Linux' - ansible_system == 'Linux'
notify: Depend cargo # notify: Depend cargo
changed_when: true # changed_when: true
ansible.builtin.set_fact: ansible.builtin.set_fact:
pkg_cargo: "{{ pkg_cargo + ['tlrc'] }}" pkg_cargo: "{{ pkg_cargo + ['tlrc'] }}"

View File

@@ -17,8 +17,8 @@
- name: Add xh to cargopkgs - name: Add xh to cargopkgs
when: when:
- ansible_system == 'Linux' - ansible_system == 'Linux'
notify: Depend cargo # notify: Depend cargo
changed_when: true # changed_when: true
ansible.builtin.set_fact: ansible.builtin.set_fact:
pkg_cargo: "{{ pkg_cargo + [xh] }}" pkg_cargo: "{{ pkg_cargo + [xh] }}"

View File

@@ -5,8 +5,8 @@
- yazi_fm_configured is undefined - yazi_fm_configured is undefined
block: block:
- name: Append yazi-fm to pkg_cargo - name: Append yazi-fm to pkg_cargo
notify: Depend cargo # notify: Depend cargo
changed_when: true # changed_when: true
ansible.builtin.set_fact: ansible.builtin.set_fact:
pkg_cargo: "{{ pkg_cargo + ['yazi-fm', 'yazi-cli'] }}" pkg_cargo: "{{ pkg_cargo + ['yazi-fm', 'yazi-cli'] }}"