make directories only when needed

This commit is contained in:
Matthew Stobbs
2025-03-25 04:28:10 -06:00
parent fe7af27e26
commit 6d124fa626
3 changed files with 95 additions and 65 deletions

View File

@@ -1,10 +1,35 @@
# vim: set filetype=yaml.ansible : # vim: set filetype=yaml.ansible :
--- ---
- name: Depend go - name: Ensure appimage path exists
ansible.builtin.include_tasks: become: "{{ ext_become }}"
file: addpkg.yml listen: "Depend appimage"
ansible.builtin.file:
state: directory
mode: '0755'
path: "{{ path.appimage }}"
- name: Ensure archive path exists
become: "{{ ext_become }}"
listen: "Depend archive"
ansible.builtin.file:
state: directory
mode: '0755'
path: "{{ path.archive }}"
- name: Ensure go is present
vars: vars:
pkg: go pkg: go
listen: "Depend go"
ansible.builtin.include_tasks:
file: addpkg.yml
- name: Ensure go path exists
become: "{{ ext_become }}"
listen: "Depend go"
ansible.builtin.file:
state: directory
mode: '0755'
path: "{{ path.go }}"
- name: Depend flatpak - name: Depend flatpak
vars: vars:
@@ -18,24 +43,51 @@
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: addpkg.yml file: addpkg.yml
- name: Depend pipx - name: Ensure pipx is installed
vars: vars:
pkg: pipx pkg: pipx
listen: "Depend pipx"
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: addpkg.yml file: addpkg.yml
- name: Depend cargo - name: Ensure pipx path exists
become: "{{ ext_become }}"
listen: "Depend pipx"
ansible.builtin.file:
state: directory
mode: '0755'
path: "{{ path.pipx }}"
- name: Ensure rust and cargo are installed
vars: vars:
pkg: rust pkg: rust
listen: "Depend cargo"
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: addpkg.yml file: addpkg.yml
- name: Ensure cargo path exists
become: "{{ ext_become }}"
listen: "Depend cargo"
ansible.builtin.file:
state: directory
mode: '0755'
path: "{{ path.cargo }}"
- name: Depend rust - name: Depend rust
vars: vars:
pkg: rust pkg: rust
listen: "Depend rust"
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: addpkg.yml file: addpkg.yml
- name: Ensure cargo path exists
become: "{{ ext_become }}"
listen: "Depend rust"
ansible.builtin.file:
state: directory
mode: '0755'
path: "{{ path.cargo }}"
- name: Depend zig - name: Depend zig
vars: vars:
pkg: zig pkg: zig

View File

@@ -33,18 +33,9 @@
remote: "{{ flatpak.remote | default('flathub') }}" remote: "{{ flatpak.remote | default('flathub') }}"
state: present state: present
- name: Install appimages - name: Install pkg_appimage
when: when:
- pkg_appimage|length > 0 - pkg_appimage|length > 0
block:
- name: Ensure appimage path exists
become: "{{ ext_become }}"
ansible.builtin.file:
state: directory
mode: '0755'
path: "{{ path.appimage }}"
- name: Install pkg_appimage
loop: "{{ pkg_appimage }}" loop: "{{ pkg_appimage }}"
loop_control: loop_control:
loop_var: pkg loop_var: pkg

View File

@@ -37,6 +37,20 @@
ansible.builtin.debug: ansible.builtin.debug:
var: packages var: packages
- name: Ensure directory exists {{ path.prefix }}
become: "{{ ext_become }}"
ansible.builtin.file:
state: directory
mode: '0755'
path: "{{ path.prefix }}"
- name: Ensure directory exists {{ path.bin }}
become: "{{ ext_become }}"
ansible.builtin.file:
state: directory
mode: '0755'
path: "{{ path.bin }}"
- name: Read default package configuration - name: Read default package configuration
ansible.builtin.include_vars: ansible.builtin.include_vars:
dir: pkgs dir: pkgs
@@ -99,36 +113,18 @@
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: "archive/{{ pkg }}.yml" file: "archive/{{ pkg }}.yml"
- name: Cargo Packages installalation - name: Install cargo packages
when: when:
- pkg_cargo|length > 0 - pkg_cargo|length > 0
block:
- 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
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: cargo.yml file: cargo.yml
- name: Go Packages installalation - name: Install go packages
when: when:
- pkg_go|length > 0 - pkg_go|length > 0
block:
- name: Ensure go path exists
become: "{{ ext_become }}"
ansible.builtin.file:
state: directory
mode: '0755'
path: "{{ path.go }}"
- name: Install go packages
loop: "{{ pkg_go | unique }}" loop: "{{ pkg_go | unique }}"
loop_control: loop_control:
loop_var: pkg loop_var: pkg
@@ -144,18 +140,9 @@
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: npm.yml file: npm.yml
- name: PipX Packages installalation - name: Install python pipx packages for user
when: when:
- pkg_pipx|length > 0 - pkg_pipx|length > 0
block:
- name: Ensure pipx path exists
become: "{{ ext_become }}"
ansible.builtin.file:
state: directory
mode: '0755'
path: "{{ path.pipx }}"
- name: Install python pipx packages for user
loop: "{{ pkg_pipx | unique }}" loop: "{{ pkg_pipx | unique }}"
loop_control: loop_control:
loop_var: pkg loop_var: pkg