reorganizing configuration

- static package configuration in `vars/pkgs`
  - loaded into the variable `pkgconfig` as part of `tasks/main.yml`
This commit is contained in:
Matthew Stobbs
2025-02-12 12:52:55 -07:00
parent 9250145116
commit a3df5215b8
23 changed files with 259 additions and 226 deletions

View File

@@ -2,8 +2,24 @@
---
# create all the facts used throughout the role, but shouldn't be touched
# by the user
- name: Set facts based on use_local == true
when:
- use_local
ansible.builtin.set_fact:
paths: "{{ local_paths }}"
flatpak_method: user
- name: Set facts based on use_local == false
when:
- not use_local
ansible.builtin.set_fact:
paths: "{{ sys_paths }}"
flatpak_method: system
- name: Set installation facts
ansible.builtin.set_fact:
bin_dir: "{{ paths.install }}/bin"
state_dir: "{{ paths.install }}/state"
app_images: [] # app_images to install
cargo_pkgs: [] # rust packages from cargo
cask_pkgs: [] # homebrew casks
@@ -19,39 +35,42 @@
- name: flathub
url: https://dl.flathub.org/repo/flathub.flatpakrepo
- name: Set facts based on use_local == true
when:
- use_local
ansible.builtin.set_fact:
paths: "{{ local_paths }}"
flatpak_method: user
- name: Set facts based on use_local == false
when:
- not use_local
ansible.builtin.set_fact:
paths: "{{ sys_paths }}"
flatpak_method: system
- name: Set macOS specific facts
when:
- ansible_distribution == 'MacOSX'
ansible.builtin.set_fact:
pipx_exec: /opt/homebrew/bin/pipx
- name: Determine OS and set facts for it
- ansible_system == 'Darwin'
block:
- name: Set macOS facts
when: ansible_os_family == 'Darwin'
- name: Set pipx executable
ansible.builtin.set_fact:
pipx_exec: /opt/homebrew/bin/pipx
- name: Set sys_pkg_become to false for homebrew
ansible.builtin.set_fact:
sys_pkg_become: false
- name: Set Linux specific facts
when:
- ansible_system == 'Linux'
block:
- name: Set Linux facts
when: ansible_system == 'Linux'
ansible.builtin.set_fact:
sys_pkg_become: true
- name: Ensure required paths exist
become: "{{ not use_local }}"
loop: "{{ paths + [bin_dir, state_dir] }}"
loop_control:
loop_var: path
ansible.builtin.file:
state: directory
mode: '0755'
path: "{{ path }}"
- name: Read default package configuration
ansible.builtin.include_vars:
dir: pkgs
extensions:
- yml
name: pkgconfig
- name: Generate package installation lists
ansible.builtin.include_tasks:
file: addpkg.yml
@@ -155,10 +174,10 @@
name: "{{ flatpak.name }}"
remote: "{{ flatpak.remote | default('flathub') }}"
- name: Ensure /usr/local/bin exists
- name: Ensure prefix/bin exists
ansible.builtin.file:
state: directory
path: /usr/local/bin
path: "{{ paths.install }}/bin"
owner: root
mode: '0755'
become: true