From 275f5df7220ed4f9f3d1a030d71db20512527224 Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Tue, 11 Feb 2025 17:51:10 -0700 Subject: [PATCH 01/38] change layout for better management - instead of just `syspkgs` and `srcpkgs` add more lists - `appimages`, `flatpkgs` and others as they come up --- CONTRIBUTING.md | 52 ++++++++ tasks/addpkg.yml | 22 +--- tasks/appimage/bitwarden.yml | 31 +++++ tasks/build/alacritty.yml | 5 +- tasks/build/bitwarden.yml | 28 ----- tasks/build/ghostty.yml | 10 +- tasks/build/lua-language-server.yml | 23 ++-- tasks/main.yml | 183 +++++++++++++--------------- tasks/pkgs/bitwarden.yml | 49 +++++--- tasks/pkgs/lua-language-server.yml | 26 ++-- vars/alacritty.yml | 2 +- vars/bitwarden.yml | 7 +- vars/go.yml | 2 +- vars/lua-language-server.yml | 2 +- vars/main.yml | 69 ++++++----- vars/neovide.yml | 2 +- vars/neovim.yml | 2 +- vars/zig.yml | 2 +- vars/zls.yml | 2 +- 19 files changed, 295 insertions(+), 224 deletions(-) create mode 100644 CONTRIBUTING.md create mode 100644 tasks/appimage/bitwarden.yml delete mode 100644 tasks/build/bitwarden.yml diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..a01e8b8 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,52 @@ +# Contributing + +## Package definition + +Package defintions are just `yaml` tasks in the directory +`tasks/pkgs`, which handle how a package is installed. + +Most can be installed using the `syspkgs` list, and are simply +appending the package name to said list based on the system. + +If a package can be installed via an entry to `syspkgs` for some, +but not all platforms, handling is done to either inform the user +that the package is not available, or to append the package name +to another installation method such as: + +- `appimages` to install the appimage of a package +- `cargopkgs` to install via the rust cargo package manager +- `cargoversioned` to install version lockec cargo packages +- `caskpkgs` to install a homebrew cask +- `flatpkgs` to install flatpaks +- `gopkgs` to install using the `go install` command +- `npmpkgs` to install packages from npm +- `pipxpkgs` to install packages from Python pip +- `srcpkgs` to build packages from source +- `tappkgs` to install packages from home brew taps + +Alternative sources of packages can be defined with entries to: + +- `fpremotes` to add a flatpak remote +- `brewtaps` to add a homebrew tap + +### Adding system level repositories + +Many packages exist in their own external repository for the +given system, such as `/etc/yum.repos.d` for RedHat based linux +distros, `/etc/apt/sources.list.d` for Debian based distros and +others. Since you an add the package to `syspkgs` by enabling a +repo, the coresponding task in `tasks/pkgs` should take the +steps needed to enable the repository. + +### Packages with multiple instllation methods + +Many packages can be installed in different ways, like the +`bitwarden` package. `bitwarden` can be installed as a `syspkg` +on some machines, a `caskpkg` on macOS, an `appimage`, a `flatpak` +or even a `snap`. + +For such packages, a default is chosen to install, in the following order +of precedence: `syspkgs`, `flatpkgs`, `snappkgs`, `appimages`. + +In that order, `syspkgs` and `caskpkgs` have equal weight, as it applies +to macOS. diff --git a/tasks/addpkg.yml b/tasks/addpkg.yml index e1f3ec6..1b1ee5b 100644 --- a/tasks/addpkg.yml +++ b/tasks/addpkg.yml @@ -1,23 +1,11 @@ # vim: set filetype=yaml.ansible : --- -- name: "check if task for {{pkg}} exists" - ansible.builtin.command: "test -f {{role_path}}/tasks/pkgs/{{ pkg }}.yml" +- name: "Check if task exists for {{ pkg }}" + ansible.builtin.stat: + path: "{{ role_path }}/tasks/pkgs/{{ pkg }}.yml" register: cpkg_exists - ignore_errors: true - failed_when: not (cpkg_exists.rc != 0 or cpkg_exists.rc != 1) -- name: "add include task for {{pkg}}" +- name: "Add include task for {{ pkg }}" + when: cpkg_exists.exists ansible.builtin.include_tasks: file: "pkgs/{{ pkg }}.yml" - when: cpkg_exists.rc == 0 - tags: - - packages - -- name: "add {{pkg}} to syspkgs if task doesn't exist: {{assume_missing_is_syspkg}}" - ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [pkg] }}" - when: - - cpkg_exists.rc != 0 - - assume_missing_is_syspkg - tags: - - packages diff --git a/tasks/appimage/bitwarden.yml b/tasks/appimage/bitwarden.yml new file mode 100644 index 0000000..36cc24e --- /dev/null +++ b/tasks/appimage/bitwarden.yml @@ -0,0 +1,31 @@ +# vim: set filetype=yaml.ansible : +--- +- name: Install bitwarden appimage + become: "{{ bw_become }}" + become_user: "{% if bw_become %}{{ bw_owner }}{% else %}~{% endif %}" + when: + - bw_instmtd == 'appimage' + block: + - name: Ensure install path exists + ansible.builtin.file: + state: directory + mode: '0755' + path: "{{ bw_instdir }}" + owner: "{{ bw_owner }}" + group: "{{ bw_group }}" + + - name: Fetch bitwarden appimage + ansible.builtin.get_url: + mode: '0755' + decompress: false + backup: true + url: bw_appimg.url + dest: "{{ bw_instdir }}/{{ bw_appimg.name }}" + owner: "{{ bw_owner }}" + group: "{{ bw_group }}" + + - name: Link bitwarden appimage + ansible.builtin.file: + state: link + src: "{{ bw_instdir }}/{{ bw_appimg.name }}" + path: "{{ bw_instpfx }}/bin/bitwarden" diff --git a/tasks/build/alacritty.yml b/tasks/build/alacritty.yml index da5c775..bedb5cc 100644 --- a/tasks/build/alacritty.yml +++ b/tasks/build/alacritty.yml @@ -1,7 +1,9 @@ # vim: set filetype=yaml.ansible : --- -- name: build and install alacritty +- name: Build and install alacritty + become: true ansible.builtin.command: + creates: "{{ pkgconfig_alacritty.install_prefix }}/bin/alacritty" cmd: - cargo - install @@ -11,4 +13,3 @@ - "{{ pkgconfig_alacritty.git_repo }}" - --tag - "v{{ pkgconfig_alacritty.version }}" - become: true diff --git a/tasks/build/bitwarden.yml b/tasks/build/bitwarden.yml deleted file mode 100644 index 293ce3a..0000000 --- a/tasks/build/bitwarden.yml +++ /dev/null @@ -1,28 +0,0 @@ -# vim: set filetype=yaml.ansible : ---- -- name: Install bitwarden appimage - blocK: - - ansible.builtin.file: - state: directory - mode: '0755' - path: "{{ pkgconfig_bitwarden.install_dir }}" - owner: "{{ pkgconfig_bitwarden.owner }}" - group: "{{ pkgconfig_bitwarden.group }}" - - - ansible.builtin.get_url: - mode: '0755' - decompress: false - backup: true - url: "https://vault.bitwarden.com/download/?app=desktop&platform=linux&variant=appimage" - dset: "{{ pkgconfig_bitwarden.install_dir }}/bitwarden.appimage" - owner: "{{ pkgconfig_bitwarden.owner }}" - group: "{{ pkgconfig_bitwarden.group }}" - - - ansible.builtin.file: - state: link - src: "{{ pkgconfig_bitwarden.install_dir }}/bitwarden.appimage" - path: "{{ pkgconfig_bitwarden.install_prefix }}/bin/bitwarden" - when: - - pkgconfig_bitwarden.use_appimage - beocome: "{{ pkgconfig_bitwarden.dobecome }}" - become_user: "{% if pkgconfig_bitwarden.dobecome %}{{ pkgconfig_bitwarden.owner }}{% else %}~{% endif %}" diff --git a/tasks/build/ghostty.yml b/tasks/build/ghostty.yml index c417bed..50eeb4e 100644 --- a/tasks/build/ghostty.yml +++ b/tasks/build/ghostty.yml @@ -1,27 +1,27 @@ # vim: set filetype=yaml.ansible : --- -- name: build ghostty from source +- name: Build ghostty from source block: - - name: create temp path + - name: Create temp path ansible.builtin.tempfile: state: directory prefix: ghostty. register: d_ghostty_tmp - - name: clone ghostty git repository + - name: Clone ghostty git repository ansible.builtin.git: depth: 1 dest: "{{ d_ghostty_tmp.path }}/ghostty" repo: "{{ pkgconfig_ghostty.git_repo }}" version: "{{ pkgconfig_ghostty.version }}" - - name: build ghostty + - name: Build ghostty ansible.builtin.command: chdir: "{{ d_ghostty_tmp.path }}/ghostty" cmd: "zig build -D{{ pkgconfig_ghostty.optimize }}" register: c_ghostty_build - - name: install ghostty + - name: Install ghostty ansible.file.copy: src: "{{ d_ghostty_tmp.path }}/ghostty/zig-out/bin/ghostty" dest: "{{ pkgconfig_ghostty.install_prefix }}/bin/ghostty" diff --git a/tasks/build/lua-language-server.yml b/tasks/build/lua-language-server.yml index a6a0409..58743ed 100644 --- a/tasks/build/lua-language-server.yml +++ b/tasks/build/lua-language-server.yml @@ -2,11 +2,20 @@ --- - name: Set needed variables lua language server ansible.builtin.set_fact: - luals_pkg: "lua-language-server-{{ pkgconfig_luals.version }}-{{ pkgconfig_luals.sysmap[ansible_system] }}-{{ pkgconfig_luals.archmap[ansible_architecture] }}.tar.gz" + luals_sys: pkgconfig_luals.sysmap[ansible_system] + luals_arch: pkgconfig_luals.archmap[ansible_architecture] + luals_ver: pkgconfig_luals.version + luals_instpath: pkgconfig_luals.install_path + luals_instpfx: pkgconfig_luals.install_prefix + luals_burl: pkgconfig_luals.base_url + +- name: Set luals archive name + ansible.builtin.set_fact: + luals_pkg: "lua-language-server-{{ luals_ver }}-{{ lualsl_sys }}-{{ luals_arch }}.tar.gz" - name: Check if lua language server is already installed ansible.builtin.stat: - path: "{{ pkgconfig_luals.install_path }}/bin/lua-language-server" + path: "{{ luals_instpath }}/bin/lua-language-server" register: r_luals_stat - name: Install lua-language-server @@ -21,20 +30,20 @@ - name: Get latest lua-language-server ansible.builtin.get_url: dest: "{{ d_luals_dl_tmp.path }}/{{ luals_pkg }}" - url: "{{ pkgconfig_luals.base_url }}/{{ pkgconfig_luals.version }}/{{ luals_pkg }}" + url: "{{ luals_burl }}/{{ luals_ver }}/{{ luals_pkg }}" mode: "0644" decompress: false - name: Create install_path ansible.builtin.file: state: directory - path: "{{ pkgconfig_luals.install_path }}" + path: "{{ luals_instpath }}" mode: "0755" become: true - name: Extract lua language server archive ansible.builtin.unarchive: - dest: "{{ pkgconfig_luals.install_path }}" + dest: "{{ luals_instpath }}" src: "{{ d_luals_dl_tmp.path }}/{{ luals_pkg }}" remote_src: true become: true @@ -42,6 +51,6 @@ - name: Link lua language server binary ansible.builtin.file: state: link - src: "{{ pkgconfig_luals.install_path }}/bin/lua-language-server" - path: "{{ pkgconfig_luals.install_prefix }}/bin/lua-language-server" + src: "{{ luals_instpath }}/bin/lua-language-server" + path: "{{ luals_instpfx }}/bin/lua-language-server" become: true diff --git a/tasks/main.yml b/tasks/main.yml index 99a1734..8e41c8a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,64 +1,45 @@ # vim: set filetype=yaml.ansible : --- -- name: generate package installation lists +- name: Determine OS and set facts for it + block: + - name: Set macOS facts + when: ansible_os_family == 'Darwin' + ansible.builtin.set_fact: + syspkg_become: false + + - name: Set Linux facts + when: ansible_system == 'Linux' + ansible.builtin.set_fact: + syspkg_become: true + +- name: Generate package installation lists ansible.builtin.include_tasks: file: addpkg.yml loop: "{{ packages | unique }}" loop_control: loop_var: pkg -- name: redhat based OS - block: - - name: upgrade dnf packages - ansible.builtin.dnf: - name: "*" - state: latest - become: true - when: full_upgrade +- name: Install syspkgs list + become: "{{ syspkg_become }}" + ansible.builtin.package: + name: "{{ syspkgs | unique }}" + state: present - - name: install dnf packages - ansible.builtin.dnf: - name: "{{ syspkgs | unique }}" - state: "{{ install_state }}" - become: true - when: - - syspkgs|length > 0 - - - name: add flatpak repos - community.general.flatpak_remote: - enabled: true - flatpakrepo_url: "{{ repo.url }}" - method: system - name: "{{ repo.name }}" - state: present - loop: "{{ flatpkg_repo }}" - loop_control: - loop_var: repo - become: true - when: - - flatpkg_repo|length > 0 - - flatpkgs|length > 0 - - - name: install flatpaks - community.general.flatpak: - method: "system" - name: "{{ flatpkgs }}" - state: latest - become: true - when: - - flatpkgs|length > 0 +- name: Redhat based OS when: ansible_os_family == 'RedHat' - -- name: debian based OS block: - - name: upgrade apt packages - ansible.builtin.apt: - name: "*" - state: latest + - name: Install dnf packages become: true - when: full_upgrade + when: + - syspkgs|length > 0 + ansible.builtin.dnf: + name: "{{ syspkgs | unique }}" + state: present - - name: install apt packages +- name: Debian based OS + when: ansible_os_family == 'Debian' + block: + - name: Install apt packages ansible.builtin.apt: name: "{{ syspkgs | unique }}" state: "{{ install_state }}" @@ -66,66 +47,75 @@ when: - syspkgs|length > 0 - - name: add flatpak repos - community.general.flatpak_remote: - enabled: true - flatpakrepo_url: "{{ repo.url }}" - method: system - name: "{{ repo.name }}" - state: present - loop: "{{ flatpkg_repo | unique }}" - loop_control: - loop_var: repo - become: true - when: - - flatpkg_repo|length > 0 - - flatpkgs|length > 0 - - - name: install flatpaks - community.general.flatpak: - method: "system" - name: "{{ flatpkgs | unique }}" - state: latest - become: true - when: - - flatpkgs|length > 0 - when: ansible_os_family == 'Debian' - -- name: darwin/macOS based OS +- name: Darwin/macOS based OS + when: ansible_os_family == 'Darwin' block: - - name: upgrade homebrew packages + - name: Upgrade homebrew packages community.general.homebrew: name: "*" state: latest when: full_upgrade - - name: tap homebrew taps + - name: Tap homebrew taps community.general.homebrew_tap: name: "{{ brewtaps | unique }}" state: present when: brewtaps|length > 0 - - name: install homebrew packages + - name: Install homebrew packages community.general.homebrew: name: "{{ syspkgs | unique }}" state: "{{ install_state }}" when: syspkgs|length > 0 - - name: install homebrew casks + - name: Install homebrew casks community.general.homebrew_cask: name: "{{ caskpkgs | unique }}" state: "{{ install_state }}" when: caskpkgs|length > 0 - - name: workaround to install homebrew taps + - name: Workaround to install homebrew taps ansible.builtin.command: cmd: "brew install {{ tappkg }}" loop: "{{ tappkgs | unique }}" loop_control: loop_var: tappkg - when: ansible_os_family == 'Darwin' + # TODO: fix the need to have this workaround -- name: ensure /usr/local/bin exists +- name: Install flatpaks on Linux Systems + when: + - ansible_system == 'Linux' + - flatpkgs|length > 0 + block: + - name: Add flatpak repos + become: true + loop: "{{ fpremotes | unique }}" + loop_control: + loop_var: remote + when: + - fpremotes|length > 0 + - flatpkgs|length > 0 + community.general.flatpak_remote: + enabled: true + method: system + state: present + flatpakrepo_url: "{{ remote.url }}" + name: "{{ remote.name }}" + + - name: Install flatpaks + become: true + loop: "{{ flatpkgs | unique }}" + loop_control: + loop_var: flatpkg + when: + - flatpkgs|length > 0 + community.general.flatpak: + state: latest + method: system + name: "{{ flatpkg.name }}" + remote: "{{ flatpkg.remote | default('flathub') }}" + +- name: Ensure /usr/local/bin exists ansible.builtin.file: state: directory path: /usr/local/bin @@ -133,7 +123,7 @@ mode: '0755' become: true -- name: install srcpkgs +- name: Install srcpkgs ansible.builtin.include_tasks: file: "build/{{ srcpkg }}.yml" loop: "{{ srcpkgs | unique }}" @@ -141,11 +131,11 @@ loop_var: srcpkg when: srcpkgs|length > 0 -- name: install cargo packages at specific version +- name: Install cargo packages at specific version community.general.cargo: name: "{{ cargopkg.name }}" version: "{{ cargopkg.version }}" - path: "{{ cargopkg.path | default(default_config.install_prefix) }}" + path: "{{ cargopkg.path | default(default_install_prefix) }}" locked: "{{ cargopkg.locked | default(false) }}" become: true when: cargoversioned|length > 0 @@ -164,32 +154,33 @@ loop_var: cargopkg - name: Install local go packages + loop: "{{ gopkgs | unique }}" + loop_control: + loop_var: gopkg + when: gopkgs|length > 0 environment: GOROOT: /usr/local/go PATH: /usr/local/go/bin:$PATH ansible.builtin.command: cmd: "go install {{ gopkg }}" - loop: "{{ gopkgs | unique }}" - loop_control: - loop_var: gopkg - when: gopkgs|length > 0 + #TODO: figure out how to check if the gopkg is already installed - name: Install local npm packages - community.general.npm: - global: true - name: "{{ npmpkg }}" - state: latest loop: "{{ npmpkgs | unique }}" loop_control: loop_var: npmpkg when: npmpkgs|length > 0 + community.general.npm: + global: true + name: "{{ npmpkg }}" + state: latest - name: Install python pipx packages for user - community.general.pipx: - executable: "{% if ansible_os_family == 'Darwin' %}/opt/homebrew/bin/pipx{% else %}/usr/bin/pipx{% endif %}" - name: "{{ pipxpkg }}" - state: latest loop: "{{ pipxpkgs | unique }}" loop_control: loop_var: pipxpkg when: pipxpkgs|length > 0 + community.general.pipx: + executable: "{% if ansible_os_family == 'Darwin' %}/opt/homebrew/bin/pipx{% else %}/usr/bin/pipx{% endif %}" + name: "{{ pipxpkg }}" + state: latest diff --git a/tasks/pkgs/bitwarden.yml b/tasks/pkgs/bitwarden.yml index 42c4d17..fea2689 100644 --- a/tasks/pkgs/bitwarden.yml +++ b/tasks/pkgs/bitwarden.yml @@ -1,31 +1,48 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_vars: +- name: Read bitwarden configuration + ansible.builtin.include_vars: file: bitwarden.yml name: _bitwarden -- ansible.builtin.set_fact: + +- name: Set bitwarden configuration + ansible.builtin.set_fact: pkgconfig_bitwarden: "{{ _bitwarden | ansible.builtin.combine(pkgconfig.bitwarden) }}" -- name: append to flatpkgs +- name: Set bitwarden facts + ansible.builtin.set_fact: + bw: + appimg: pkgconfig_bitwarden.appimage + become: pkgconfig_bitwarden.dobecome + flatpak: pkgconfig_bitwarden.flatpak + group: pkgconfig_bitwarden.group + instdir: pkgconfig_bitwarden.install_dir + instmtd: pkgconfig_bitwarden.install_method + instpfx: pkgconfig_bitwarden.install_prefix + owner: pkgconfig_bitwarden.owner + +- name: Append to flatpkgs + when: + - ansible_os_family != 'Darwin' + - bw.instmtd == 'flatpak' block: - - ansible.builtin.include_tasks: + - name: Ensure flatpak runtime activated + ansible.builtin.include_tasks: file: pkgs/flatpak.yml when: flatpak is undefined - - ansible.builtin.set_fact: - flatpkgs: "{{ flatpkgs + [ 'com.bitwarden.desktop' ] }}" + - name: Append to flatpkgs + ansible.builtin.set_fact: + flatpkgs: "{{ flatpkgs + [bw.flatpak] }}" + +- name: Append to srcpkgs when: - ansible_os_family != 'Darwin' - - pkgconfig_bitwarden.use_flatpak - -- name: append to srcpkgs + - bw.instmtd == 'appimage' ansible.builtin.set_fact: - syspkgs: "{{ srcpkgs + [ 'bitwarden' ] }}" - when: - - ansible_os_family != 'Darwin' - - not pkgconfig_bitwarden.use_flatpak + syspkgs: "{{ appimages + ['bitwarden'] }}" -- name: append to caskpkgs - ansible.builtin.set_fact: - caskpkgs: "{{ caskpkgs + [ 'bitwarden' ] }}" +- name: Append to caskpkgs when: ansible_os_family == 'Darwin' + ansible.builtin.set_fact: + caskpkgs: "{{ caskpkgs + ['bitwarden'] }}" diff --git a/tasks/pkgs/lua-language-server.yml b/tasks/pkgs/lua-language-server.yml index a981c35..cbfeae3 100644 --- a/tasks/pkgs/lua-language-server.yml +++ b/tasks/pkgs/lua-language-server.yml @@ -1,11 +1,23 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_vars: - file: lua-language-server.yml - name: _luals -- ansible.builtin.set_fact: - pkgconfig_luals: "{{ _luals | ansible.builtin.combine(pkgconfig.luals) }}" +- name: Linux specific configuration + when: + - ansible_os_family != 'Darwin' + block: + - name: Load lua-language-server config + ansible.builtin.include_vars: + file: lua-language-server.yml + name: _luals + - name: Combine loaded config with defaults + ansible.builtin.set_fact: + pkgconfig_luals: "{{ _luals | ansible.builtin.combine(pkgconfig.luals) }}" -- name: append to pkgs + - name: Append to pkgs + ansible.builtin.set_fact: + srcpkgs: "{{ srcpkgs + ['lua-language-server'] }}" + +- name: Append to syspkgs + when: + - ansible_os_family == 'Darwin' ansible.builtin.set_fact: - srcpkgs: "{{ srcpkgs + [ 'lua-language-server' ] }}" + syspkgs: "{{ syspkgs + ['lua-language-server'] }}" diff --git a/vars/alacritty.yml b/vars/alacritty.yml index 2bb30a8..6aab3ff 100644 --- a/vars/alacritty.yml +++ b/vars/alacritty.yml @@ -1,4 +1,4 @@ # vim: set filetype=yaml.ansible : --- version: 0.15.0 -install_prefix: "{{ default_config.install_prefix }}" +install_prefix: "{{ default_install_prefix }}" diff --git a/vars/bitwarden.yml b/vars/bitwarden.yml index a2263fe..8de3209 100644 --- a/vars/bitwarden.yml +++ b/vars/bitwarden.yml @@ -1,9 +1,8 @@ # vim: set filetype=yaml.ansible : --- -install_prefix: "{{ default_config.install_prefix }}" -install_dir: /opt/bitwarden -use_flatpak: true -use_appimage: false +install_prefix: "{{ default_install_prefix }}" +install_dir: /opt/appimage/bitwarden +install_method: flatpak dobecome: true owner: root group: root diff --git a/vars/go.yml b/vars/go.yml index eed4e44..1864748 100644 --- a/vars/go.yml +++ b/vars/go.yml @@ -1,4 +1,4 @@ # vim: set filetype=yaml.ansible : --- version: 1.23.6 -install_path: "{{ default_config.install_prefix }}" +install_path: "{{ default_install_prefix }}" diff --git a/vars/lua-language-server.yml b/vars/lua-language-server.yml index cddd43e..ab39904 100644 --- a/vars/lua-language-server.yml +++ b/vars/lua-language-server.yml @@ -1,5 +1,5 @@ # vim: set filetype=yaml.ansible : --- version: 3.13.5 -install_prefix: "{{ default_config.install_prefix }}" +install_prefix: "{{ default_install_prefix }}" install_path: /opt/lua-language-server diff --git a/vars/main.yml b/vars/main.yml index aee1363..1f3ac18 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,39 +1,33 @@ # vim: set filetype=yaml.ansible : # variables used in ansible_role_package --- -assume_missing_is_syspkg: true -full_upgrade: false -install_state: present -default_config: - install_prefix: /usr/local - become: true - owner: root - group: root +default_install_prefix: /usr/local +packages: [] # list of packages to install -# install lists -brewtaps: [] -cargopkgs: [] -cargoversioned: [] -caskpkgs: [] -flatpkgs: [] -flatpkg_repo: +# Package install lists +appimages: [] # appimages to install +cargopkgs: [] # rust packages from cargo +cargoversioned: [] # versioned rust packages from cargo +caskpkgs: [] # homebrew casks +flatpkgs: [] # flatpaks +gopkgs: [] # go applications +npmpkgs: [] # npm commands +pipxpkgs: [] # pipx packages +srcpkgs: [] # packages built from source +syspkgs: [] # system package manager packages +tappkgs: [] # homebrew tap packages + +# Package source lists +brewtaps: [] # homebrew taps +fpremotes: # flatpak remotes - name: flathub url: https://dl.flathub.org/repo/flathub.flatpakrepo -gopkgs: [] -npmpkgs: [] -packages: [] -pipxpkgs: [] -srcpkgs: [] -syspkgs: [] -tappkgs: [] -# pkgconfig, loaded from .yml files in vars -# and combined. Configuration can be changed -# when running the role by specifying -# pkgconfig. as a dict +# Static package configuration +# this shouldn't be changed by the user pkgconfig: alacritty: - deps: + build_deps: RedHat: - cmake - freetype-devel @@ -50,10 +44,15 @@ pkgconfig: - libxkbcommon-dev - python3 git_repo: https://github.com/alacritty/alacritty.git - - bitwarden: {} + bitwarden: + flatpak: + name: com.bitwarden.desktop + remote: flathub + appimage: + name: bitwarden.appimage + url: https://vault.bitwarden.com/download/?app=desktop&platform=linux&variant=appimage broot: - deps: + build_deps: Debian: - build-essential - libxcb1-dev @@ -89,7 +88,7 @@ pkgconfig: - fd-find flatpak: {} ghostty: - deps: + build_deps: Debian: - libgtk-4-dev - libadwaita-1-dev @@ -166,7 +165,7 @@ pkgconfig: x86_64: x64 neovide: git_repo: https://github.com/neovide/neovide.git - deps: + build_deps: RedHat: - fontconfig-devel - freetype-devel @@ -338,7 +337,7 @@ pkgconfig: Linux: nomad Darwin: hashicorp/tap/nomad nushell: - deps: + build_deps: Darwin: - openssl - cmake @@ -430,14 +429,14 @@ pkgconfig: fedora: release: 2-6 epel: - release: 2-3 + release: 2-3 pkgs: RedHat: - zfs Debian: - zfs-dkms - zfsutils-linux - deps: + build_deps: RedHat: - kernel-devel - epel-release diff --git a/vars/neovide.yml b/vars/neovide.yml index 5f1472c..79eea81 100644 --- a/vars/neovide.yml +++ b/vars/neovide.yml @@ -1,4 +1,4 @@ # vim: set filetype=yaml.ansible : --- version: 0.14.0 -install_prefix: "{{ default_config.install_prefix }}" +install_prefix: "{{ default_install_prefix }}" diff --git a/vars/neovim.yml b/vars/neovim.yml index 485ba88..7b9cfd6 100644 --- a/vars/neovim.yml +++ b/vars/neovim.yml @@ -1,7 +1,7 @@ # vim: set filetype=yaml.ansible : --- version: v0.10.3 -install_prefix: "{{ default_config.install_prefix }}" +install_prefix: "{{ default_install_prefix }}" install_dir: /opt/nvim use_appimage: true use_syspkg: true diff --git a/vars/zig.yml b/vars/zig.yml index 7eef36e..ca65e2c 100644 --- a/vars/zig.yml +++ b/vars/zig.yml @@ -1,5 +1,5 @@ # vim: set filetype=yaml.ansible : --- version: 0.13.0 -install_prefix: "{{ default_config.install_prefix }}" +install_prefix: "{{ default_install_prefix }}" install_path: /opt/zig diff --git a/vars/zls.yml b/vars/zls.yml index 5b0372d..e58bb40 100644 --- a/vars/zls.yml +++ b/vars/zls.yml @@ -1,5 +1,5 @@ # vim: set filetype=yaml.ansible : --- version: 0.13.0 -install_prefix: "{{ default_config.install_prefix }}" +install_prefix: "{{ default_install_prefix }}" install_path: /opt/zls From 6d52cc6a4d4bda7146df90ad852df9dde563b26c Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Tue, 11 Feb 2025 20:22:42 -0700 Subject: [PATCH 02/38] move a lot of configuration around --- tasks/addpkg.yml | 18 +++++- tasks/appimage/bitwarden.yml | 10 ++-- tasks/appimage/neovim.yml | 29 ++++++++++ tasks/build/neovim.yml | 55 ------------------- {vars => tasks/config}/alacritty.yml | 0 {vars => tasks/config}/bitwarden.yml | 1 - {vars => tasks/config}/carapace.yml | 0 {vars => tasks/config}/ghostty.yml | 0 {vars => tasks/config}/go.yml | 0 {vars => tasks/config}/libreoffice.yml | 0 .../config}/lua-language-server.yml | 0 {vars => tasks/config}/neovide.yml | 0 {vars => tasks/config}/neovim.yml | 3 +- {vars => tasks/config}/nerdfonts.yml | 0 {vars => tasks/config}/nushell.yml | 0 {vars => tasks/config}/rust.yml | 0 {vars => tasks/config}/zig.yml | 0 {vars => tasks/config}/zls.yml | 0 tasks/main.yml | 21 ++++++- tasks/pkgs/bitwarden.yml | 16 +++--- tasks/pkgs/hashicorp_repo.yml | 38 ++++++++----- tasks/pkgs/neovim.yml | 47 +++++++++++++--- tasks/{build => src}/alacritty.yml | 0 tasks/{build => src}/ghostty.yml | 0 tasks/{build => src}/go.yml | 0 tasks/{build => src}/lua-language-server.yml | 0 tasks/{build => src}/neovide.yml | 0 tasks/src/neovim.yml | 25 +++++++++ tasks/{build => src}/nerdfonts.yml | 0 tasks/{build => src}/nushell.yml | 0 tasks/{build => src}/zig.yml | 0 tasks/{build => src}/zls.yml | 0 vars/main.yml | 34 ++++-------- 33 files changed, 180 insertions(+), 117 deletions(-) create mode 100644 tasks/appimage/neovim.yml delete mode 100644 tasks/build/neovim.yml rename {vars => tasks/config}/alacritty.yml (100%) rename {vars => tasks/config}/bitwarden.yml (80%) rename {vars => tasks/config}/carapace.yml (100%) rename {vars => tasks/config}/ghostty.yml (100%) rename {vars => tasks/config}/go.yml (100%) rename {vars => tasks/config}/libreoffice.yml (100%) rename {vars => tasks/config}/lua-language-server.yml (100%) rename {vars => tasks/config}/neovide.yml (100%) rename {vars => tasks/config}/neovim.yml (83%) rename {vars => tasks/config}/nerdfonts.yml (100%) rename {vars => tasks/config}/nushell.yml (100%) rename {vars => tasks/config}/rust.yml (100%) rename {vars => tasks/config}/zig.yml (100%) rename {vars => tasks/config}/zls.yml (100%) rename tasks/{build => src}/alacritty.yml (100%) rename tasks/{build => src}/ghostty.yml (100%) rename tasks/{build => src}/go.yml (100%) rename tasks/{build => src}/lua-language-server.yml (100%) rename tasks/{build => src}/neovide.yml (100%) create mode 100644 tasks/src/neovim.yml rename tasks/{build => src}/nerdfonts.yml (100%) rename tasks/{build => src}/nushell.yml (100%) rename tasks/{build => src}/zig.yml (100%) rename tasks/{build => src}/zls.yml (100%) diff --git a/tasks/addpkg.yml b/tasks/addpkg.yml index 1b1ee5b..27b4f2d 100644 --- a/tasks/addpkg.yml +++ b/tasks/addpkg.yml @@ -3,9 +3,23 @@ - name: "Check if task exists for {{ pkg }}" ansible.builtin.stat: path: "{{ role_path }}/tasks/pkgs/{{ pkg }}.yml" - register: cpkg_exists + register: stat_pkg + +- name: "Check if specialized configuration exists for {{ pkg }}" + when: + - stat_pkg.exists + ansible.builtin.stat: + path: "{{ role_path }}/tasks/config/{{ pkg }}.yml" + register: stat_config + +- name: "Load specialized configuration if it exists for {{ pkg }}" + when: + - stat_config.exists + ansible.builtin.include_tasks: + file: "config/{{ pkg }}.yml" - name: "Add include task for {{ pkg }}" - when: cpkg_exists.exists + when: + - stat_pkg.exists ansible.builtin.include_tasks: file: "pkgs/{{ pkg }}.yml" diff --git a/tasks/appimage/bitwarden.yml b/tasks/appimage/bitwarden.yml index 36cc24e..a2b8b5d 100644 --- a/tasks/appimage/bitwarden.yml +++ b/tasks/appimage/bitwarden.yml @@ -10,7 +10,7 @@ ansible.builtin.file: state: directory mode: '0755' - path: "{{ bw_instdir }}" + path: "{{ apimage_pfx }}/bitwarden" owner: "{{ bw_owner }}" group: "{{ bw_group }}" @@ -19,13 +19,13 @@ mode: '0755' decompress: false backup: true - url: bw_appimg.url - dest: "{{ bw_instdir }}/{{ bw_appimg.name }}" + url: "{{ bw.appimg.url }}" + dest: "{{ appimage_pfx }}/{{ bw.appimg.name }}" owner: "{{ bw_owner }}" group: "{{ bw_group }}" - name: Link bitwarden appimage ansible.builtin.file: state: link - src: "{{ bw_instdir }}/{{ bw_appimg.name }}" - path: "{{ bw_instpfx }}/bin/bitwarden" + src: "{{ appimage_pfx }}/{{ bw.appimg.name }}" + path: "{{ bw.bindir }}/bitwarden" diff --git a/tasks/appimage/neovim.yml b/tasks/appimage/neovim.yml new file mode 100644 index 0000000..4b6b623 --- /dev/null +++ b/tasks/appimage/neovim.yml @@ -0,0 +1,29 @@ +# vim: set filetype=yaml.ansible : +--- +- name: Install neovim appimage + become: true + block: + - name: Create install dir + ansible.builin.file: + state: directory + mode: "0755" + path: "{{ nvim.instdir }}" + owner: "{{ pkgconfig_neovim.owner }}" + group: "{{ pkgconfig_neovim.group }}" + + - name: Get neovim appimage + ansible.builtin.get_url: + mode: "0755" + decompress: false + backup: true + url: "{{ pkgconfig_neovim.appimage_url_pfx }}/{{ pkgconfig_neovim.version }}/nvim.appimage" + checksum: "sha256:{{ pkgconfig_neovim.appimage_url_pfx }}/{{ pkgconfig_neovim.version }}/nvim.appimage.sha256sum" + dest: "{{ pkgconfig_neovim.install_dir }}/nvim.appimage.{{ pkgconfig_neovim.version }}" + owner: "{{ pkgconfig_neovim.owner }}" + group: "{{ pkgconfig_neovim.group }}" + + - name: Link neovim appimage + ansible.builtin.file: + state: link + src: "{{ pkgconfig_neovim.install_dir }}/nvim.appimage.{{ pkgconfig_neovim.version }}" + path: "{{ pkgconfig_neovim.install_prefix }}/bin/nvim" diff --git a/tasks/build/neovim.yml b/tasks/build/neovim.yml deleted file mode 100644 index 2886bb7..0000000 --- a/tasks/build/neovim.yml +++ /dev/null @@ -1,55 +0,0 @@ -# vim: set filetype=yaml.ansible : ---- -- name: build neovim from source - block: - - name: create temp path - ansible.builtin.tempfile: - state: directory - prefix: nvim. - register: d_nvim_tmp - - - name: clone neovim git repository - ansible.builtin.git: - depth: 1 - dest: "{{ d_nvim_tmp.path }}/neovim" - repo: "{{ pkgconfig_neovim.git_repo }}" - version: "{{ pkgconfig_neovim.version }}" - - - name: build and install neovim - ansible.builtin.make: - chdir: "{{ d_nvim_tmp.path }}/neovim" - params: - CMAKE_BUILD_TYPE: "{{ pkgconfig_neovim.build_type }}" - CMAKE_INSTALL_PREFIX: "{{ pkgconfig_neovim.install_prefix }}" - target: install - become: "{{ pkgconfig_neovim.dobecome }}" - become_user: "{% if pkgconfig_neovim.dobecome %}{{ pkgconfig_neovim.owner }}{% else %}~{% endif %}" - when: not pkgconfig_neovim.use_appimage - -- name: install neovim appimage - block: - - ansible.builin.file: - state: directory - mode: "0755" - path: "{{ pkgconfig_neovim.install_dir }}" - owner: "{{ pkgconfig_neovim.owner }}" - group: "{{ pkgconfig_neovim.group }}" - - - ansible.builtin.get_url: - mode: "0755" - decompress: false - backup: true - url: "{{ pkgconfig_neovim.appimage_url_pfx }}/{{ pkgconfig_neovim.version }}/nvim.appimage" - checksum: "sha256:{{ pkgconfig_neovim.appimage_url_pfx }}/{{ pkgconfig_neovim.version }}/nvim.appimage.sha256sum" - dest: "{{ pkgconfig_neovim.install_dir }}/nvim.appimage.{{ pkgconfig_neovim.version }}" - owner: "{{ pkgconfig_neovim.owner }}" - group: "{{ pkgconfig_neovim.group }}" - - - ansible.builtin.file: - state: link - src: "{{ pkgconfig_neovim.install_dir }}/nvim.appimage.{{ pkgconfig_neovim.version }}" - path: "{{ pkgconfig_neovim.install_prefix }}/bin/nvim" - when: - - pkgconfig_neovim.use_appimage - become: "{{ pkgconfig_neovim.dobecome }}" - become_user: "{% if pkgconfig_neovim.dobecome %}{{ pkgconfig_neovim.owner }}{% else %}~{% endif %}" diff --git a/vars/alacritty.yml b/tasks/config/alacritty.yml similarity index 100% rename from vars/alacritty.yml rename to tasks/config/alacritty.yml diff --git a/vars/bitwarden.yml b/tasks/config/bitwarden.yml similarity index 80% rename from vars/bitwarden.yml rename to tasks/config/bitwarden.yml index 8de3209..fc69046 100644 --- a/vars/bitwarden.yml +++ b/tasks/config/bitwarden.yml @@ -1,7 +1,6 @@ # vim: set filetype=yaml.ansible : --- install_prefix: "{{ default_install_prefix }}" -install_dir: /opt/appimage/bitwarden install_method: flatpak dobecome: true owner: root diff --git a/vars/carapace.yml b/tasks/config/carapace.yml similarity index 100% rename from vars/carapace.yml rename to tasks/config/carapace.yml diff --git a/vars/ghostty.yml b/tasks/config/ghostty.yml similarity index 100% rename from vars/ghostty.yml rename to tasks/config/ghostty.yml diff --git a/vars/go.yml b/tasks/config/go.yml similarity index 100% rename from vars/go.yml rename to tasks/config/go.yml diff --git a/vars/libreoffice.yml b/tasks/config/libreoffice.yml similarity index 100% rename from vars/libreoffice.yml rename to tasks/config/libreoffice.yml diff --git a/vars/lua-language-server.yml b/tasks/config/lua-language-server.yml similarity index 100% rename from vars/lua-language-server.yml rename to tasks/config/lua-language-server.yml diff --git a/vars/neovide.yml b/tasks/config/neovide.yml similarity index 100% rename from vars/neovide.yml rename to tasks/config/neovide.yml diff --git a/vars/neovim.yml b/tasks/config/neovim.yml similarity index 83% rename from vars/neovim.yml rename to tasks/config/neovim.yml index 7b9cfd6..4e11e56 100644 --- a/vars/neovim.yml +++ b/tasks/config/neovim.yml @@ -3,8 +3,7 @@ version: v0.10.3 install_prefix: "{{ default_install_prefix }}" install_dir: /opt/nvim -use_appimage: true -use_syspkg: true +install_method: appimage build_type: Release dobecome: true owner: root diff --git a/vars/nerdfonts.yml b/tasks/config/nerdfonts.yml similarity index 100% rename from vars/nerdfonts.yml rename to tasks/config/nerdfonts.yml diff --git a/vars/nushell.yml b/tasks/config/nushell.yml similarity index 100% rename from vars/nushell.yml rename to tasks/config/nushell.yml diff --git a/vars/rust.yml b/tasks/config/rust.yml similarity index 100% rename from vars/rust.yml rename to tasks/config/rust.yml diff --git a/vars/zig.yml b/tasks/config/zig.yml similarity index 100% rename from vars/zig.yml rename to tasks/config/zig.yml diff --git a/vars/zls.yml b/tasks/config/zls.yml similarity index 100% rename from vars/zls.yml rename to tasks/config/zls.yml diff --git a/tasks/main.yml b/tasks/main.yml index 8e41c8a..a298f1e 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,5 +1,24 @@ # vim: set filetype=yaml.ansible : --- +- name: Set installation facts + ansible.builtin.set_fact: + paths: "{% if use_local %}{{ localpaths }}{% else %}{{ syspaths }}{% endif %}" + appimages: [] # appimages to install + cargopkgs: [] # rust packages from cargo + cargoversioned: [] # versioned rust packages from cargo + caskpkgs: [] # homebrew casks + flatpkgs: [] # flatpaks + gopkgs: [] # go applications + npmpkgs: [] # npm commands + pipxpkgs: [] # pipx packages + srcpkgs: [] # packages built from source + syspkgs: [] # system package manager packages + tappkgs: [] # homebrew tap packages + brewtaps: [] # homebrew taps + fpremotes: # flatpak remotes + - name: flathub + url: https://dl.flathub.org/repo/flathub.flatpakrepo + - name: Determine OS and set facts for it block: - name: Set macOS facts @@ -125,7 +144,7 @@ - name: Install srcpkgs ansible.builtin.include_tasks: - file: "build/{{ srcpkg }}.yml" + file: "src/{{ srcpkg }}.yml" loop: "{{ srcpkgs | unique }}" loop_control: loop_var: srcpkg diff --git a/tasks/pkgs/bitwarden.yml b/tasks/pkgs/bitwarden.yml index fea2689..ee91dd8 100644 --- a/tasks/pkgs/bitwarden.yml +++ b/tasks/pkgs/bitwarden.yml @@ -12,14 +12,14 @@ - name: Set bitwarden facts ansible.builtin.set_fact: bw: - appimg: pkgconfig_bitwarden.appimage - become: pkgconfig_bitwarden.dobecome - flatpak: pkgconfig_bitwarden.flatpak - group: pkgconfig_bitwarden.group - instdir: pkgconfig_bitwarden.install_dir - instmtd: pkgconfig_bitwarden.install_method - instpfx: pkgconfig_bitwarden.install_prefix - owner: pkgconfig_bitwarden.owner + appimg: "{{ pkgconfig_bitwarden.appimage }}" + become: "{{ pkgconfig_bitwarden.dobecome }}" + flatpak: "{{ pkgconfig_bitwarden.flatpak }}" + group: "{{ pkgconfig_bitwarden.group }}" + instdir: "{{ pkgconfig_bitwarden.install_dir }}" + instmtd: "{{ pkgconfig_bitwarden.install_method }}" + bindir: "{{ pkgconfig_bitwarden.install_prefix }}/bin" + owner: "{{ pkgconfig_bitwarden.owner }}" - name: Append to flatpkgs when: diff --git a/tasks/pkgs/hashicorp_repo.yml b/tasks/pkgs/hashicorp_repo.yml index 4309599..35534d6 100644 --- a/tasks/pkgs/hashicorp_repo.yml +++ b/tasks/pkgs/hashicorp_repo.yml @@ -1,12 +1,14 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.set_fact: +- name: Set hashicorp flag + ansible.builtin.set_fact: hashicorp: true - name: RedHat repository - when: ansible_os_family == 'RedHat' + when: + - ansible_os_family == 'RedHat' block: - - name: enable hashicorp repo for fedora >=41 + - name: Enable hashicorp repo for fedora >=41 become: true when: - ansible_distribution == 'Fedora' @@ -15,7 +17,7 @@ creates: /etc/yum.repos.d/hashicorp.repo cmd: "dnf config-manager addrepo --from-repofile={{ pkgconfig.hashicorp.Linux.Fedora.repo }}" - - name: enable hashicorp repo for fedora <41 + - name: Enable hashicorp repo for fedora <41 become: true when: - ansible_distribution == 'Fedora' @@ -24,7 +26,7 @@ creates: /etc/yum.repos.d/hashicorp.repo cmd: "dnf config-manager --add-repo {{ pkgconfig.hashicorp.Linux.Fedora.repo }}" - - name: enable hashicorp repo for RHEL like distribution + - name: Enable hashicorp repo for RHEL like distribution become: true when: - ansible_distribution != 'Fedora' @@ -33,21 +35,25 @@ cmd: "dnf config-manager --add-repo {{ pkgconfig.hashicorp.Linux.RedHat.repo }}" - name: Debian based repository - when: ansible_os_family == 'Debian' + when: + - ansible_os_family == 'Debian' block: - - ansible.builtin.tempfile: + - name: Create temporary directory + ansible.builtin.tempfile: state: directory prefix: hashicorp. register: d_hashicorp_tmp - - name: get hashicorp archive gpg key + - name: Get hashicorp archive gpg key ansible.builtin.get_url: dest: "{{ d_hashicorp_tmp.path }}/gpg" url: https://apt.releases.hashicorp.com/gpg + mode: '0644' - - name: install hashicorp archive gpg key + - name: Install hashicorp archive gpg key become: true ansible.builtin.command: + creates: /usr/share/keyrings/hashicorp-archive-keyring.gpg cmd: - gpg - --dearmor @@ -55,13 +61,17 @@ - /usr/share/keyrings/hashicorp-archive-keyring.gpg - "{{ d_hashicorp_tmp.path }}/gpg" - - name: enable hasicorp repo for debian + - name: Enable hasicorp repo for debian ansible.builtin.apt_repository: repo: "{{ pkgconfig.hashicorp.Linux.Debian.repo }}" state: present update_cache: false -- name: enable hashicorp homebrew tap - when: ansible_os_family == 'Darwin' - ansible.builtin.set_fact: - brewtaps: "{{ brewtaps + ['hashicorp/tap'] }}" +- name: MacOS specific configuration + when: + - ansible_distribution == 'MacOSX' + block: + - name: Enable hashicorp homebrew tap + when: ansible_os_family == 'Darwin' + ansible.builtin.set_fact: + brewtaps: "{{ brewtaps + ['hashicorp/tap'] }}" diff --git a/tasks/pkgs/neovim.yml b/tasks/pkgs/neovim.yml index d5553f0..737dd68 100644 --- a/tasks/pkgs/neovim.yml +++ b/tasks/pkgs/neovim.yml @@ -1,17 +1,50 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_vars: +- name: Load neovim config + ansible.builtin.include_vars: file: neovim.yml name: _neovim -- ansible.builtin.set_fact: + +- name: Combine neovim default and user config + ansible.builtin.set_fact: pkgconfig_neovim: "{{ _neovim | ansible.builtin.combine(pkgconfig.neovim) }}" -- name: append neovim to srcpkgs +- name: Set neovim facts ansible.builtin.set_fact: - srcpkgs: "{{ srcpkgs + ['neovim'] }}" - when: not pkgconfig_neovim.use_syspkg + nvim: + appimg: "{{ pkgconfig_neovim.appimage }}" + become: "{{ pkgconfig_neovim.dobecome }}" + bldtype: "{{ pkgconfig_neovim.build_type }}" + group: "{{ pkgconfig_neovim.group }}" + instdir: "{{ pkgconfig_neovim.install_dir }}" + instmtd: "{{ pkgconfig_neovim.install_method }}" + instpfx: "{{ pkgconfig_neovim.install_prefix }}" + owner: "{{ pkgconfig_neovim.owner }}" + ver: "{{ pkgconfig_neovim.version }}" -- name: append neovim to syspkgs +- name: Linux specific install + when: + - ansible_system == 'Linux' + block: + # install system package when on an up to date distro + - name: Append to syspkgs + when: + - (ansible_distribution == 'Fedora') or + (ansible_distribution == 'Ubuntu') + + - name: Append to appimages + when: + - nvim.instmtd == 'appimage' + ansible.builtin.set_fact: + appimages: "{{ appimages + ['neovim'] }}" +- name: Append neovim to syspkgs + when: + - ansible_os_family == 'Darwin' ansible.builtin.set_fact: syspkgs: "{{ syspkgs + ['neovim'] }}" - when: pkgconfig_neovim.use_syspkg + +- name: Append neovim to srcpkgs + when: + - nvim.instmtd == 'source' + ansible.builtin.set_fact: + srcpkgs: "{{ srcpkgs + ['neovim'] }}" diff --git a/tasks/build/alacritty.yml b/tasks/src/alacritty.yml similarity index 100% rename from tasks/build/alacritty.yml rename to tasks/src/alacritty.yml diff --git a/tasks/build/ghostty.yml b/tasks/src/ghostty.yml similarity index 100% rename from tasks/build/ghostty.yml rename to tasks/src/ghostty.yml diff --git a/tasks/build/go.yml b/tasks/src/go.yml similarity index 100% rename from tasks/build/go.yml rename to tasks/src/go.yml diff --git a/tasks/build/lua-language-server.yml b/tasks/src/lua-language-server.yml similarity index 100% rename from tasks/build/lua-language-server.yml rename to tasks/src/lua-language-server.yml diff --git a/tasks/build/neovide.yml b/tasks/src/neovide.yml similarity index 100% rename from tasks/build/neovide.yml rename to tasks/src/neovide.yml diff --git a/tasks/src/neovim.yml b/tasks/src/neovim.yml new file mode 100644 index 0000000..3dc44e9 --- /dev/null +++ b/tasks/src/neovim.yml @@ -0,0 +1,25 @@ +# vim: set filetype=yaml.ansible : +--- +- name: Create temp path + ansible.builtin.tempfile: + state: directory + prefix: nvim. + register: d_nvim_tmp + +- name: Clone neovim git repository + ansible.builtin.git: + depth: 1 + dest: "{{ d_nvim_tmp.path }}/neovim" + repo: "{{ pkgconfig_neovim.git_repo }}" + version: "{{ pkgconfig_neovim.version }}" + +- name: Build and install neovim + ansible.builtin.make: + chdir: "{{ d_nvim_tmp.path }}/neovim" + params: + CMAKE_BUILD_TYPE: "{{ pkgconfig_neovim.build_type }}" + CMAKE_INSTALL_PREFIX: "{{ pkgconfig_neovim.install_prefix }}" + target: install + become: "{{ pkgconfig_neovim.dobecome }}" + become_user: "{% if pkgconfig_neovim.dobecome %}{{ pkgconfig_neovim.owner }}{% else %}~{% endif %}" + when: not pkgconfig_neovim.use_appimage diff --git a/tasks/build/nerdfonts.yml b/tasks/src/nerdfonts.yml similarity index 100% rename from tasks/build/nerdfonts.yml rename to tasks/src/nerdfonts.yml diff --git a/tasks/build/nushell.yml b/tasks/src/nushell.yml similarity index 100% rename from tasks/build/nushell.yml rename to tasks/src/nushell.yml diff --git a/tasks/build/zig.yml b/tasks/src/zig.yml similarity index 100% rename from tasks/build/zig.yml rename to tasks/src/zig.yml diff --git a/tasks/build/zls.yml b/tasks/src/zls.yml similarity index 100% rename from tasks/build/zls.yml rename to tasks/src/zls.yml diff --git a/vars/main.yml b/vars/main.yml index 1f3ac18..90b4ce3 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,30 +1,20 @@ # vim: set filetype=yaml.ansible : # variables used in ansible_role_package --- -default_install_prefix: /usr/local +localpaths: # all localpaths are prefixed with the users $HOME directory + instrall: .local + appimage: .local/appimage + archive: .local/archive + cache: .cache + +syspaths: # if installing at a system level (default) + install: /usr/local # executables get linked to {{ default_install_prefix }}/bin + appimage: /opt/appimage # appimages are installed to {{ apimage_install_prefix }}// + archive: /opt/archive # pre-compiled archives are extracted to {{ archive_install_prefix }}/ + cache: /opt/archive/.cache # download archives here + packages: [] # list of packages to install -# Package install lists -appimages: [] # appimages to install -cargopkgs: [] # rust packages from cargo -cargoversioned: [] # versioned rust packages from cargo -caskpkgs: [] # homebrew casks -flatpkgs: [] # flatpaks -gopkgs: [] # go applications -npmpkgs: [] # npm commands -pipxpkgs: [] # pipx packages -srcpkgs: [] # packages built from source -syspkgs: [] # system package manager packages -tappkgs: [] # homebrew tap packages - -# Package source lists -brewtaps: [] # homebrew taps -fpremotes: # flatpak remotes - - name: flathub - url: https://dl.flathub.org/repo/flathub.flatpakrepo - -# Static package configuration -# this shouldn't be changed by the user pkgconfig: alacritty: build_deps: From 92501451164de13ad3ce4a97110091a262da64af Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Tue, 11 Feb 2025 22:14:04 -0700 Subject: [PATCH 03/38] lot's of standardizing with the refacto --- CONTRIBUTING.md | 57 +++++++ README.md | 199 +++++++++++++++++------ meta/argument_spec.yml | 55 +++---- meta/main.yml | 18 +- tasks/config/alacritty.yml | 13 +- tasks/main.yml | 181 +++++++++++---------- tasks/pkgs/alacritty.yml | 22 +-- tasks/{pkgs => repos}/hashicorp_repo.yml | 0 tasks/src/alacritty.yml | 14 +- vars/main.yml | 34 ++-- 10 files changed, 384 insertions(+), 209 deletions(-) rename tasks/{pkgs => repos}/hashicorp_repo.yml (100%) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a01e8b8..f86a1f1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -50,3 +50,60 @@ of precedence: `syspkgs`, `flatpkgs`, `snappkgs`, `appimages`. In that order, `syspkgs` and `caskpkgs` have equal weight, as it applies to macOS. + +## Formatting rules + +- Use indentation explicitness. Lists should be indented: + +```yaml +# Good +my_good_list: + - my_list_item + +# Bad +my_bad_list: +- my_list_item +``` + +- Variables should be in snake case, separating words +- Short names are fine if they are explicit. ie `vers` can be used instead of `version` +- If more then one variable starts with the same words, put it into a dict if it makes sense: + +```yaml +# variables that should be a dict +cargo_locked: true +cargo_pkg: alacritty + +# better to just be +cargo: + locked: true + pkg: alacritty +``` +- Tasks **MUST** follow the convention in this example: + +```yaml +- name: Capitalize first letter of name + when: + - each condition has it's own line + - (brackets around conditions with) or + (to show they are separate) + become: "{{ not use_local }}" # must be able to be used with use_local + become_user: # this should not be needed, but always follows become if it is + loop: "{{ my_loopable_list }}" + loop_control: # **MUST** always use at least loop_var for any loop + loop_var: my_item + ansible.builtin.set_fact: # always use the full module name + ... +``` + +- `name`: Every task needs a name, and the first letter must be capitalized +- `when`: If a when clause exists, it follows the name + - Each clause must have it's own line, including and `or` clause, as seen above +- `become`: must follow the when clause if it exists, name otherwise + - Any other `become_` settings follow `become` in alphabetical order +- `loop`: must be defined just before the module invocation + - Every loop needs to rename the `loop_var` to something that makes sense + - `until` is consider the same as `loop` for the purposes of placement +- The last item must be the module invocation, using the fully qualified name + - For example, don't use `set_fact:`, use `ansible.builtin.set_fact:` + diff --git a/README.md b/README.md index e4bf622..8b75507 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -Role Name -========= +# ansible_role_package Manage package installation for a number of packages that sometimes need special handling. Some are built from @@ -11,60 +10,162 @@ special instructions to properly install and use. I decided to simplify the management of those packages by creating a role with special handling. -Included packages: +Order of precedence for package installation: -- Desktop applications: alacritty, firefox, ghostty, kitty, neovide -- Shell applications: btop, carapace, nushell, fzf, jq, neovim, pipx, ripgrep, - stow, tmux, zoxide -- Infrastructure applications: ansible, consul, nomad, packer, terraform -- Development tools: cmake, git, go, nodejs, hugo, rust, tidy -- Misc: editorconfig, hashicorp package repository, nerdfonts, pandoc, - pytho3-pip, terra repository for fedora, zfs -- Cargo packages: dotenv-linter, eza, htmx-lsp, starship -- Go packages: air, buf, checkmake, glow, lazygit, revive, templ, gopls -- NPM packages: ansible-language-server, commitlint-cli, - commitlint-config-conventional, markdownlint-cli, quobix-vacuum, - tailwindcss-languageserver -- Pipx packages: cmakelang, sqlfluff +1. System package manager (dnf, apt, homebrew, etc.) +2. Appimage (Linux only) +3. Flatpak (Linux only) +4. Snap (Linux only), takes precedence over flatpak on Ubuntu based systems +5. Language package manager (`cargo install`, `go install`, `npm install`, etc.) +6. Build and install from source -Requirements ------------- +_This does not configure installed software, just installs it_ + +## Available Packages + +- air +- alacritty +- ansible-language-server +- ansible-lint +- ansible +- bashls +- bat +- bitwarden +- blender +- broot +- btop +- buf +- bufls +- carapace +- cheat +- checkmake +- choose +- clangd +- cmake +- cmakelang +- commitlint-cli +- commitlint-config-conventional +- consul +- cssls +- curlie +- dbeaver +- dockerls +- dotenv-linter +- duf +- dust +- editorconfig +- eslint +- eza +- fd +- firefox +- flatpak +- fzf +- ghostty +- git +- glow +- go +- godot +- gopls +- gping +- heroic +- htmlls +- htmx-lsp +- httpie +- hugo +- hyperfine +- intelephense +- jinja-lsp +- jq +- jsonls +- kitty +- lazygit +- libreoffice +- lua-language-server +- markdownlint-cli +- mcfly +- neovide +- neovim +- nerdfonts +- nextcloud +- nginxls +- nodejs +- nomad +- nushell +- packer +- pandoc +- pgadmin +- pipx +- podman +- pyright +- python3-pip +- quobix-vacuum +- revive +- ripgrep +- rust +- sd +- sqlfluff +- sqlls +- starship +- stow +- tailscale +- tailwindcss-languageserver +- templ +- terra_repo +- terraform +- terraformls +- thunderbird +- tidy +- tldr +- tmux +- vault +- xh +- yamlls +- zfs +- zig +- zls +- zoxide +- zsh + +## Requirements + +- + +## Role Variables + +- `use_local`: Boolean, default `true` + - When `true`, uses the following paths: + - `$HOME/.local` as the install prefix, placing binaries in `$HOME/.local/bin` + - `$HOME/.local/appimage` for saved appimages, which are then linked to `$HOME/.local/bin` + - `$HOME/.local/archive` for extracted archives linking binaries to `$HOME/.local/bin` + - `$HOME/.cache` for caching downloads + - `$HOME/.cargo` for cargo installations, placing binaries in `$HOME/.cargo/bin` + - When `false`, uses the following system wide paths: + - `/usr/local` as the install prefix, placing binaries in `/usr/local/bin` + - `/opt/appimage` for saved appimages, which are then linked to `/usr/local/bin` + - `/opt/archive` for extracted archives, linking binaries to `/usr/local/bin` + - `/opt/cache` for caching downloads + - `/opt/cargo` for rust cargo installations, placing binaries in `/opt/cargo/bin` +- `packages`: List of strings + - List of packages to install from the `Available Packages` list +- `prefer_method`: String, default `system` + - The preferred method of installation an application when multiple options exist + - Valid options are: + - `flatpak` - Flatpak, Linux only + - `langtool` - Using language tools such as `cargo`, `go`, `npm` or `pipx` + - `snap` - Snap, Linux only + - `source` - Prefer building from source. **Not recommended** + - `system` - Default, system package manager (dnf, apt, homebrew, etc.) + +## Dependencies -Role Variables --------------- - -- packages: - - List of packages to install -- assume_missing_is_syspkg: - - Bool. Default `true` - - Handle non-supported packages as package manager packages -- full_upgrade: - - Bool. Default `false` - - Do a full package upgrade first if `true` -- install_state: - - String. Default `present` - - Set to `latest` to update packages - - Set to `absent` to remove packages - - *currently only supports remove package manager installed packages* - - Valid choices: `present`, `latest`, `absent` -- pkgconfig: - - specific configuration for individual packages - -Dependencies ------------- +## Example Playbook -Example Playbook ----------------- - - -License -------- +## License MIT -Author Information ------------------- +## Author Information -- Matthew Stobbs +- Matthew Stobbs diff --git a/meta/argument_spec.yml b/meta/argument_spec.yml index 6aa26e5..1b573af 100644 --- a/meta/argument_spec.yml +++ b/meta/argument_spec.yml @@ -1,43 +1,40 @@ --- argument_specs: main: - short_description: install software easily + short_description: Install software using ansible description: - Make the installation of packages consistent on each platform. - - Installs for RedHat, Debian or Darwin based systems. + - Installs for RedHat, Debian and MacOS based systems. author: - Matthew Stobbs options: + use_local: + type: bool + default: true + required: false + description: + Install packages using the current users + `$HOME/.local` directory as the install prefix. + + WHen `false`, uses the system wide `/usr/local` + as the install prefix, and stores other parts + (appimages, extracted archives, cache) in the + appropriate path starting with `/opt`. packages: - type: "list" - elements: "str" + type: list + elements: str required: true description: | The list of packages to install by name. - syspkglist: - type: "list" - elements: "str" + The list must contain only values that exist in + `Available Packages` in `README.md` + prefer_method: + type: str required: false - description: | - Additional packages to install via the system - default package manager. Is combined with the - completed list of packages to install. - Only use this if you a package isn't available to the role. - install_state: - type: "str" + default: system choices: - - "present" - - "latest" - - "absent" - required: false - default: present - description: | - Desired state of the packages to install. - full_upgrade: - type: "bool" - required: false - default: false - description: | - Do a full system upgrade before installing - additional packages. This does not handle - rebooting a machine that has been upgraded. + - flatpak + - langtool + - snap + - source + - system diff --git a/meta/main.yml b/meta/main.yml index 53c5bd6..ca8f837 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -7,20 +7,20 @@ galaxy_info: # issue_tracker_url: http://example.com/issue/tracker license: MIT - min_ansible_version: 3.0 + min_ansible_version: "3.0" platforms: - name: Fedora versions: - all - - 40+ - - name: Enterprise Linux 9 (RHEL, rocky alma) + - "40" + - "41" + - name: EL versions: - - 9.4 - - 9.5 + - "9" - name: macOS version: - - 14.2+ + - ">=14.2" galaxy_tags: - linux @@ -28,6 +28,6 @@ galaxy_info: - package - software -dependencies: [] - # List your role dependencies here, one per line. Be sure to remove the '[]' above, - # if you add dependencies to this list. +dependencies: + - ansible.builtin + - community.general diff --git a/tasks/config/alacritty.yml b/tasks/config/alacritty.yml index 6aab3ff..3b8e511 100644 --- a/tasks/config/alacritty.yml +++ b/tasks/config/alacritty.yml @@ -1,4 +1,13 @@ # vim: set filetype=yaml.ansible : --- -version: 0.15.0 -install_prefix: "{{ default_install_prefix }}" +- name: Set alacritty configuration + ansible.builtin.set_fact: + alacritty: + deps: "{{ pkgconfig.alacritty[ansible_os_family].build_deps }}" + ver: "{{ pkgconfig.alacritty.version }}" + repo: "{{ pkgconfig.alacritty.git_repo }}" + pkgs: "{{ pkgconfig.alacritty[ansible_os_family].pkgs | default(omit) }}" + bin: "{{ paths.install }}/bin/alacritty" + cargo: + locked: true + pkg: alacritty diff --git a/tasks/main.yml b/tasks/main.yml index a298f1e..36be2ee 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,35 +1,56 @@ # vim: set filetype=yaml.ansible : --- +# create all the facts used throughout the role, but shouldn't be touched +# by the user - name: Set installation facts ansible.builtin.set_fact: - paths: "{% if use_local %}{{ localpaths }}{% else %}{{ syspaths }}{% endif %}" - appimages: [] # appimages to install - cargopkgs: [] # rust packages from cargo - cargoversioned: [] # versioned rust packages from cargo - caskpkgs: [] # homebrew casks - flatpkgs: [] # flatpaks - gopkgs: [] # go applications - npmpkgs: [] # npm commands - pipxpkgs: [] # pipx packages - srcpkgs: [] # packages built from source - syspkgs: [] # system package manager packages - tappkgs: [] # homebrew tap packages - brewtaps: [] # homebrew taps - fpremotes: # flatpak remotes + app_images: [] # app_images to install + cargo_pkgs: [] # rust packages from cargo + cask_pkgs: [] # homebrew casks + flatpaks: [] # flatpaks + go_pkgs: [] # go applications + npm_pkgs: [] # npm commands + pipx_pkgs: [] # pipx packages + src_pkgs: [] # packages built from source + sys_pkgs: [] # system package manager packages + tap_pkgs: [] # homebrew tap packages + brew_taps: [] # homebrew taps + flatpak_remotes: # flatpak remotes, includes flathub by default - 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 block: - name: Set macOS facts when: ansible_os_family == 'Darwin' ansible.builtin.set_fact: - syspkg_become: false + sys_pkg_become: false - name: Set Linux facts when: ansible_system == 'Linux' ansible.builtin.set_fact: - syspkg_become: true + sys_pkg_become: true - name: Generate package installation lists ansible.builtin.include_tasks: @@ -38,10 +59,10 @@ loop_control: loop_var: pkg -- name: Install syspkgs list - become: "{{ syspkg_become }}" +- name: Install sys_pkgs list + become: "{{ sys_pkg_become }}" ansible.builtin.package: - name: "{{ syspkgs | unique }}" + name: "{{ sys_pkgs | unique }}" state: present - name: Redhat based OS @@ -50,9 +71,9 @@ - name: Install dnf packages become: true when: - - syspkgs|length > 0 + - sys_pkgs|length > 0 ansible.builtin.dnf: - name: "{{ syspkgs | unique }}" + name: "{{ sys_pkgs | unique }}" state: present - name: Debian based OS @@ -60,11 +81,11 @@ block: - name: Install apt packages ansible.builtin.apt: - name: "{{ syspkgs | unique }}" + name: "{{ sys_pkgs | unique }}" state: "{{ install_state }}" become: true when: - - syspkgs|length > 0 + - sys_pkgs|length > 0 - name: Darwin/macOS based OS when: ansible_os_family == 'Darwin' @@ -77,62 +98,62 @@ - name: Tap homebrew taps community.general.homebrew_tap: - name: "{{ brewtaps | unique }}" + name: "{{ brew_taps | unique }}" state: present - when: brewtaps|length > 0 + when: brew_taps|length > 0 - name: Install homebrew packages community.general.homebrew: - name: "{{ syspkgs | unique }}" + name: "{{ sys_pkgs | unique }}" state: "{{ install_state }}" - when: syspkgs|length > 0 + when: sys_pkgs|length > 0 - name: Install homebrew casks community.general.homebrew_cask: - name: "{{ caskpkgs | unique }}" + name: "{{ cask_pkgs | unique }}" state: "{{ install_state }}" - when: caskpkgs|length > 0 + when: cask_pkgs|length > 0 - name: Workaround to install homebrew taps ansible.builtin.command: - cmd: "brew install {{ tappkg }}" - loop: "{{ tappkgs | unique }}" + cmd: "brew install {{ tap_pkg }}" + loop: "{{ tap_pkgs | unique }}" loop_control: - loop_var: tappkg + loop_var: tap_pkg # TODO: fix the need to have this workaround - name: Install flatpaks on Linux Systems when: - ansible_system == 'Linux' - - flatpkgs|length > 0 + - flatpaks|length > 0 block: - name: Add flatpak repos - become: true - loop: "{{ fpremotes | unique }}" + when: + - flatpak_remotes|length > 0 + - flatpaks|length > 0 + become: "{{ not use_local }}" + loop: "{{ flatpak_remotes | unique }}" loop_control: loop_var: remote - when: - - fpremotes|length > 0 - - flatpkgs|length > 0 community.general.flatpak_remote: enabled: true - method: system + method: "{{ flatpak_method }}" state: present flatpakrepo_url: "{{ remote.url }}" name: "{{ remote.name }}" - name: Install flatpaks become: true - loop: "{{ flatpkgs | unique }}" + loop: "{{ flatpaks | unique }}" loop_control: - loop_var: flatpkg + loop_var: flatpak when: - - flatpkgs|length > 0 + - flatpaks|length > 0 community.general.flatpak: state: latest - method: system - name: "{{ flatpkg.name }}" - remote: "{{ flatpkg.remote | default('flathub') }}" + method: "{{ flatpak_method }}" + name: "{{ flatpak.name }}" + remote: "{{ flatpak.remote | default('flathub') }}" - name: Ensure /usr/local/bin exists ansible.builtin.file: @@ -142,64 +163,56 @@ mode: '0755' become: true -- name: Install srcpkgs +- name: Install src_pkgs ansible.builtin.include_tasks: - file: "src/{{ srcpkg }}.yml" - loop: "{{ srcpkgs | unique }}" + file: "src/{{ src_pkg }}.yml" + loop: "{{ src_pkgs | unique }}" loop_control: - loop_var: srcpkg - when: srcpkgs|length > 0 + loop_var: src_pkg + when: src_pkgs|length > 0 - name: Install cargo packages at specific version - community.general.cargo: - name: "{{ cargopkg.name }}" - version: "{{ cargopkg.version }}" - path: "{{ cargopkg.path | default(default_install_prefix) }}" - locked: "{{ cargopkg.locked | default(false) }}" - become: true - when: cargoversioned|length > 0 - loop: "{{ cargoversioned | unique }}" + when: + - cargo_pkgs|length > 0 + become: "{{ not use_local }}" + loop: "{{ cargo_pkgs | unique }}" loop_control: - loop_var: cargopkg - -- name: Install cargo packages at latest version + loop_var: cargo_pkg community.general.cargo: - name: "{{ cargopkg }}" - state: latest - locked: "{{ cargopkg.locked | default(false) }}" - when: cargopkgs|length > 0 - loop: "{{ cargopkgs | unique }}" - loop_control: - loop_var: cargopkg + name: "{{ cargo_pkg.cargo.pkg }}" + version: "{{ cargo_pkg.ver }}" + path: "{{ paths.cargo }}" + locked: "{{ cargo_pkg.cargo.locked }}" - name: Install local go packages - loop: "{{ gopkgs | unique }}" + when: + - go_pkgs|length > 0 + loop: "{{ go_pkgs | unique }}" loop_control: - loop_var: gopkg - when: gopkgs|length > 0 + loop_var: go_pkg environment: - GOROOT: /usr/local/go - PATH: /usr/local/go/bin:$PATH + GOROOT: "{{ paths.install }}/go" + PATH: "{{ paths.install }}/go/bin:$PATH" ansible.builtin.command: - cmd: "go install {{ gopkg }}" - #TODO: figure out how to check if the gopkg is already installed + cmd: "go install {{ go_pkg }}" + # TODO: figure out how to check if the go_pkg is already installed - name: Install local npm packages - loop: "{{ npmpkgs | unique }}" + loop: "{{ npm_pkgs | unique }}" loop_control: - loop_var: npmpkg - when: npmpkgs|length > 0 + loop_var: npm_pkg + when: npm_pkgs|length > 0 community.general.npm: global: true - name: "{{ npmpkg }}" + name: "{{ npm_pkg }}" state: latest - name: Install python pipx packages for user - loop: "{{ pipxpkgs | unique }}" + loop: "{{ pipx_pkgs | unique }}" loop_control: - loop_var: pipxpkg - when: pipxpkgs|length > 0 + loop_var: pipx_pkg + when: pipx_pkgs|length > 0 community.general.pipx: - executable: "{% if ansible_os_family == 'Darwin' %}/opt/homebrew/bin/pipx{% else %}/usr/bin/pipx{% endif %}" - name: "{{ pipxpkg }}" + executable: "{{ pipx_exec }}" + name: "{{ pipx_pkg }}" state: latest diff --git a/tasks/pkgs/alacritty.yml b/tasks/pkgs/alacritty.yml index b5f7f08..8567896 100644 --- a/tasks/pkgs/alacritty.yml +++ b/tasks/pkgs/alacritty.yml @@ -1,25 +1,19 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_vars: - file: alacritty.yml - name: _alacritty -- ansible.builtin.set_fact: - pkgconfig_alacritty: "{{ _alacritty | ansible.builtin.combine(pkgconfig.alacritty) }}" - -- name: linux based installation +- name: Linux based installation when: ansible_system == 'Linux' block: - - name: install rust and cargo + - name: Install rust and cargo ansible.builtin.include_tasks: file: "pkgs/rust.yml" when: pkgconfig_rust is undefined - - name: append to pkgs - set_fact: - syspkgs: "{{ syspkgs + pkgconfig_alacritty.deps[ansible_distribution] }}" - srcpkgs: "{{ srcpkgs + [ 'alacritty' ] }}" + - name: Append to pkgs + ansible.builtin.set_fact: + syspkgs: "{{ syspkgs + alacritty.deps }}" + srcpkgs: "{{ cargopkgs + [alacritty] }}" -- name: append alacritty to caskpkgs +- name: Append alacritty to caskpkgs ansible.builtin.set_fact: - caskpkgs: "{{ caskpkgs + [ 'alacritty' ] }}" + caskpkgs: "{{ caskpkgs + alacritty.pkgs }}" when: ansible_system == 'Darwin' diff --git a/tasks/pkgs/hashicorp_repo.yml b/tasks/repos/hashicorp_repo.yml similarity index 100% rename from tasks/pkgs/hashicorp_repo.yml rename to tasks/repos/hashicorp_repo.yml diff --git a/tasks/src/alacritty.yml b/tasks/src/alacritty.yml index bedb5cc..afb3015 100644 --- a/tasks/src/alacritty.yml +++ b/tasks/src/alacritty.yml @@ -1,15 +1,7 @@ # vim: set filetype=yaml.ansible : --- - name: Build and install alacritty - become: true + become: "{{ not use_local }}" ansible.builtin.command: - creates: "{{ pkgconfig_alacritty.install_prefix }}/bin/alacritty" - cmd: - - cargo - - install - - --root - - "{{ pkgconfig_alacritty.install_prefix }}" - - --git - - "{{ pkgconfig_alacritty.git_repo }}" - - --tag - - "v{{ pkgconfig_alacritty.version }}" + creates: "{{ alacritty.bin }}" + cmd: "cargo install --root {{ paths.cargo }} alacritty@{{ alacritty.ver }}" diff --git a/vars/main.yml b/vars/main.yml index 90b4ce3..87014b7 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,31 +1,40 @@ # vim: set filetype=yaml.ansible : # variables used in ansible_role_package --- -localpaths: # all localpaths are prefixed with the users $HOME directory - instrall: .local - appimage: .local/appimage - archive: .local/archive - cache: .cache +use_local: true +prefer_method: system +packages: [] # list of packages to install -syspaths: # if installing at a system level (default) - install: /usr/local # executables get linked to {{ default_install_prefix }}/bin +local_paths: # all localpaths are prefixed with the users $HOME directory + appimage: .local/appimage # keep appimages here + archive: .local/archive # extract archives here + cache: .cache # cache downloads here + cargo: .cargo # cargo install location + install: .local # installation prefix. Binaries are placed in `{{ install }}/bin` + +sys_paths: # if installing at a system level (default) appimage: /opt/appimage # appimages are installed to {{ apimage_install_prefix }}// archive: /opt/archive # pre-compiled archives are extracted to {{ archive_install_prefix }}/ cache: /opt/archive/.cache # download archives here + cargo: /opt/cargo # cargo install location + install: /usr/local # executables get linked to {{ default_install_prefix }}/bin -packages: [] # list of packages to install pkgconfig: alacritty: - build_deps: - RedHat: + version: 0.15.0 + RedHat: + pkgs: [] + build_deps: - cmake - freetype-devel - fontconfig-devel - libxcb-devel - libxkbcommon-devel - g++ - Debian: + Debian: + pkgs: [] + build_deps: - cmake - pkg-config - libfreetype6-dev @@ -33,6 +42,9 @@ pkgconfig: - libxcb-xfixes0-dev - libxkbcommon-dev - python3 + Darwin: + pkgs: + - alacritty git_repo: https://github.com/alacritty/alacritty.git bitwarden: flatpak: From a3df5215b82a17fea223d73bc8c07c18f9f73244 Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Wed, 12 Feb 2025 12:52:55 -0700 Subject: [PATCH 04/38] reorganizing configuration - static package configuration in `vars/pkgs` - loaded into the variable `pkgconfig` as part of `tasks/main.yml` --- handlers/main.yml | 7 +- tasks/config/air.yml | 7 ++ tasks/config/go.yml | 22 +++++- tasks/main.yml | 69 +++++++++++------ tasks/pkgs/air.yml | 10 +-- tasks/pkgs/go.yml | 10 +-- tasks/src/go.yml | 54 +++++-------- vars/main.yml | 159 ++------------------------------------ vars/pkgs/air.yml | 3 + vars/pkgs/alacritty.yml | 25 ++++++ vars/pkgs/bitwarden.yml | 7 ++ vars/pkgs/broot.yml | 10 +++ vars/pkgs/carapace.yml | 6 ++ vars/pkgs/clangd.yml | 8 ++ vars/pkgs/consul.yml | 3 + vars/pkgs/fd.yml | 8 ++ vars/pkgs/ghostty.yml | 9 +++ vars/pkgs/git.yml | 12 +++ vars/pkgs/go.yml | 25 ++++++ vars/pkgs/hashicorp.yml | 8 ++ vars/pkgs/kitty.yml | 7 ++ vars/pkgs/libreoffice.yml | 7 ++ vars/pkgs/luals.yml | 9 +++ 23 files changed, 259 insertions(+), 226 deletions(-) create mode 100644 tasks/config/air.yml create mode 100644 vars/pkgs/air.yml create mode 100644 vars/pkgs/alacritty.yml create mode 100644 vars/pkgs/bitwarden.yml create mode 100644 vars/pkgs/broot.yml create mode 100644 vars/pkgs/carapace.yml create mode 100644 vars/pkgs/clangd.yml create mode 100644 vars/pkgs/consul.yml create mode 100644 vars/pkgs/fd.yml create mode 100644 vars/pkgs/ghostty.yml create mode 100644 vars/pkgs/git.yml create mode 100644 vars/pkgs/go.yml create mode 100644 vars/pkgs/hashicorp.yml create mode 100644 vars/pkgs/kitty.yml create mode 100644 vars/pkgs/libreoffice.yml create mode 100644 vars/pkgs/luals.yml diff --git a/handlers/main.yml b/handlers/main.yml index a845a14..cfe3e7b 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,2 +1,7 @@ +# vim: set filetype=yaml.ansible : --- -# handlers file for ansible_role_package +- name: Depend go + ansible.builtin.include_tasks: + file: addpkg.yml + vars: + pkg: go diff --git a/tasks/config/air.yml b/tasks/config/air.yml new file mode 100644 index 0000000..2b248d5 --- /dev/null +++ b/tasks/config/air.yml @@ -0,0 +1,7 @@ +# vim: set filetype=yaml.ansible : +--- +- name: Set configuration for air + ansible.builtin.set_fact: + air: + ver: "{{ pkgconfig.air.version }}" + pkg: "{{ pkgconfig.air.git_repo }}@{{ pkgconfig.air.version }}" diff --git a/tasks/config/go.yml b/tasks/config/go.yml index 1864748..bdb83a6 100644 --- a/tasks/config/go.yml +++ b/tasks/config/go.yml @@ -1,4 +1,22 @@ # vim: set filetype=yaml.ansible : --- -version: 1.23.6 -install_path: "{{ default_install_prefix }}" +- name: Set go configuration + ansible.builtin.set_fact: + do_install_go: false # defaults to false to save on having to set facts needlessly + go: + ver: "{{ pkgconfig.go.version }}" + arch: "{{ pkgconfig_go.archmap[ansible_architecture] }}" + sys: "{{ ansible_system | lower }}" + ext: "{{ pkgconfig.go.extmap[ansible_system] }}" + +- name: Set go composite facts + ansible.builtin.set_fact: + go: + ver: "{{ go.ver }}" + arch: "{{ go.arch }}" + sys: "{{ go.sys }}" + ext: "{{ go.ext }}" + archive: "go{{ go.ver }}.{{ go.sys }}-{{ go.arch }}.{{ pkgconfig_go.extmap[ansible_system] }}" + sum: "{{ pkgconfig.go.sums[go.ver][ansible_system][go.arch] }}" + url: "{{ pkgconfig.go.base_url }}/{{ go.archive }}" + inst_path: "{{ paths.install }}/go" diff --git a/tasks/main.yml b/tasks/main.yml index 36be2ee..0076746 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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 diff --git a/tasks/pkgs/air.yml b/tasks/pkgs/air.yml index ebcba5c..7922156 100644 --- a/tasks/pkgs/air.yml +++ b/tasks/pkgs/air.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: pkgs/go.yml - when: pkgconfig_go is undefined - -- name: add to gopkgs +- name: Add to go_pkgs + notify: + - Depend go ansible.builtin.set_fact: - gopkgs: "{{ gopkgs + ['github.com/air-verse/air@latest'] }}" + go_pkgs: "{{ go_pkgs + [air.pkg] }}" diff --git a/tasks/pkgs/go.yml b/tasks/pkgs/go.yml index 4526285..8032ca2 100644 --- a/tasks/pkgs/go.yml +++ b/tasks/pkgs/go.yml @@ -1,11 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_vars: - file: go.yml - name: _go -- ansible.builtin.set_fact: - pkgconfig_go: "{{ _go | ansible.builtin.combine(pkgconfig.go) }}" - -- name: append to pkgs +- name: Append to pkgs ansible.builtin.set_fact: - srcpkgs: "{{ srcpkgs + [ 'go' ] }}" + src_pkgs: "{{ src_pkgs + ['go'] }}" diff --git a/tasks/src/go.yml b/tasks/src/go.yml index 598837e..855a715 100644 --- a/tasks/src/go.yml +++ b/tasks/src/go.yml @@ -1,52 +1,40 @@ # vim: set filetype=yaml.ansible : --- -- name: check go version - ansible.builtin.command: - cmd: "go version" - register: r_go_version - ignore_errors: true +- name: Check if archive already exists + ansible.builtin.stat: + path: "{{ paths.archive }}/{{ go_archive }}" + register: stat_go_archive -- name: install/update go +- name: Install/update go + when: + - not stat_go_archive.exists block: - - name: set go arch - ansible.builtin.set_fact: - arch: "{{ pkgconfig_go.archmap[ansible_architecture] }}" - - - name: set go archive filename - ansible.builtin.set_fact: - go_archive: "go{{ pkgconfig_go.version }}.{{ ansible_system | lower }}-{{ arch }}.{{ pkgconfig_go.extmap[ansible_system] }}" - - - name: create temp path - ansible.builtin.tempfile: - state: directory - prefix: go_dl. - register: d_go_dl_tmp - - - name: download go archive - become: true + - name: Download go archive + become: "{{ sys_pkg_become }}" ansible.builtin.get_url: - dest: "{{ d_go_dl_tmp.path }}/{{ go_archive }}" - url: "https://go.dev/dl/{{ go_archive }}" - checksum: "{{ pkgconfig_go.sums[pkgconfig_go.version][ansible_system][arch] }}" + dest: "{{ paths.cache }}/{{ go_archive }}" + url: "{{ go.url }}" + checksum: "{{ go.sum }}" decompress: false + mode: '0644' - - name: ensure go install dir exists - become: true + - name: Ensure go install dir exists + become: "{{ sys_pkg_become }}" ansible.builtin.file: - path: "{{ pkgconfig_go.install_path }}" + path: "{{ go.inst_path }}" state: directory + mode: '0755' - - name: extract go package + - name: Extract go package + become: "{{ sys_pkg_become }}" ansible.builtin.unarchive: - dest: "{{ pkgconfig_go.install_path }}" + dest: "{{ paths.archive }}/go" src: "{{ d_go_dl_tmp.path }}/{{ go_archive }}" remote_src: true when: ansible_system == 'Linux' - become: true - - name: install go macOS use pkg file + - name: Install go macOS use pkg file ansible.builtin.command: cmd: "installer -pkg {{ d_go_dl_tmp.path }}/{{ go_archive }} -target /" when: ansible_system == 'Darwin' become: true - when: pkgconfig_go.version not in r_go_version.stdout diff --git a/vars/main.yml b/vars/main.yml index 87014b7..d244cb8 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -5,12 +5,14 @@ use_local: true prefer_method: system packages: [] # list of packages to install -local_paths: # all localpaths are prefixed with the users $HOME directory - appimage: .local/appimage # keep appimages here - archive: .local/archive # extract archives here - cache: .cache # cache downloads here - cargo: .cargo # cargo install location - install: .local # installation prefix. Binaries are placed in `{{ install }}/bin` +user_home: "{{ lookup(ansible.builtin.env, 'HOME') }}" + +local_paths: # all localpaths are prefixed with the users "{{ user_home }} directory + appimage: "{{ user_home }}/.local/appimage" # keep appimages here + archive: "{{ user_home }}/.local/archive" # extract archives here + cache: "{{ user_home }}/.cache" # cache downloads here + cargo: "{{ user_home }}/.cargo" # cargo install location + install: "{{ user_home }}/.local" # installation prefix. Binaries are placed in `{{ install }}/bin` sys_paths: # if installing at a system level (default) appimage: /opt/appimage # appimages are installed to {{ apimage_install_prefix }}// @@ -19,152 +21,7 @@ sys_paths: # if installing at a system level (default) cargo: /opt/cargo # cargo install location install: /usr/local # executables get linked to {{ default_install_prefix }}/bin - pkgconfig: - alacritty: - version: 0.15.0 - RedHat: - pkgs: [] - build_deps: - - cmake - - freetype-devel - - fontconfig-devel - - libxcb-devel - - libxkbcommon-devel - - g++ - Debian: - pkgs: [] - build_deps: - - cmake - - pkg-config - - libfreetype6-dev - - libfontconfig1-dev - - libxcb-xfixes0-dev - - libxkbcommon-dev - - python3 - Darwin: - pkgs: - - alacritty - git_repo: https://github.com/alacritty/alacritty.git - bitwarden: - flatpak: - name: com.bitwarden.desktop - remote: flathub - appimage: - name: bitwarden.appimage - url: https://vault.bitwarden.com/download/?app=desktop&platform=linux&variant=appimage - broot: - build_deps: - Debian: - - build-essential - - libxcb1-dev - - libxcb-render0-dev - - libxcb-shape0-dev - - libxcb-xfixes0-dev - RedHat: - - libxcb - carapace: - pkgs: - Linux: - - carapace-bin - Darwin: - - carapace - clangd: - pkgs: - RedHat: - - clang-devel - Debian: - - clangd-12 - Darwin: - - llvm - consul: - Linux: consul - Darwin: hashicorp/tap/consul - fd: - pkg: - Darwin: - - fd - RedHat: - - fd-find - Debian: - - fd-find - flatpak: {} - ghostty: - build_deps: - Debian: - - libgtk-4-dev - - libadwaita-1-dev - RedHat: - - gtk4-devel - - libadwaita-devel - git_repo: https://github.com/ghostty-org/ghostty - git: - pkgs: - Darwin: - - git - - git-delta - - git-extras - - git-lfs - Linux: - - git - - git-delta - - git-email - - git-lfs - go: - archmap: - arm64: arm64 - aarch64: arm64 - x86_64: amd64 - extmap: - Darwin: pkg - Linux: tar.gz - sums: - 1.23.6: - Darwin: - amd64: sha256:7fa387c228b4dd69b518a5d9425638fa5c0d86ec8943de373e3802aff2e5b12a - arm64: sha256:a167758a44e08af6eddf844ed86a6acdbff1d3957248913bbca7ee4ef6ff07d0 - Linux: - amd64: sha256:9379441ea310de000f33a4dc767bd966e72ab2826270e038e78b2c53c2e7802d - arm64: sha256:561c780e8f4a8955d32bf72e46af0b5ee5e0debe1e4633df9a03781878219202 - 1.23.5: - Darwin: - amd64: sha256:d2b06bf0b8299e0187dfe2d8ad39bd3dd96a6d93fe4d1cfd42c7872452f4a0a2 - arm64: sha256:f819ed94939e08a5016b9a607ec84ebbde6cb3fe59750c59d97aa300c3fd02df - Linux: - amd64: sha256:cbcad4a6482107c7c7926df1608106c189417163428200ce357695cc7e01d091 - arm64: sha256:47c84d332123883653b70da2db7dd57d2a865921ba4724efcdf56b5da7021db0 - hashicorp: - Linux: - RedHat: - repo: https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo - Fedora: - repo: https://rpm.releases.hashicorp.com/fedora/hashicorp.repo - Debian: - repo: "deb [arch={{ ansible_architecture }} signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com {{ ansible_distribution_release }} main" - jellyfin: {} - kitty: - pkgs: - Darwin: - - kitty - Linux: - - kitty - - kitty-shell-integration - libreoffice: - flatpak: - - org.libreoffice.LibreOffice - Debian: - - libreoffice - RedHat: - - libreoffice - luals: - base_url: https://github.com/LuaLS/lua-language-server/releases/download - sysmap: - Darwin: darwin - Linux: linux - archmap: - aarch64: arm64 - arm64: arm64 - x86_64: x64 neovide: git_repo: https://github.com/neovide/neovide.git build_deps: diff --git a/vars/pkgs/air.yml b/vars/pkgs/air.yml new file mode 100644 index 0000000..8033b1b --- /dev/null +++ b/vars/pkgs/air.yml @@ -0,0 +1,3 @@ +air: + version: latest + git_repo: github.com/air-verse/air diff --git a/vars/pkgs/alacritty.yml b/vars/pkgs/alacritty.yml new file mode 100644 index 0000000..4e319d5 --- /dev/null +++ b/vars/pkgs/alacritty.yml @@ -0,0 +1,25 @@ +alacritty: + version: 0.15.0 + RedHat: + pkgs: [] + build_deps: + - cmake + - freetype-devel + - fontconfig-devel + - libxcb-devel + - libxkbcommon-devel + - g++ + Debian: + pkgs: [] + build_deps: + - cmake + - pkg-config + - libfreetype6-dev + - libfontconfig1-dev + - libxcb-xfixes0-dev + - libxkbcommon-dev + - python3 + Darwin: + pkgs: + - alacritty + git_repo: https://github.com/alacritty/alacritty.git diff --git a/vars/pkgs/bitwarden.yml b/vars/pkgs/bitwarden.yml new file mode 100644 index 0000000..7c2f823 --- /dev/null +++ b/vars/pkgs/bitwarden.yml @@ -0,0 +1,7 @@ +bitwarden: + flatpak: + name: com.bitwarden.desktop + remote: flathub + appimage: + name: bitwarden.appimage + url: https://vault.bitwarden.com/download/?app=desktop&platform=linux&variant=appimage diff --git a/vars/pkgs/broot.yml b/vars/pkgs/broot.yml new file mode 100644 index 0000000..69db166 --- /dev/null +++ b/vars/pkgs/broot.yml @@ -0,0 +1,10 @@ +broot: + build_deps: + Debian: + - build-essential + - libxcb1-dev + - libxcb-render0-dev + - libxcb-shape0-dev + - libxcb-xfixes0-dev + RedHat: + - libxcb diff --git a/vars/pkgs/carapace.yml b/vars/pkgs/carapace.yml new file mode 100644 index 0000000..61e873c --- /dev/null +++ b/vars/pkgs/carapace.yml @@ -0,0 +1,6 @@ +carapace: + pkgs: + Linux: + - carapace-bin + Darwin: + - carapace diff --git a/vars/pkgs/clangd.yml b/vars/pkgs/clangd.yml new file mode 100644 index 0000000..3bf41c5 --- /dev/null +++ b/vars/pkgs/clangd.yml @@ -0,0 +1,8 @@ +clangd: + pkgs: + RedHat: + - clang-devel + Debian: + - clangd-12 + Darwin: + - llvm diff --git a/vars/pkgs/consul.yml b/vars/pkgs/consul.yml new file mode 100644 index 0000000..7da455d --- /dev/null +++ b/vars/pkgs/consul.yml @@ -0,0 +1,3 @@ +consul: + Linux: consul + Darwin: hashicorp/tap/consul diff --git a/vars/pkgs/fd.yml b/vars/pkgs/fd.yml new file mode 100644 index 0000000..46b005c --- /dev/null +++ b/vars/pkgs/fd.yml @@ -0,0 +1,8 @@ +fd: + pkg: + Darwin: + - fd + RedHat: + - fd-find + Debian: + - fd-find diff --git a/vars/pkgs/ghostty.yml b/vars/pkgs/ghostty.yml new file mode 100644 index 0000000..5ca6614 --- /dev/null +++ b/vars/pkgs/ghostty.yml @@ -0,0 +1,9 @@ +ghostty: + build_deps: + Debian: + - libgtk-4-dev + - libadwaita-1-dev + RedHat: + - gtk4-devel + - libadwaita-devel + git_repo: https://github.com/ghostty-org/ghostty diff --git a/vars/pkgs/git.yml b/vars/pkgs/git.yml new file mode 100644 index 0000000..8f4cce8 --- /dev/null +++ b/vars/pkgs/git.yml @@ -0,0 +1,12 @@ +git: + pkgs: + Darwin: + - git + - git-delta + - git-extras + - git-lfs + Linux: + - git + - git-delta + - git-email + - git-lfs diff --git a/vars/pkgs/go.yml b/vars/pkgs/go.yml new file mode 100644 index 0000000..4992e32 --- /dev/null +++ b/vars/pkgs/go.yml @@ -0,0 +1,25 @@ +go: + base_url: https://go.dev/dl + version: 1.23.6 + archmap: + arm64: arm64 + aarch64: arm64 + x86_64: amd64 + extmap: + Darwin: pkg + Linux: tar.gz + sums: + 1.23.6: + Darwin: + amd64: sha256:7fa387c228b4dd69b518a5d9425638fa5c0d86ec8943de373e3802aff2e5b12a + arm64: sha256:a167758a44e08af6eddf844ed86a6acdbff1d3957248913bbca7ee4ef6ff07d0 + Linux: + amd64: sha256:9379441ea310de000f33a4dc767bd966e72ab2826270e038e78b2c53c2e7802d + arm64: sha256:561c780e8f4a8955d32bf72e46af0b5ee5e0debe1e4633df9a03781878219202 + 1.23.5: + Darwin: + amd64: sha256:d2b06bf0b8299e0187dfe2d8ad39bd3dd96a6d93fe4d1cfd42c7872452f4a0a2 + arm64: sha256:f819ed94939e08a5016b9a607ec84ebbde6cb3fe59750c59d97aa300c3fd02df + Linux: + amd64: sha256:cbcad4a6482107c7c7926df1608106c189417163428200ce357695cc7e01d091 + arm64: sha256:47c84d332123883653b70da2db7dd57d2a865921ba4724efcdf56b5da7021db0 diff --git a/vars/pkgs/hashicorp.yml b/vars/pkgs/hashicorp.yml new file mode 100644 index 0000000..ec06e5b --- /dev/null +++ b/vars/pkgs/hashicorp.yml @@ -0,0 +1,8 @@ +hashicorp: + Linux: + RedHat: + repo: https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo + Fedora: + repo: https://rpm.releases.hashicorp.com/fedora/hashicorp.repo + Debian: + repo: "deb [arch={{ ansible_architecture }} signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com {{ ansible_distribution_release }} main" diff --git a/vars/pkgs/kitty.yml b/vars/pkgs/kitty.yml new file mode 100644 index 0000000..4b4bcf7 --- /dev/null +++ b/vars/pkgs/kitty.yml @@ -0,0 +1,7 @@ +kitty: + pkgs: + Darwin: + - kitty + Linux: + - kitty + - kitty-shell-integration diff --git a/vars/pkgs/libreoffice.yml b/vars/pkgs/libreoffice.yml new file mode 100644 index 0000000..5604c0f --- /dev/null +++ b/vars/pkgs/libreoffice.yml @@ -0,0 +1,7 @@ +libreoffice: + flatpak: + - org.libreoffice.LibreOffice + Debian: + - libreoffice + RedHat: + - libreoffice diff --git a/vars/pkgs/luals.yml b/vars/pkgs/luals.yml new file mode 100644 index 0000000..483477c --- /dev/null +++ b/vars/pkgs/luals.yml @@ -0,0 +1,9 @@ +luals: + base_url: https://github.com/LuaLS/lua-language-server/releases/download + sysmap: + Darwin: darwin + Linux: linux + archmap: + aarch64: arm64 + arm64: arm64 + x86_64: x64 From c73ac46bc87270b9fe46c644afdc737a4c3a4d6e Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Wed, 12 Feb 2025 16:57:28 -0700 Subject: [PATCH 05/38] organizing for go pkg installs --- tasks/{src => archive}/go.yml | 28 +-- tasks/cargo.yml | 0 tasks/config/air.yml | 3 +- tasks/go.yml | 9 + tasks/homebrew.yml | 0 tasks/main.yml | 133 ++++++++------ tasks/pipx.yml | 0 tasks/pkgs/air.yml | 2 +- tasks/pkgs/go.yml | 12 +- tasks/pkgs/nodejs.yml | 5 +- tasks/system.yml | 0 vars/main.yml | 333 ++-------------------------------- vars/pkgs/air.yml | 3 +- vars/pkgs/neovide.yml | 21 +++ vars/pkgs/neovim.yml | 3 + vars/pkgs/nerdfonts.yml | 139 ++++++++++++++ vars/pkgs/nodejs.yml | 7 + vars/pkgs/nomad.yml | 3 + vars/pkgs/nushell.yml | 37 ++++ vars/pkgs/packer.yml | 3 + vars/pkgs/python3.yml | 7 + vars/pkgs/rust.yml | 7 + vars/pkgs/tailscale.yml | 15 ++ vars/pkgs/terraform.yml | 3 + vars/pkgs/terraformls.yml | 3 + vars/pkgs/terrarepo.yml | 2 + vars/pkgs/tidy.yml | 6 + vars/pkgs/vault.yml | 3 + vars/pkgs/zfs.yml | 22 +++ vars/pkgs/zig.yml | 9 + vars/pkgs/zls.yml | 9 + 31 files changed, 431 insertions(+), 396 deletions(-) rename tasks/{src => archive}/go.yml (58%) create mode 100644 tasks/cargo.yml create mode 100644 tasks/go.yml create mode 100644 tasks/homebrew.yml create mode 100644 tasks/pipx.yml create mode 100644 tasks/system.yml create mode 100644 vars/pkgs/neovide.yml create mode 100644 vars/pkgs/neovim.yml create mode 100644 vars/pkgs/nerdfonts.yml create mode 100644 vars/pkgs/nodejs.yml create mode 100644 vars/pkgs/nomad.yml create mode 100644 vars/pkgs/nushell.yml create mode 100644 vars/pkgs/packer.yml create mode 100644 vars/pkgs/python3.yml create mode 100644 vars/pkgs/rust.yml create mode 100644 vars/pkgs/tailscale.yml create mode 100644 vars/pkgs/terraform.yml create mode 100644 vars/pkgs/terraformls.yml create mode 100644 vars/pkgs/terrarepo.yml create mode 100644 vars/pkgs/tidy.yml create mode 100644 vars/pkgs/vault.yml create mode 100644 vars/pkgs/zfs.yml create mode 100644 vars/pkgs/zig.yml create mode 100644 vars/pkgs/zls.yml diff --git a/tasks/src/go.yml b/tasks/archive/go.yml similarity index 58% rename from tasks/src/go.yml rename to tasks/archive/go.yml index 855a715..51cd288 100644 --- a/tasks/src/go.yml +++ b/tasks/archive/go.yml @@ -17,6 +17,7 @@ checksum: "{{ go.sum }}" decompress: false mode: '0644' + register: get_url_go - name: Ensure go install dir exists become: "{{ sys_pkg_become }}" @@ -25,16 +26,19 @@ state: directory mode: '0755' - - name: Extract go package - become: "{{ sys_pkg_become }}" - ansible.builtin.unarchive: - dest: "{{ paths.archive }}/go" - src: "{{ d_go_dl_tmp.path }}/{{ go_archive }}" - remote_src: true - when: ansible_system == 'Linux' +- name: Extract go package + become: "{{ sys_pkg_become }}" + when: + - ansible_system == 'Linux' + ansible.builtin.unarchive: + dest: "{{ paths.archive }}/go" + src: "{{ d_go_dl_tmp.path }}/{{ go_archive }}" + remote_src: true - - name: Install go macOS use pkg file - ansible.builtin.command: - cmd: "installer -pkg {{ d_go_dl_tmp.path }}/{{ go_archive }} -target /" - when: ansible_system == 'Darwin' - become: true +- name: Install go macOS use pkg file + become: true + when: + - ansible_system == 'Darwin' + ansible.builtin.command: + creates: "{{ go.inst_path }}" + cmd: "installer -pkg {{ d_go_dl_tmp.path }}/{{ go_archive }} -target /" diff --git a/tasks/cargo.yml b/tasks/cargo.yml new file mode 100644 index 0000000..e69de29 diff --git a/tasks/config/air.yml b/tasks/config/air.yml index 2b248d5..e5ee19e 100644 --- a/tasks/config/air.yml +++ b/tasks/config/air.yml @@ -4,4 +4,5 @@ ansible.builtin.set_fact: air: ver: "{{ pkgconfig.air.version }}" - pkg: "{{ pkgconfig.air.git_repo }}@{{ pkgconfig.air.version }}" + pkg: "{{ pkgconfig.air.mod_path }}@{{ pkgconfig.air.version }}" + bin: "{{ pkgconfig.air.bin }}" diff --git a/tasks/go.yml b/tasks/go.yml new file mode 100644 index 0000000..3506bbd --- /dev/null +++ b/tasks/go.yml @@ -0,0 +1,9 @@ +--- +- name: Install go packages + become: "{{ archive_become }}" + ansible.builtin.command: + creates: "{{ paths.bin }}/{{ pkg.bin }}" + cmd: + - go + - install + - "{{ pkg.pkg }}" diff --git a/tasks/homebrew.yml b/tasks/homebrew.yml new file mode 100644 index 0000000..e69de29 diff --git a/tasks/main.yml b/tasks/main.yml index 0076746..12034c5 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,26 +1,63 @@ # vim: set filetype=yaml.ansible : --- -# 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 }}" + archive_become: false + path_prefix: "{{ lookup(ansible.builtin.env, 'HOME') }}/.local" flatpak_method: user - name: Set facts based on use_local == false when: - not use_local ansible.builtin.set_fact: - paths: "{{ sys_paths }}" + archive_become: true + path_prefix: "{{ defaults.path.prefix }}" flatpak_method: system +- name: Set macOS specific facts + when: + - ansible_system == 'Darwin' + block: + - name: Set homebrew bin path + ansible.builtin.set_fact: + homebrew_bin: "/opt/homebrew/bin" + - name: Set other macOS facts + ansible.builtin.set_fact: + dobecome: "{{ not use_local }}" + pipx_exec: "{{ homebrew_bin }}/pipx" + sys_pkg_become: false + +- name: Set Linux specific facts + when: + - ansible_system == 'Linux' + block: + - name: Set Linux facts + ansible.builtin.set_fact: + dobecome: "{{ not use_local }}" + sys_pkg_become: true + +- name: Set paths + ansible.builtin.set_fact: + paths: + appimage: "{{ appimage_path | default(path_prefix ~ defaults.path.suffix.appimage) }}" + archive: "{{ archive_path | default(path_prefix ~ defaults.path.suffix.archive) }}" + bin: "{{ bin_path | default(path_prefix ~ defaults.path.suffix.bin) }}" + cargo: "{{ cargo_path | default(path_prefix ~ defaults.path.suffix.cargo) }}" + go: "{{ goroot | default(path_prefix ~ defaults.path.suffix.go) }}" + pipx: "{{ pipx_path | default(path_prefix ~ defaults.path.suffix.pipx) }}" + - name: Set installation facts ansible.builtin.set_fact: - bin_dir: "{{ paths.install }}/bin" - state_dir: "{{ paths.install }}/state" + # repositories + brew_taps: [] # homebrew taps + flatpak_remotes: # flatpak remotes, includes flathub by default + - name: flathub + url: https://dl.flathub.org/repo/flathub.flatpakrepo + # install lists app_images: [] # app_images to install + archive_pkgs: [] # packages installed via prebuilt archive cargo_pkgs: [] # rust packages from cargo cask_pkgs: [] # homebrew casks flatpaks: [] # flatpaks @@ -30,39 +67,16 @@ src_pkgs: [] # packages built from source sys_pkgs: [] # system package manager packages tap_pkgs: [] # homebrew tap packages - brew_taps: [] # homebrew taps - flatpak_remotes: # flatpak remotes, includes flathub by default - - name: flathub - url: https://dl.flathub.org/repo/flathub.flatpakrepo - -- name: Set macOS specific facts - when: - - ansible_system == 'Darwin' - block: - - 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 - ansible.builtin.set_fact: - sys_pkg_become: true - name: Ensure required paths exist - become: "{{ not use_local }}" - loop: "{{ paths + [bin_dir, state_dir] }}" + become: "{{ dobecome }}" + loop: "{{ paths | dict2items }}" loop_control: loop_var: path ansible.builtin.file: state: directory mode: '0755' - path: "{{ path }}" + path: "{{ path.value }}" - name: Read default package configuration ansible.builtin.include_vars: @@ -144,12 +158,10 @@ - name: Install flatpaks on Linux Systems when: - ansible_system == 'Linux' - - flatpaks|length > 0 block: - name: Add flatpak repos when: - flatpak_remotes|length > 0 - - flatpaks|length > 0 become: "{{ not use_local }}" loop: "{{ flatpak_remotes | unique }}" loop_control: @@ -166,61 +178,62 @@ loop: "{{ flatpaks | unique }}" loop_control: loop_var: flatpak - when: - - flatpaks|length > 0 community.general.flatpak: state: latest method: "{{ flatpak_method }}" name: "{{ flatpak.name }}" remote: "{{ flatpak.remote | default('flathub') }}" -- name: Ensure prefix/bin exists - ansible.builtin.file: - state: directory - path: "{{ paths.install }}/bin" - owner: root - mode: '0755' - become: true +- name: Install archive_pkgs + when: + - archive_pkgs|length > 0 + loop: "{{ archive_pkgs }}" + loop_control: + loop_var: pkg + ansible.builtin.include_tasks: + file: "archive/{{ pkg }}.yml" - name: Install src_pkgs - ansible.builtin.include_tasks: - file: "src/{{ src_pkg }}.yml" + when: + - src_pkgs|length > 0 loop: "{{ src_pkgs | unique }}" loop_control: - loop_var: src_pkg - when: src_pkgs|length > 0 + loop_var: pkg + ansible.builtin.include_tasks: + file: "src/{{ pkg }}.yml" -- name: Install cargo packages at specific version +- name: Install cargo packages when: - cargo_pkgs|length > 0 become: "{{ not use_local }}" loop: "{{ cargo_pkgs | unique }}" loop_control: - loop_var: cargo_pkg + loop_var: pkg community.general.cargo: - name: "{{ cargo_pkg.cargo.pkg }}" - version: "{{ cargo_pkg.ver }}" + name: "{{ pkg.cargo.pkg }}" + version: "{{ pkg.ver }}" path: "{{ paths.cargo }}" - locked: "{{ cargo_pkg.cargo.locked }}" + locked: "{{ pkg.cargo.locked }}" -- name: Install local go packages +- name: Install go packages when: - go_pkgs|length > 0 loop: "{{ go_pkgs | unique }}" loop_control: - loop_var: go_pkg + loop_var: pkg environment: - GOROOT: "{{ paths.install }}/go" - PATH: "{{ paths.install }}/go/bin:$PATH" - ansible.builtin.command: - cmd: "go install {{ go_pkg }}" - # TODO: figure out how to check if the go_pkg is already installed + GOBIN: "{{ paths.bin }}" + PATH: "{{ paths.go }}/bin:$PATH" + ansible.builtin.include_tasks: + file: go.yml - name: Install local npm packages + when: + - npm_pkgs|length > 0 + become: "{{ archive_become }}" loop: "{{ npm_pkgs | unique }}" loop_control: loop_var: npm_pkg - when: npm_pkgs|length > 0 community.general.npm: global: true name: "{{ npm_pkg }}" diff --git a/tasks/pipx.yml b/tasks/pipx.yml new file mode 100644 index 0000000..e69de29 diff --git a/tasks/pkgs/air.yml b/tasks/pkgs/air.yml index 7922156..0c1ab44 100644 --- a/tasks/pkgs/air.yml +++ b/tasks/pkgs/air.yml @@ -4,4 +4,4 @@ notify: - Depend go ansible.builtin.set_fact: - go_pkgs: "{{ go_pkgs + [air.pkg] }}" + go_pkgs: "{{ go_pkgs + [air] }}" diff --git a/tasks/pkgs/go.yml b/tasks/pkgs/go.yml index 8032ca2..13551a8 100644 --- a/tasks/pkgs/go.yml +++ b/tasks/pkgs/go.yml @@ -1,5 +1,13 @@ # vim: set filetype=yaml.ansible : --- -- name: Append to pkgs +- name: Install from archive + when: + - prefer_archive ansible.builtin.set_fact: - src_pkgs: "{{ src_pkgs + ['go'] }}" + archive_pkgs: "{{ archive_pkgs + ['go'] }}" + +- name: Append to pkgs + when: + - not prefer_archive + ansible.builtin.set_fact: + sys_pkgs: "{{ src_pkgs + ['go'] }}" diff --git a/tasks/pkgs/nodejs.yml b/tasks/pkgs/nodejs.yml index 34a2d51..4209ead 100644 --- a/tasks/pkgs/nodejs.yml +++ b/tasks/pkgs/nodejs.yml @@ -1,8 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.set_fact: - nodejs: true - -- name: append to pkgs +- name: Append to pkgs ansible.builtin.set_fact: syspkgs: "{{ syspkgs + pkgconfig.nodejs.pkgs[ansible_system] }}" diff --git a/tasks/system.yml b/tasks/system.yml new file mode 100644 index 0000000..e69de29 diff --git a/vars/main.yml b/vars/main.yml index d244cb8..a05766d 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -5,319 +5,22 @@ use_local: true prefer_method: system packages: [] # list of packages to install -user_home: "{{ lookup(ansible.builtin.env, 'HOME') }}" +defaults: + path: + prefix: "/usr/local" + suffix: + appimage: "/appimage" # keep appimages here + archive: "/archive" # extract archives here + bin: "/bin" # installation prefix. Binaries are placed in `{{ install }}/bin` + cargo: "/cargo" # cargo install location + go: "/go" # GOROOT + pipx: "/pipx" # where pipx environments are installed (venvs). They are symlinked to `bin` -local_paths: # all localpaths are prefixed with the users "{{ user_home }} directory - appimage: "{{ user_home }}/.local/appimage" # keep appimages here - archive: "{{ user_home }}/.local/archive" # extract archives here - cache: "{{ user_home }}/.cache" # cache downloads here - cargo: "{{ user_home }}/.cargo" # cargo install location - install: "{{ user_home }}/.local" # installation prefix. Binaries are placed in `{{ install }}/bin` - -sys_paths: # if installing at a system level (default) - appimage: /opt/appimage # appimages are installed to {{ apimage_install_prefix }}// - archive: /opt/archive # pre-compiled archives are extracted to {{ archive_install_prefix }}/ - cache: /opt/archive/.cache # download archives here - cargo: /opt/cargo # cargo install location - install: /usr/local # executables get linked to {{ default_install_prefix }}/bin - -pkgconfig: - neovide: - git_repo: https://github.com/neovide/neovide.git - build_deps: - RedHat: - - fontconfig-devel - - freetype-devel - - libX11-xcb - - libX11-devel - - libstdc++-static - - libstdc++-devel - - "@Development Tools" - - "@Development Libraries" - Debian: - - fontconfig-devel - - freetype-devel - - libX11-xcb - - libX11-devel - - libstdc++-static - - libstdc++-devel - - "@Development Tools" - - "@Development Libraries" - neovim: - git_repo: https://github.com/neovim/neovim - appimage_url_pfx: https://github.com/neovim/neovim/releases/download - nerdfonts: - fonts: - 0xProto: - brew: font-0xproto-nerd-font - "3270": - brew: font-3270-nerd-font - Agave: - brew: font-agave-nerd-font - AnonymousPro: - brew: font-anonymice-nerd-font - Arimo: - brew: font-arimo-nerd-font - AurulentSansMono: - brew: font-aurulent-sans-mono-nerd-font - BigBlueTerminal: - brew: font-bigblue-terminal-nerd-font - BitstreamVeraSansMono: - brew: font-bitstream-vera-sans-mono-nerd-font - IBMPlexMono: - brew: font-blex-mono-nerd-font - CascadiaCode: - brew: font-caskaydia-cove-nerd-font - CascadiaMono: - brew: font-caskaydia-mono-nerd-font - CodeNewRoman: - brew: font-code-new-roman-nerd-font - ComicShannsMono: - brew: font-comic-shanns-mono-nerd-font - CommitMono: - brew: font-commit-mono-nerd-font - Cousine: - brew: font-cousine-nerd-font - D2Coding: - brew: font-d2coding-nerd-font - DaddyTimeMono: - brew: font-daddy-time-mono-nerd-font - DejaVuSansMono: - brew: font-dejavu-sans-mono-nerd-font - DepartureMono: - brew: font-departure-mono-nerd-font - DroidSansMono: - brew: font-droid-sans-mono-nerd-font - EnvyCodeR: - brew: font-envy-code-r-nerd-font - FantasqueSansMono: - brew: font-fantasque-sans-mono-nerd-font - FiraCode: - brew: font-fira-code-nerd-font - FiraMono: - brew: font-fira-mono-nerd-font - GeistMono: - brew: font-geist-mono-nerd-font - Go-Mono: - brew: font-go-mono-nerd-font - Gohu: - brew: font-gohufont-nerd-font - Hack: - brew: font-hack-nerd-font - Hasklig: - brew: font-hasklug-nerd-font - HeavyData: - brew: font-heavy-data-nerd-font - Hermit: - brew: font-hurmit-nerd-font - IA-Writer: - brew: font-im-writing-nerd-font - InconsolataGo: - brew: font-inconsolata-go-nerd-font - InconsolataLGC: - brew: font-inconsolata-lgc-nerd-font - Inconsolata: - brew: font-inconsolata-nerd-font - IntelOneMono: - brew: font-intone-mono-nerd-font - Iosevka: - brew: font-iosevka-nerd-font - IosevkaTerm: - brew: font-iosevka-term-nerd-font - IosevkaTermSlab: - brew: font-iosevka-term-slab-nerd-font - JetBrainsMono: - brew: font-jetbrains-mono-nerd-font - Lekton: - brew: font-lekton-nerd-font - LiberationMono: - brew: font-liberation-nerd-font - Lilex: - brew: font-lilex-nerd-font - MPlus: - brew: font-m+-nerd-font - MartianMono: - brew: font-martian-mono-nerd-font - Meslo: - brew: font-meslo-lg-nerd-font - Monaspace: - brew: font-monaspace-nerd-font - Monofur: - brew: font-monofur-nerd-font - Mononoki: - brew: font-mononoki-nerd-font - Monoid: - brew: font-monoid-nerd-font - NerdFontsSymbolsOnly: - brew: font-symbols-only-nerd-font - Noto: - brew: font-noto-nerd-font - OpenDyslexic: - brew: font-open-dyslexic-nerd-font - Overpass: - brew: font-overpass-nerd-font - ProFont: - brew: font-profont-nerd-font - ProggyClean: - brew: font-proggy-clean-tt-nerd-font - Recursive: - brew: font-recursive-mono-nerd-font - RobotoMono: - brew: font-roboto-mono-nerd-font - SourceCodePro: - brew: font-sauce-code-pro-nerd-font - ShareTechMono: - brew: font-shure-tech-mono-nerd-font - SpaceMono: - brew: font-space-mono-nerd-font - Terminus: - brew: font-terminess-ttf-nerd-font - Tinos: - brew: font-tinos-nerd-font - UbuntuMono: - brew: font-ubuntu-mono-nerd-font - Ubuntu: - brew: font-ubuntu-nerd-font - UbuntuSans: - brew: font-ubuntu-sans-nerd-font - VictorMono: - brew: font-victor-mono-nerd-font - ZedMono: - brew: font-zed-mono-nerd-font - base_url: https://github.com/ryanoasis/nerd-fonts/releases/latest/download - nodejs: - pkgs: - Darwin: - - node - Linux: - - nodejs - - npm - nomad: - Linux: nomad - Darwin: hashicorp/tap/nomad - nushell: - build_deps: - Darwin: - - openssl - - cmake - Debian: - - pkg-config - - libssl-dev - - build-essential - RedHat: - - libxcb - - openssl-devel - - libX11-devel - nupkgs_extra: [] - nupkgs_common: - - nu - - nu_plugin_compress - - nu_plugin_desktop_notifications - - nu_plugin_dns - - nu_plugin_file_dialog - - nu_plugin_formats - - nu_plugin_gstat - - nu_plugin_hashes - - nu_plugin_hcl - - nu_plugin_highlight - - nu_plugin_inc - - nu_plugin_json_path - - nu_plugin_net - - nu_plugin_polars - - nu_plugin_query - - nu_plugin_selector - pkgs: - Darwin: - - nu_plugin_plist - Debian: [] - RedHat: - - nu_plugin_rpm - packer: - Linux: packer - Darwin: packer - python3: - pkgs: - Darwin: - - python3 - Linux: - - python3 - - python3-pip - rust: - pkgs: - Darwin: - - rust - Linux: - - rustc - - cargo - tailscale: - url_base: https://pkgs.tailscale.com/stable - release: - bookworm: - gpg: bookworm.noarmor.gpg - list: bookworm.tailscale-keyring.list - bullseye: - gpg: bullseye.noarmor.gpg - list: bullseye.tailscale-keyring.list - buster: - gpg: buster.gpg - list: buster.list - stretch: - gpg: stretch.gpg - list: stretch.list - terraform: - Linux: terraform - Darwin: hashicorp/tap/terraform - terraformls: - Linux: terraform-ls - Darwin: hashicorp/tap/terraform-ls - terrarepo: - repo: https://terra.fyralabs.com/terra.repo - tidy: - pkgs: - Darwin: - - tidy-html5 - Linux: - - tidy - vault: - Linux: vault - Darwin: hashicorp/tap/vault - zfs: - repo_base: https://zfsonlinux.org - gpg_key: https://raw.githubusercontent.com/zfsonlinux/zfsonlinux.github.com/master/zfs-release/RPM-GPG-KEY-openzfs-key2 - gpg_key_fingerprint: 7DC7 299D CF7C 7FD9 CD87 701B A599 FD5E 9DB8 4141 - fedora: - release: 2-6 - epel: - release: 2-3 - pkgs: - RedHat: - - zfs - Debian: - - zfs-dkms - - zfsutils-linux - build_deps: - RedHat: - - kernel-devel - - epel-release - Debian: - - dpkg-dev - - linux-headers-generic - - linux-image-generic - zig: - base_url: https://ziglang.org/download - sysmap: - Darwin: macos - Linux: linux - archmap: - aarch64: aarch64 - arm64: aarch64 - x86_64: x86_64 - zls: - base_url: https://builds.zigtools.org - sysmap: - Darwin: macos - Linux: linux - archmap: - aarch64: aarch64 - arm64: aarch64 - x86_64: x86_64 +# paths resolve to either $HOME/.local as the prefix, or /usr/local +# all created paths are named: +# - paths.appimage: $PREFIX/appimage +# - paths.archive: $PREFIX/archive +# - paths.bin: $PREFIX/bin +# - paths.cargo: $PREFIX/cargo +# - paths.go: $PREFIX/go +# - paths.pipx: $PREFIX/pipx diff --git a/vars/pkgs/air.yml b/vars/pkgs/air.yml index 8033b1b..9476287 100644 --- a/vars/pkgs/air.yml +++ b/vars/pkgs/air.yml @@ -1,3 +1,4 @@ air: version: latest - git_repo: github.com/air-verse/air + mod_path: github.com/air-verse/air + bin: air diff --git a/vars/pkgs/neovide.yml b/vars/pkgs/neovide.yml new file mode 100644 index 0000000..f32e2f1 --- /dev/null +++ b/vars/pkgs/neovide.yml @@ -0,0 +1,21 @@ +neovide: + git_repo: https://github.com/neovide/neovide.git + build_deps: + RedHat: + - fontconfig-devel + - freetype-devel + - libX11-xcb + - libX11-devel + - libstdc++-static + - libstdc++-devel + - "@Development Tools" + - "@Development Libraries" + Debian: + - fontconfig-devel + - freetype-devel + - libX11-xcb + - libX11-devel + - libstdc++-static + - libstdc++-devel + - "@Development Tools" + - "@Development Libraries" diff --git a/vars/pkgs/neovim.yml b/vars/pkgs/neovim.yml new file mode 100644 index 0000000..2bc60b3 --- /dev/null +++ b/vars/pkgs/neovim.yml @@ -0,0 +1,3 @@ +neovim: + git_repo: https://github.com/neovim/neovim + appimage_url_pfx: https://github.com/neovim/neovim/releases/download diff --git a/vars/pkgs/nerdfonts.yml b/vars/pkgs/nerdfonts.yml new file mode 100644 index 0000000..6b658ac --- /dev/null +++ b/vars/pkgs/nerdfonts.yml @@ -0,0 +1,139 @@ +nerdfonts: + fonts: + 0xProto: + brew: font-0xproto-nerd-font + "3270": + brew: font-3270-nerd-font + Agave: + brew: font-agave-nerd-font + AnonymousPro: + brew: font-anonymice-nerd-font + Arimo: + brew: font-arimo-nerd-font + AurulentSansMono: + brew: font-aurulent-sans-mono-nerd-font + BigBlueTerminal: + brew: font-bigblue-terminal-nerd-font + BitstreamVeraSansMono: + brew: font-bitstream-vera-sans-mono-nerd-font + IBMPlexMono: + brew: font-blex-mono-nerd-font + CascadiaCode: + brew: font-caskaydia-cove-nerd-font + CascadiaMono: + brew: font-caskaydia-mono-nerd-font + CodeNewRoman: + brew: font-code-new-roman-nerd-font + ComicShannsMono: + brew: font-comic-shanns-mono-nerd-font + CommitMono: + brew: font-commit-mono-nerd-font + Cousine: + brew: font-cousine-nerd-font + D2Coding: + brew: font-d2coding-nerd-font + DaddyTimeMono: + brew: font-daddy-time-mono-nerd-font + DejaVuSansMono: + brew: font-dejavu-sans-mono-nerd-font + DepartureMono: + brew: font-departure-mono-nerd-font + DroidSansMono: + brew: font-droid-sans-mono-nerd-font + EnvyCodeR: + brew: font-envy-code-r-nerd-font + FantasqueSansMono: + brew: font-fantasque-sans-mono-nerd-font + FiraCode: + brew: font-fira-code-nerd-font + FiraMono: + brew: font-fira-mono-nerd-font + GeistMono: + brew: font-geist-mono-nerd-font + Go-Mono: + brew: font-go-mono-nerd-font + Gohu: + brew: font-gohufont-nerd-font + Hack: + brew: font-hack-nerd-font + Hasklig: + brew: font-hasklug-nerd-font + HeavyData: + brew: font-heavy-data-nerd-font + Hermit: + brew: font-hurmit-nerd-font + IA-Writer: + brew: font-im-writing-nerd-font + InconsolataGo: + brew: font-inconsolata-go-nerd-font + InconsolataLGC: + brew: font-inconsolata-lgc-nerd-font + Inconsolata: + brew: font-inconsolata-nerd-font + IntelOneMono: + brew: font-intone-mono-nerd-font + Iosevka: + brew: font-iosevka-nerd-font + IosevkaTerm: + brew: font-iosevka-term-nerd-font + IosevkaTermSlab: + brew: font-iosevka-term-slab-nerd-font + JetBrainsMono: + brew: font-jetbrains-mono-nerd-font + Lekton: + brew: font-lekton-nerd-font + LiberationMono: + brew: font-liberation-nerd-font + Lilex: + brew: font-lilex-nerd-font + MPlus: + brew: font-m+-nerd-font + MartianMono: + brew: font-martian-mono-nerd-font + Meslo: + brew: font-meslo-lg-nerd-font + Monaspace: + brew: font-monaspace-nerd-font + Monofur: + brew: font-monofur-nerd-font + Mononoki: + brew: font-mononoki-nerd-font + Monoid: + brew: font-monoid-nerd-font + NerdFontsSymbolsOnly: + brew: font-symbols-only-nerd-font + Noto: + brew: font-noto-nerd-font + OpenDyslexic: + brew: font-open-dyslexic-nerd-font + Overpass: + brew: font-overpass-nerd-font + ProFont: + brew: font-profont-nerd-font + ProggyClean: + brew: font-proggy-clean-tt-nerd-font + Recursive: + brew: font-recursive-mono-nerd-font + RobotoMono: + brew: font-roboto-mono-nerd-font + SourceCodePro: + brew: font-sauce-code-pro-nerd-font + ShareTechMono: + brew: font-shure-tech-mono-nerd-font + SpaceMono: + brew: font-space-mono-nerd-font + Terminus: + brew: font-terminess-ttf-nerd-font + Tinos: + brew: font-tinos-nerd-font + UbuntuMono: + brew: font-ubuntu-mono-nerd-font + Ubuntu: + brew: font-ubuntu-nerd-font + UbuntuSans: + brew: font-ubuntu-sans-nerd-font + VictorMono: + brew: font-victor-mono-nerd-font + ZedMono: + brew: font-zed-mono-nerd-font + base_url: https://github.com/ryanoasis/nerd-fonts/releases/latest/download diff --git a/vars/pkgs/nodejs.yml b/vars/pkgs/nodejs.yml new file mode 100644 index 0000000..41d34dd --- /dev/null +++ b/vars/pkgs/nodejs.yml @@ -0,0 +1,7 @@ +nodejs: + pkgs: + Darwin: + - node + Linux: + - nodejs + - npm diff --git a/vars/pkgs/nomad.yml b/vars/pkgs/nomad.yml new file mode 100644 index 0000000..872edee --- /dev/null +++ b/vars/pkgs/nomad.yml @@ -0,0 +1,3 @@ +nomad: + Linux: nomad + Darwin: hashicorp/tap/nomad diff --git a/vars/pkgs/nushell.yml b/vars/pkgs/nushell.yml new file mode 100644 index 0000000..6a58049 --- /dev/null +++ b/vars/pkgs/nushell.yml @@ -0,0 +1,37 @@ +nushell: + build_deps: + Darwin: + - openssl + - cmake + Debian: + - pkg-config + - libssl-dev + - build-essential + RedHat: + - libxcb + - openssl-devel + - libX11-devel + nupkgs_extra: [] + nupkgs_common: + - nu + - nu_plugin_compress + - nu_plugin_desktop_notifications + - nu_plugin_dns + - nu_plugin_file_dialog + - nu_plugin_formats + - nu_plugin_gstat + - nu_plugin_hashes + - nu_plugin_hcl + - nu_plugin_highlight + - nu_plugin_inc + - nu_plugin_json_path + - nu_plugin_net + - nu_plugin_polars + - nu_plugin_query + - nu_plugin_selector + pkgs: + Darwin: + - nu_plugin_plist + Debian: [] + RedHat: + - nu_plugin_rpm diff --git a/vars/pkgs/packer.yml b/vars/pkgs/packer.yml new file mode 100644 index 0000000..ee0d63e --- /dev/null +++ b/vars/pkgs/packer.yml @@ -0,0 +1,3 @@ +packer: + Linux: packer + Darwin: packer diff --git a/vars/pkgs/python3.yml b/vars/pkgs/python3.yml new file mode 100644 index 0000000..897216e --- /dev/null +++ b/vars/pkgs/python3.yml @@ -0,0 +1,7 @@ +python3: + pkgs: + Darwin: + - python3 + Linux: + - python3 + - python3-pip diff --git a/vars/pkgs/rust.yml b/vars/pkgs/rust.yml new file mode 100644 index 0000000..f7fbc28 --- /dev/null +++ b/vars/pkgs/rust.yml @@ -0,0 +1,7 @@ +rust: + pkgs: + Darwin: + - rust + Linux: + - rustc + - cargo diff --git a/vars/pkgs/tailscale.yml b/vars/pkgs/tailscale.yml new file mode 100644 index 0000000..dc6bd46 --- /dev/null +++ b/vars/pkgs/tailscale.yml @@ -0,0 +1,15 @@ +tailscale: + url_base: https://pkgs.tailscale.com/stable + release: + bookworm: + gpg: bookworm.noarmor.gpg + list: bookworm.tailscale-keyring.list + bullseye: + gpg: bullseye.noarmor.gpg + list: bullseye.tailscale-keyring.list + buster: + gpg: buster.gpg + list: buster.list + stretch: + gpg: stretch.gpg + list: stretch.list diff --git a/vars/pkgs/terraform.yml b/vars/pkgs/terraform.yml new file mode 100644 index 0000000..29c2578 --- /dev/null +++ b/vars/pkgs/terraform.yml @@ -0,0 +1,3 @@ +terraform: + Linux: terraform + Darwin: hashicorp/tap/terraform diff --git a/vars/pkgs/terraformls.yml b/vars/pkgs/terraformls.yml new file mode 100644 index 0000000..fbc8ed9 --- /dev/null +++ b/vars/pkgs/terraformls.yml @@ -0,0 +1,3 @@ +terraformls: + Linux: terraform-ls + Darwin: hashicorp/tap/terraform-ls diff --git a/vars/pkgs/terrarepo.yml b/vars/pkgs/terrarepo.yml new file mode 100644 index 0000000..af94a1a --- /dev/null +++ b/vars/pkgs/terrarepo.yml @@ -0,0 +1,2 @@ +terrarepo: + repo: https://terra.fyralabs.com/terra.repo diff --git a/vars/pkgs/tidy.yml b/vars/pkgs/tidy.yml new file mode 100644 index 0000000..be2c764 --- /dev/null +++ b/vars/pkgs/tidy.yml @@ -0,0 +1,6 @@ +tidy: + pkgs: + Darwin: + - tidy-html5 + Linux: + - tidy diff --git a/vars/pkgs/vault.yml b/vars/pkgs/vault.yml new file mode 100644 index 0000000..ca53cde --- /dev/null +++ b/vars/pkgs/vault.yml @@ -0,0 +1,3 @@ +vault: + Linux: vault + Darwin: hashicorp/tap/vault diff --git a/vars/pkgs/zfs.yml b/vars/pkgs/zfs.yml new file mode 100644 index 0000000..ff2138d --- /dev/null +++ b/vars/pkgs/zfs.yml @@ -0,0 +1,22 @@ +zfs: + repo_base: https://zfsonlinux.org + gpg_key: https://raw.githubusercontent.com/zfsonlinux/zfsonlinux.github.com/master/zfs-release/RPM-GPG-KEY-openzfs-key2 + gpg_key_fingerprint: 7DC7 299D CF7C 7FD9 CD87 701B A599 FD5E 9DB8 4141 + fedora: + release: 2-6 + epel: + release: 2-3 + pkgs: + RedHat: + - zfs + Debian: + - zfs-dkms + - zfsutils-linux + build_deps: + RedHat: + - kernel-devel + - epel-release + Debian: + - dpkg-dev + - linux-headers-generic + - linux-image-generic diff --git a/vars/pkgs/zig.yml b/vars/pkgs/zig.yml new file mode 100644 index 0000000..a74aba4 --- /dev/null +++ b/vars/pkgs/zig.yml @@ -0,0 +1,9 @@ +zig: + base_url: https://ziglang.org/download + sysmap: + Darwin: macos + Linux: linux + archmap: + aarch64: aarch64 + arm64: aarch64 + x86_64: x86_64 diff --git a/vars/pkgs/zls.yml b/vars/pkgs/zls.yml new file mode 100644 index 0000000..4734984 --- /dev/null +++ b/vars/pkgs/zls.yml @@ -0,0 +1,9 @@ +zls: + base_url: https://builds.zigtools.org + sysmap: + Darwin: macos + Linux: linux + archmap: + aarch64: aarch64 + arm64: aarch64 + x86_64: x86_64 From 17ed8354c0450ecbdc8f2c5157ff195375875fa6 Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Thu, 13 Feb 2025 11:06:56 -0700 Subject: [PATCH 06/38] working through each file --- handlers/main.yml | 12 ++ tasks/cargo.yml | 9 ++ tasks/facts.yml | 49 +++++++ tasks/homebrew.yml | 0 tasks/linux.yml | 31 +++++ tasks/macos.yml | 18 +++ tasks/main.yml | 195 ++++----------------------- tasks/npm.yml | 8 ++ tasks/pipx.yml | 8 ++ tasks/pkgs/alacritty.yml | 7 +- tasks/pkgs/rust.yml | 10 +- tasks/{pkgs => repos}/terra_repo.yml | 0 12 files changed, 163 insertions(+), 184 deletions(-) create mode 100644 tasks/facts.yml delete mode 100644 tasks/homebrew.yml create mode 100644 tasks/linux.yml create mode 100644 tasks/macos.yml create mode 100644 tasks/npm.yml rename tasks/{pkgs => repos}/terra_repo.yml (100%) diff --git a/handlers/main.yml b/handlers/main.yml index cfe3e7b..bea301b 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -5,3 +5,15 @@ file: addpkg.yml vars: pkg: go + +- name: Depend cargo + vars: + pkg: cargo + ansible.builtin.include_tasks: + file: addpkg.yml + +- name: Depend rust + vars: + pkg: rust + ansible.builtin.include_tasks: + file: addpkg.yml diff --git a/tasks/cargo.yml b/tasks/cargo.yml index e69de29..3c22986 100644 --- a/tasks/cargo.yml +++ b/tasks/cargo.yml @@ -0,0 +1,9 @@ +# vim: set filetype=yaml.ansible +--- +- name: Install cargo pkg + become: "{{ archive_become }}" + community.general.cargo: + name: "{{ pkg.cargo.pkg }}" + version: "{{ pkg.ver }}" + path: "{{ paths.cargo }}" + locked: "{{ pkg.cargo.locked }}" diff --git a/tasks/facts.yml b/tasks/facts.yml new file mode 100644 index 0000000..b748b90 --- /dev/null +++ b/tasks/facts.yml @@ -0,0 +1,49 @@ +# vim: set filetype=yaml.ansible : +--- +- name: Set facts for installation + ansible.builtin.set_fact: + ext_become: "{{ not use_local }}" # if use_local is true, don't use sudo for external packages + path_prefix: "{% if use_local %}{{ lookup(ansible.builtin.env, 'HOME') }}{% else %}{{ defaults.path.prefix }}{% endif %}" + +- name: Set Linux specific facts + when: + - ansible_system == 'Linux' + ansible.builtin.set_fact: + app_images: [] # app_images to install + flatpak_method: "{% if use_local %}user{% else %}system{% endif %}" + flatpak_remotes: # flatpak remotes, includes flathub by default + - name: flathub + url: https://dl.flathub.org/repo/flathub.flatpakrepo + flatpaks: [] # flatpak packages to install + snap_pkgs: [] # snpacraft.io packages + sys_pkg_become: true # Linux package managers require sudo access + +- name: Set macOS specific facts + when: + - ansible_distribution == 'MacOSX' + ansible.builtin.set_fact: + brew_taps: [] # homebrew taps to add + cask_pkgs: [] # homebrew casks + pipx_exec: "/opt/homebrew/bin/pipx" + sys_pkg_become: false # homebrew doesn't require sudo access + tap_pkgs: [] # homebrew tap packages + +- name: Set paths + ansible.builtin.set_fact: + paths: + appimage: "{{ appimage_path | default(path_prefix ~ defaults.path.suffix.appimage) }}" + archive: "{{ archive_path | default(path_prefix ~ defaults.path.suffix.archive) }}" + bin: "{{ bin_path | default(path_prefix ~ defaults.path.suffix.bin) }}" + cargo: "{{ cargo_path | default(path_prefix ~ defaults.path.suffix.cargo) }}" + go: "{{ goroot | default(path_prefix ~ defaults.path.suffix.go) }}" + pipx: "{{ pipx_path | default(path_prefix ~ defaults.path.suffix.pipx) }}" + +- name: Set OS independant facts + ansible.builtin.set_fact: + archive_pkgs: [] # packages installed via prebuilt archive + cargo_pkgs: [] # rust packages from cargo + go_pkgs: [] # go applications + npm_pkgs: [] # npm commands + pipx_pkgs: [] # pipx packages + src_pkgs: [] # packages built from source + sys_pkgs: [] # system package manager packages, homebrew on macOS, dnf for RedHat based, apt for Debian Based diff --git a/tasks/homebrew.yml b/tasks/homebrew.yml deleted file mode 100644 index e69de29..0000000 diff --git a/tasks/linux.yml b/tasks/linux.yml new file mode 100644 index 0000000..121cd37 --- /dev/null +++ b/tasks/linux.yml @@ -0,0 +1,31 @@ +# vim: set filetype=yaml.ansible : +--- + +- name: Install flatpaks on Linux Systems + when: + - flatpaks|length > 0 + block: + - name: Add flatpak remotes + when: + - flatpak_remotes|length > 0 + become: "{{ ext_become }}" + loop: "{{ flatpak_remotes | unique }}" + loop_control: + loop_var: remote + community.general.flatpak_remote: + enabled: true + flatpakrepo_url: "{{ remote.url }}" + method: "{{ flatpak_method }}" + name: "{{ remote.name }}" + state: present + + - name: Install flatpaks + become: "{{ ext_become }}" + loop: "{{ flatpaks | unique }}" + loop_control: + loop_var: flatpak + community.general.flatpak: + method: "{{ flatpak_method }}" + name: "{{ flatpak.name }}" + remote: "{{ flatpak.remote | default('flathub') }}" + state: present diff --git a/tasks/macos.yml b/tasks/macos.yml new file mode 100644 index 0000000..adc94d2 --- /dev/null +++ b/tasks/macos.yml @@ -0,0 +1,18 @@ +# vim: set filetype=yaml.ansible : +--- +- name: Tap homebrew taps + community.general.homebrew_tap: + name: "{{ brew_taps | unique }}" + state: present + when: brew_taps|length > 0 + +- name: Install homebrew casks + community.general.homebrew_cask: + name: "{{ cask_pkgs | unique }}" + state: present + when: cask_pkgs|length > 0 + +# TODO: fix the need to have this workaround +- name: Workaround to install homebrew taps + ansible.builtin.command: + cmd: "brew install {{ (tap_pkgs | unique) | join(' ') }}" diff --git a/tasks/main.yml b/tasks/main.yml index 12034c5..56fc4b5 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,75 +1,11 @@ # vim: set filetype=yaml.ansible : --- -- name: Set facts based on use_local == true - when: - - use_local - ansible.builtin.set_fact: - archive_become: false - path_prefix: "{{ lookup(ansible.builtin.env, 'HOME') }}/.local" - flatpak_method: user - -- name: Set facts based on use_local == false - when: - - not use_local - ansible.builtin.set_fact: - archive_become: true - path_prefix: "{{ defaults.path.prefix }}" - flatpak_method: system - -- name: Set macOS specific facts - when: - - ansible_system == 'Darwin' - block: - - name: Set homebrew bin path - ansible.builtin.set_fact: - homebrew_bin: "/opt/homebrew/bin" - - name: Set other macOS facts - ansible.builtin.set_fact: - dobecome: "{{ not use_local }}" - pipx_exec: "{{ homebrew_bin }}/pipx" - sys_pkg_become: false - -- name: Set Linux specific facts - when: - - ansible_system == 'Linux' - block: - - name: Set Linux facts - ansible.builtin.set_fact: - dobecome: "{{ not use_local }}" - sys_pkg_become: true - -- name: Set paths - ansible.builtin.set_fact: - paths: - appimage: "{{ appimage_path | default(path_prefix ~ defaults.path.suffix.appimage) }}" - archive: "{{ archive_path | default(path_prefix ~ defaults.path.suffix.archive) }}" - bin: "{{ bin_path | default(path_prefix ~ defaults.path.suffix.bin) }}" - cargo: "{{ cargo_path | default(path_prefix ~ defaults.path.suffix.cargo) }}" - go: "{{ goroot | default(path_prefix ~ defaults.path.suffix.go) }}" - pipx: "{{ pipx_path | default(path_prefix ~ defaults.path.suffix.pipx) }}" - - name: Set installation facts - ansible.builtin.set_fact: - # repositories - brew_taps: [] # homebrew taps - flatpak_remotes: # flatpak remotes, includes flathub by default - - name: flathub - url: https://dl.flathub.org/repo/flathub.flatpakrepo - # install lists - app_images: [] # app_images to install - archive_pkgs: [] # packages installed via prebuilt archive - cargo_pkgs: [] # rust packages from cargo - cask_pkgs: [] # homebrew casks - flatpaks: [] # flatpaks - go_pkgs: [] # go applications - npm_pkgs: [] # npm commands - pipx_pkgs: [] # pipx packages - src_pkgs: [] # packages built from source - sys_pkgs: [] # system package manager packages - tap_pkgs: [] # homebrew tap packages + ansible.builtin.include_tasks: + file: facts.yml - name: Ensure required paths exist - become: "{{ dobecome }}" + become: "{{ ext_become }}" loop: "{{ paths | dict2items }}" loop_control: loop_var: path @@ -86,103 +22,29 @@ name: pkgconfig - name: Generate package installation lists - ansible.builtin.include_tasks: - file: addpkg.yml loop: "{{ packages | unique }}" loop_control: loop_var: pkg + ansible.builtin.include_tasks: + file: addpkg.yml -- name: Install sys_pkgs list + + +- name: Install sys_pkgs list using system package manager become: "{{ sys_pkg_become }}" ansible.builtin.package: name: "{{ sys_pkgs | unique }}" state: present -- name: Redhat based OS - when: ansible_os_family == 'RedHat' - block: - - name: Install dnf packages - become: true - when: - - sys_pkgs|length > 0 - ansible.builtin.dnf: - name: "{{ sys_pkgs | unique }}" - state: present - -- name: Debian based OS - when: ansible_os_family == 'Debian' - block: - - name: Install apt packages - ansible.builtin.apt: - name: "{{ sys_pkgs | unique }}" - state: "{{ install_state }}" - become: true - when: - - sys_pkgs|length > 0 +- name: Linux based OS + when: ansible_system == 'Linux' + ansible.builtin.include_tasks: + file: linux.yml - name: Darwin/macOS based OS - when: ansible_os_family == 'Darwin' - block: - - name: Upgrade homebrew packages - community.general.homebrew: - name: "*" - state: latest - when: full_upgrade - - - name: Tap homebrew taps - community.general.homebrew_tap: - name: "{{ brew_taps | unique }}" - state: present - when: brew_taps|length > 0 - - - name: Install homebrew packages - community.general.homebrew: - name: "{{ sys_pkgs | unique }}" - state: "{{ install_state }}" - when: sys_pkgs|length > 0 - - - name: Install homebrew casks - community.general.homebrew_cask: - name: "{{ cask_pkgs | unique }}" - state: "{{ install_state }}" - when: cask_pkgs|length > 0 - - - name: Workaround to install homebrew taps - ansible.builtin.command: - cmd: "brew install {{ tap_pkg }}" - loop: "{{ tap_pkgs | unique }}" - loop_control: - loop_var: tap_pkg - # TODO: fix the need to have this workaround - -- name: Install flatpaks on Linux Systems - when: - - ansible_system == 'Linux' - block: - - name: Add flatpak repos - when: - - flatpak_remotes|length > 0 - become: "{{ not use_local }}" - loop: "{{ flatpak_remotes | unique }}" - loop_control: - loop_var: remote - community.general.flatpak_remote: - enabled: true - method: "{{ flatpak_method }}" - state: present - flatpakrepo_url: "{{ remote.url }}" - name: "{{ remote.name }}" - - - name: Install flatpaks - become: true - loop: "{{ flatpaks | unique }}" - loop_control: - loop_var: flatpak - community.general.flatpak: - state: latest - method: "{{ flatpak_method }}" - name: "{{ flatpak.name }}" - remote: "{{ flatpak.remote | default('flathub') }}" + when: ansible_distribution == 'MacOSX' + ansible.builtin.include_tasks: + file: macos.yml - name: Install archive_pkgs when: @@ -193,7 +55,7 @@ ansible.builtin.include_tasks: file: "archive/{{ pkg }}.yml" -- name: Install src_pkgs +- name: Build and install source packages when: - src_pkgs|length > 0 loop: "{{ src_pkgs | unique }}" @@ -205,15 +67,11 @@ - name: Install cargo packages when: - cargo_pkgs|length > 0 - become: "{{ not use_local }}" loop: "{{ cargo_pkgs | unique }}" loop_control: loop_var: pkg - community.general.cargo: - name: "{{ pkg.cargo.pkg }}" - version: "{{ pkg.ver }}" - path: "{{ paths.cargo }}" - locked: "{{ pkg.cargo.locked }}" + ansible.builtin.include_tasks: + file: cargo.yml - name: Install go packages when: @@ -230,21 +88,16 @@ - name: Install local npm packages when: - npm_pkgs|length > 0 - become: "{{ archive_become }}" loop: "{{ npm_pkgs | unique }}" loop_control: - loop_var: npm_pkg - community.general.npm: - global: true - name: "{{ npm_pkg }}" - state: latest + loop_var: pkg + ansible.builtin.include_tasks: + file: npm.yml - name: Install python pipx packages for user loop: "{{ pipx_pkgs | unique }}" loop_control: - loop_var: pipx_pkg + loop_var: pkg when: pipx_pkgs|length > 0 - community.general.pipx: - executable: "{{ pipx_exec }}" - name: "{{ pipx_pkg }}" - state: latest + ansible.builtin.include_tasks: + file: pipx.yml diff --git a/tasks/npm.yml b/tasks/npm.yml new file mode 100644 index 0000000..1b6e8ad --- /dev/null +++ b/tasks/npm.yml @@ -0,0 +1,8 @@ +# vim: set filetype=yaml.ansible : +--- +- name: Install npm pkg + become: "{{ archive_become }}" + community.general.npm: + global: true + name: "{{ pkg }}" + state: present diff --git a/tasks/pipx.yml b/tasks/pipx.yml index e69de29..29ef20e 100644 --- a/tasks/pipx.yml +++ b/tasks/pipx.yml @@ -0,0 +1,8 @@ +# vim: set filetype=yaml.ansible : +--- +- name: Install pipx pkg + become: "{{ archive_become }}" + community.general.pipx: + executable: "{{ pipx_exec }}" + name: "{{ pipx_pkg }}" + state: latest diff --git a/tasks/pkgs/alacritty.yml b/tasks/pkgs/alacritty.yml index 8567896..9a50439 100644 --- a/tasks/pkgs/alacritty.yml +++ b/tasks/pkgs/alacritty.yml @@ -3,12 +3,9 @@ - name: Linux based installation when: ansible_system == 'Linux' block: - - name: Install rust and cargo - ansible.builtin.include_tasks: - file: "pkgs/rust.yml" - when: pkgconfig_rust is undefined - - name: Append to pkgs + notify: + - Depend cargo ansible.builtin.set_fact: syspkgs: "{{ syspkgs + alacritty.deps }}" srcpkgs: "{{ cargopkgs + [alacritty] }}" diff --git a/tasks/pkgs/rust.yml b/tasks/pkgs/rust.yml index 8562078..f7710c3 100644 --- a/tasks/pkgs/rust.yml +++ b/tasks/pkgs/rust.yml @@ -1,11 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_vars: - file: rust.yml - name: _rust -- ansible.builtin.set_fact: - pkgconfig_rust: "{{ _rust | ansible.builtin.combine(pkgconfig.rust) }}" - -- name: append to pkgs +- name: Append to pkgs ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + pkgconfig_rust.pkgs[ansible_system] }}" + syspkgs: "{{ syspkgs + pkgconfig.rust.pkgs }}" diff --git a/tasks/pkgs/terra_repo.yml b/tasks/repos/terra_repo.yml similarity index 100% rename from tasks/pkgs/terra_repo.yml rename to tasks/repos/terra_repo.yml From 2edc25447ddcac630ac2720ab6ba72ba02a76aed Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Fri, 14 Feb 2025 14:12:59 -0700 Subject: [PATCH 07/38] fixed nerdfonts variable error Signed-off-by: Matthew Stobbs --- tasks/src/nerdfonts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/src/nerdfonts.yml b/tasks/src/nerdfonts.yml index 428f3ac..fccc7bc 100644 --- a/tasks/src/nerdfonts.yml +++ b/tasks/src/nerdfonts.yml @@ -31,7 +31,7 @@ dest: "{{ nerdfonts_install_path }}/{{ font }}" remote_src: true when: nerdfont_result is changed - become: nerdfonts_system_install + become: "{{ nerdfonts_system_install }}" loop: "{{ pkgconfig_nerdfonts.install }}" loop_control: loop_var: font From a4ec35e5b38c470966de70910d356db0f61ff3e0 Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Tue, 11 Feb 2025 20:22:42 -0700 Subject: [PATCH 08/38] move a lot of configuration around --- tasks/src/go.yml | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 tasks/src/go.yml diff --git a/tasks/src/go.yml b/tasks/src/go.yml new file mode 100644 index 0000000..598837e --- /dev/null +++ b/tasks/src/go.yml @@ -0,0 +1,52 @@ +# vim: set filetype=yaml.ansible : +--- +- name: check go version + ansible.builtin.command: + cmd: "go version" + register: r_go_version + ignore_errors: true + +- name: install/update go + block: + - name: set go arch + ansible.builtin.set_fact: + arch: "{{ pkgconfig_go.archmap[ansible_architecture] }}" + + - name: set go archive filename + ansible.builtin.set_fact: + go_archive: "go{{ pkgconfig_go.version }}.{{ ansible_system | lower }}-{{ arch }}.{{ pkgconfig_go.extmap[ansible_system] }}" + + - name: create temp path + ansible.builtin.tempfile: + state: directory + prefix: go_dl. + register: d_go_dl_tmp + + - name: download go archive + become: true + ansible.builtin.get_url: + dest: "{{ d_go_dl_tmp.path }}/{{ go_archive }}" + url: "https://go.dev/dl/{{ go_archive }}" + checksum: "{{ pkgconfig_go.sums[pkgconfig_go.version][ansible_system][arch] }}" + decompress: false + + - name: ensure go install dir exists + become: true + ansible.builtin.file: + path: "{{ pkgconfig_go.install_path }}" + state: directory + + - name: extract go package + ansible.builtin.unarchive: + dest: "{{ pkgconfig_go.install_path }}" + src: "{{ d_go_dl_tmp.path }}/{{ go_archive }}" + remote_src: true + when: ansible_system == 'Linux' + become: true + + - name: install go macOS use pkg file + ansible.builtin.command: + cmd: "installer -pkg {{ d_go_dl_tmp.path }}/{{ go_archive }} -target /" + when: ansible_system == 'Darwin' + become: true + when: pkgconfig_go.version not in r_go_version.stdout From 069c4aa49e852fb79047d8a58a6634eacecc3905 Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Fri, 14 Feb 2025 22:52:53 -0700 Subject: [PATCH 09/38] adding tests - stat doesn't work on remote, need to figure out a workaround --- meta/main.yml | 4 +--- tasks/addpkg.yml | 14 ++++++++++---- tasks/go.yml | 3 +++ tasks/main.yml | 5 ----- tests/Containerfile | 17 +++++++++++++++++ tests/inventory | 2 -- tests/inventory.yml | 7 +++++++ tests/pubkey | 1 + tests/test.yml | 7 ++++++- 9 files changed, 45 insertions(+), 15 deletions(-) create mode 100644 tests/Containerfile delete mode 100644 tests/inventory create mode 100644 tests/inventory.yml create mode 100644 tests/pubkey diff --git a/meta/main.yml b/meta/main.yml index ca8f837..4e5a550 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -28,6 +28,4 @@ galaxy_info: - package - software -dependencies: - - ansible.builtin - - community.general +dependencies: [] diff --git a/tasks/addpkg.yml b/tasks/addpkg.yml index 27b4f2d..111855a 100644 --- a/tasks/addpkg.yml +++ b/tasks/addpkg.yml @@ -5,21 +5,27 @@ path: "{{ role_path }}/tasks/pkgs/{{ pkg }}.yml" register: stat_pkg +- name: Dump stat_pkg + ansible.builtin.debug: + var: stat_pkg + - name: "Check if specialized configuration exists for {{ pkg }}" - when: - - stat_pkg.exists ansible.builtin.stat: path: "{{ role_path }}/tasks/config/{{ pkg }}.yml" register: stat_config +- name: Dump stat_config + ansible.builtin.debug: + var: stat_config + - name: "Load specialized configuration if it exists for {{ pkg }}" when: - - stat_config.exists + - stat_config.stat.exists ansible.builtin.include_tasks: file: "config/{{ pkg }}.yml" - name: "Add include task for {{ pkg }}" when: - - stat_pkg.exists + - stat_pkg.stat.exists ansible.builtin.include_tasks: file: "pkgs/{{ pkg }}.yml" diff --git a/tasks/go.yml b/tasks/go.yml index 3506bbd..3532985 100644 --- a/tasks/go.yml +++ b/tasks/go.yml @@ -1,6 +1,9 @@ --- - name: Install go packages become: "{{ archive_become }}" + environment: + GOBIN: "{{ paths.bin }}" + PATH: "{{ paths.go }}/bin:$PATH" ansible.builtin.command: creates: "{{ paths.bin }}/{{ pkg.bin }}" cmd: diff --git a/tasks/main.yml b/tasks/main.yml index 56fc4b5..cc50ba4 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -28,8 +28,6 @@ ansible.builtin.include_tasks: file: addpkg.yml - - - name: Install sys_pkgs list using system package manager become: "{{ sys_pkg_become }}" ansible.builtin.package: @@ -79,9 +77,6 @@ loop: "{{ go_pkgs | unique }}" loop_control: loop_var: pkg - environment: - GOBIN: "{{ paths.bin }}" - PATH: "{{ paths.go }}/bin:$PATH" ansible.builtin.include_tasks: file: go.yml diff --git a/tests/Containerfile b/tests/Containerfile new file mode 100644 index 0000000..2bad7a8 --- /dev/null +++ b/tests/Containerfile @@ -0,0 +1,17 @@ +FROM fedora:41 +LABEL PROJECT "ansible_role_package" +LABEL MAINTAINER "Matthew Stobbs " + +RUN useradd -d /home/ansible -m -G wheel ansible +RUN dnf install -y openssh-server python3-paramiko python3-libdnf5 +EXPOSE 22 + +USER ansible +WORKDIR /home/ansible +RUN mkdir /home/ansible/.ssh +COPY ./pubkey /home/ansible/.ssh/authorized_keys + +USER root +RUN echo "ansible ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/sudoers +RUN ssh-keygen -A +ENTRYPOINT /usr/sbin/sshd -D diff --git a/tests/inventory b/tests/inventory deleted file mode 100644 index 878877b..0000000 --- a/tests/inventory +++ /dev/null @@ -1,2 +0,0 @@ -localhost - diff --git a/tests/inventory.yml b/tests/inventory.yml new file mode 100644 index 0000000..dd14dfb --- /dev/null +++ b/tests/inventory.yml @@ -0,0 +1,7 @@ +test: + hosts: + localhost: + ansible_ssh_host: 127.0.0.1 + ansible_ssh_port: 2222 + ansible_ssh_user: ansible + ansible_ssh_extra_args: "-o StrictHostKeyChecking=no" diff --git a/tests/pubkey b/tests/pubkey new file mode 100644 index 0000000..ea6ad18 --- /dev/null +++ b/tests/pubkey @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAAxfDLK7wu1ITTMV8gIzImO+KkXsjByvN7gYebqb5e+ stobbsm@ed25591 diff --git a/tests/test.yml b/tests/test.yml index 7a3ea63..4cff583 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -2,4 +2,9 @@ - hosts: localhost remote_user: root roles: - - ansible_role_package + - role: ansible_role_package + vars: + use_local: false + packages: + - air + - ansible-language-server From ff7b20fada072d97a799e6cf0273ad4bb4245fe8 Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Sat, 15 Feb 2025 10:30:49 -0700 Subject: [PATCH 10/38] quick fix for installing global npm packages Signed-off-by: Matthew Stobbs --- tasks/main.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index cc50ba4..0d3ba20 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -81,9 +81,12 @@ file: go.yml - name: Install local npm packages - when: - - npm_pkgs|length > 0 - loop: "{{ npm_pkgs | unique }}" + become: "{% if ansible_system == 'Linux' %}true{% else %}false{% endif %}" + community.general.npm: + global: true + name: "{{ npmpkg }}" + state: latest + loop: "{{ npmpkgs | unique }}" loop_control: loop_var: pkg ansible.builtin.include_tasks: From 2af7a3ee8c3e5ac551584c2dcba566d96a8cd6e4 Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Sat, 15 Feb 2025 11:05:05 -0700 Subject: [PATCH 11/38] workaround nerdfonts install issue --- tasks/src/nerdfonts.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/src/nerdfonts.yml b/tasks/src/nerdfonts.yml index fccc7bc..2546388 100644 --- a/tasks/src/nerdfonts.yml +++ b/tasks/src/nerdfonts.yml @@ -30,8 +30,8 @@ src: "{{ pkgconfig_nerdfonts.base_url }}/{{ font }}.tar.xz" dest: "{{ nerdfonts_install_path }}/{{ font }}" remote_src: true - when: nerdfont_result is changed - become: "{{ nerdfonts_system_install }}" + # when: nerdfont_result is changed + become: "{{ pkgconfig_nerdfonts.system_install }}" loop: "{{ pkgconfig_nerdfonts.install }}" loop_control: loop_var: font From 1202f7b212bebdfe15ff35828b937366c5003f35 Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Sat, 15 Feb 2025 11:06:47 -0700 Subject: [PATCH 12/38] restore previous nerdfont behaviour with fixed variable reference --- tasks/src/nerdfonts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/src/nerdfonts.yml b/tasks/src/nerdfonts.yml index 2546388..546c88d 100644 --- a/tasks/src/nerdfonts.yml +++ b/tasks/src/nerdfonts.yml @@ -30,7 +30,7 @@ src: "{{ pkgconfig_nerdfonts.base_url }}/{{ font }}.tar.xz" dest: "{{ nerdfonts_install_path }}/{{ font }}" remote_src: true - # when: nerdfont_result is changed + when: nerdfont_result is changed become: "{{ pkgconfig_nerdfonts.system_install }}" loop: "{{ pkgconfig_nerdfonts.install }}" loop_control: From 6f80af59e933f3c80df096ae8be369fba3d7ecef Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Tue, 11 Feb 2025 17:51:10 -0700 Subject: [PATCH 13/38] change layout for better management - instead of just `syspkgs` and `srcpkgs` add more lists - `appimages`, `flatpkgs` and others as they come up --- tasks/build/alacritty.yml | 15 +++++++++++++++ vars/alacritty.yml | 4 ++++ vars/bitwarden.yml | 8 ++++++++ vars/go.yml | 4 ++++ 4 files changed, 31 insertions(+) create mode 100644 tasks/build/alacritty.yml create mode 100644 vars/alacritty.yml create mode 100644 vars/bitwarden.yml create mode 100644 vars/go.yml diff --git a/tasks/build/alacritty.yml b/tasks/build/alacritty.yml new file mode 100644 index 0000000..bedb5cc --- /dev/null +++ b/tasks/build/alacritty.yml @@ -0,0 +1,15 @@ +# vim: set filetype=yaml.ansible : +--- +- name: Build and install alacritty + become: true + ansible.builtin.command: + creates: "{{ pkgconfig_alacritty.install_prefix }}/bin/alacritty" + cmd: + - cargo + - install + - --root + - "{{ pkgconfig_alacritty.install_prefix }}" + - --git + - "{{ pkgconfig_alacritty.git_repo }}" + - --tag + - "v{{ pkgconfig_alacritty.version }}" diff --git a/vars/alacritty.yml b/vars/alacritty.yml new file mode 100644 index 0000000..6aab3ff --- /dev/null +++ b/vars/alacritty.yml @@ -0,0 +1,4 @@ +# vim: set filetype=yaml.ansible : +--- +version: 0.15.0 +install_prefix: "{{ default_install_prefix }}" diff --git a/vars/bitwarden.yml b/vars/bitwarden.yml new file mode 100644 index 0000000..8de3209 --- /dev/null +++ b/vars/bitwarden.yml @@ -0,0 +1,8 @@ +# vim: set filetype=yaml.ansible : +--- +install_prefix: "{{ default_install_prefix }}" +install_dir: /opt/appimage/bitwarden +install_method: flatpak +dobecome: true +owner: root +group: root diff --git a/vars/go.yml b/vars/go.yml new file mode 100644 index 0000000..1864748 --- /dev/null +++ b/vars/go.yml @@ -0,0 +1,4 @@ +# vim: set filetype=yaml.ansible : +--- +version: 1.23.6 +install_path: "{{ default_install_prefix }}" From 457027e3b9f1e6a8a9b0e1311a6221c1cad35dd3 Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Tue, 11 Feb 2025 20:22:42 -0700 Subject: [PATCH 14/38] move a lot of configuration around --- tasks/build/alacritty.yml | 15 --------------- vars/alacritty.yml | 4 ---- vars/bitwarden.yml | 8 -------- vars/go.yml | 4 ---- 4 files changed, 31 deletions(-) delete mode 100644 tasks/build/alacritty.yml delete mode 100644 vars/alacritty.yml delete mode 100644 vars/bitwarden.yml delete mode 100644 vars/go.yml diff --git a/tasks/build/alacritty.yml b/tasks/build/alacritty.yml deleted file mode 100644 index bedb5cc..0000000 --- a/tasks/build/alacritty.yml +++ /dev/null @@ -1,15 +0,0 @@ -# vim: set filetype=yaml.ansible : ---- -- name: Build and install alacritty - become: true - ansible.builtin.command: - creates: "{{ pkgconfig_alacritty.install_prefix }}/bin/alacritty" - cmd: - - cargo - - install - - --root - - "{{ pkgconfig_alacritty.install_prefix }}" - - --git - - "{{ pkgconfig_alacritty.git_repo }}" - - --tag - - "v{{ pkgconfig_alacritty.version }}" diff --git a/vars/alacritty.yml b/vars/alacritty.yml deleted file mode 100644 index 6aab3ff..0000000 --- a/vars/alacritty.yml +++ /dev/null @@ -1,4 +0,0 @@ -# vim: set filetype=yaml.ansible : ---- -version: 0.15.0 -install_prefix: "{{ default_install_prefix }}" diff --git a/vars/bitwarden.yml b/vars/bitwarden.yml deleted file mode 100644 index 8de3209..0000000 --- a/vars/bitwarden.yml +++ /dev/null @@ -1,8 +0,0 @@ -# vim: set filetype=yaml.ansible : ---- -install_prefix: "{{ default_install_prefix }}" -install_dir: /opt/appimage/bitwarden -install_method: flatpak -dobecome: true -owner: root -group: root diff --git a/vars/go.yml b/vars/go.yml deleted file mode 100644 index 1864748..0000000 --- a/vars/go.yml +++ /dev/null @@ -1,4 +0,0 @@ -# vim: set filetype=yaml.ansible : ---- -version: 1.23.6 -install_path: "{{ default_install_prefix }}" From 516f9c26112272886ff2970b8f7b187012fba2dc Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Tue, 11 Feb 2025 22:14:04 -0700 Subject: [PATCH 15/38] lot's of standardizing with the refacto --- tasks/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tasks/main.yml b/tasks/main.yml index 0d3ba20..95cb8d1 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,5 +1,7 @@ # vim: set filetype=yaml.ansible : --- +# create all the facts used throughout the role, but shouldn't be touched +# by the user - name: Set installation facts ansible.builtin.include_tasks: file: facts.yml From 61db5dd90553a5eb95919f975f9ff9eeaa0683bc Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Wed, 12 Feb 2025 16:57:28 -0700 Subject: [PATCH 16/38] organizing for go pkg installs --- tasks/homebrew.yml | 0 tasks/src/go.yml | 52 ---------------------------------------------- 2 files changed, 52 deletions(-) create mode 100644 tasks/homebrew.yml delete mode 100644 tasks/src/go.yml diff --git a/tasks/homebrew.yml b/tasks/homebrew.yml new file mode 100644 index 0000000..e69de29 diff --git a/tasks/src/go.yml b/tasks/src/go.yml deleted file mode 100644 index 598837e..0000000 --- a/tasks/src/go.yml +++ /dev/null @@ -1,52 +0,0 @@ -# vim: set filetype=yaml.ansible : ---- -- name: check go version - ansible.builtin.command: - cmd: "go version" - register: r_go_version - ignore_errors: true - -- name: install/update go - block: - - name: set go arch - ansible.builtin.set_fact: - arch: "{{ pkgconfig_go.archmap[ansible_architecture] }}" - - - name: set go archive filename - ansible.builtin.set_fact: - go_archive: "go{{ pkgconfig_go.version }}.{{ ansible_system | lower }}-{{ arch }}.{{ pkgconfig_go.extmap[ansible_system] }}" - - - name: create temp path - ansible.builtin.tempfile: - state: directory - prefix: go_dl. - register: d_go_dl_tmp - - - name: download go archive - become: true - ansible.builtin.get_url: - dest: "{{ d_go_dl_tmp.path }}/{{ go_archive }}" - url: "https://go.dev/dl/{{ go_archive }}" - checksum: "{{ pkgconfig_go.sums[pkgconfig_go.version][ansible_system][arch] }}" - decompress: false - - - name: ensure go install dir exists - become: true - ansible.builtin.file: - path: "{{ pkgconfig_go.install_path }}" - state: directory - - - name: extract go package - ansible.builtin.unarchive: - dest: "{{ pkgconfig_go.install_path }}" - src: "{{ d_go_dl_tmp.path }}/{{ go_archive }}" - remote_src: true - when: ansible_system == 'Linux' - become: true - - - name: install go macOS use pkg file - ansible.builtin.command: - cmd: "installer -pkg {{ d_go_dl_tmp.path }}/{{ go_archive }} -target /" - when: ansible_system == 'Darwin' - become: true - when: pkgconfig_go.version not in r_go_version.stdout From 2bd69573ec918120ea9d2c44438e3594c2e8d3b6 Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Thu, 13 Feb 2025 11:06:56 -0700 Subject: [PATCH 17/38] working through each file --- tasks/homebrew.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 tasks/homebrew.yml diff --git a/tasks/homebrew.yml b/tasks/homebrew.yml deleted file mode 100644 index e69de29..0000000 From dbfae4dc4ffff33dd1d1e5accf4fb035c73db0db Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Wed, 19 Feb 2025 12:31:37 -0700 Subject: [PATCH 18/38] add go 1.24.0 --- vars/pkgs/go.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vars/pkgs/go.yml b/vars/pkgs/go.yml index 4992e32..0ed29fd 100644 --- a/vars/pkgs/go.yml +++ b/vars/pkgs/go.yml @@ -9,6 +9,13 @@ go: Darwin: pkg Linux: tar.gz sums: + 1.24.0: + Darwin: + amd64: dee0ea64411a00b47ded586d5a8e30cfe3acf51564aa1bb24e039a6dca807a29 + arm64: b19eb6b7ae87f8371c3e7a84d129db67779a2883d2fffa6bb90412b0167df133 + Linux: + amd64: b19eb6b7ae87f8371c3e7a84d129db67779a2883d2fffa6bb90412b0167df133 + arm64: c3fa6d16ffa261091a5617145553c71d21435ce547e44cc6dfb7470865527cc7 1.23.6: Darwin: amd64: sha256:7fa387c228b4dd69b518a5d9425638fa5c0d86ec8943de373e3802aff2e5b12a From 89f013bac99111f04128b307b392870c9fcc074b Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Wed, 19 Feb 2025 12:31:50 -0700 Subject: [PATCH 19/38] add go 1.24.0 --- vars/pkgs/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vars/pkgs/go.yml b/vars/pkgs/go.yml index 0ed29fd..f72ca9c 100644 --- a/vars/pkgs/go.yml +++ b/vars/pkgs/go.yml @@ -1,6 +1,6 @@ go: base_url: https://go.dev/dl - version: 1.23.6 + version: 1.24.0 archmap: arm64: arm64 aarch64: arm64 From 48e67be99bf69ddd870318a34c4577b4c01b8e2b Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Wed, 19 Feb 2025 22:23:47 -0700 Subject: [PATCH 20/38] fixing packages for new style --- tasks/archive/nerdfonts.yml | 29 +++++++++++++++++ tasks/config/bitwarden.yml | 15 ++++++--- tasks/config/nerdfonts.yml | 21 +++++++----- tasks/config/zfs.yml | 24 ++++++++++++++ tasks/facts.yml | 34 +++++++++---------- tasks/macos.yml | 1 + tasks/main.yml | 5 --- tasks/pkgs/bitwarden.yml | 45 +++++-------------------- tasks/pkgs/fd.yml | 4 +-- tasks/pkgs/hyperfine.yml | 4 +-- tasks/pkgs/nerdfonts.yml | 16 +++------ tasks/pkgs/stow.yml | 4 +-- tasks/pkgs/zfs.yml | 65 +++++++++++++++---------------------- tasks/pkgs/zsh.yml | 9 ++--- tasks/src/nerdfonts.yml | 37 --------------------- vars/pkgs/bitwarden.yml | 10 ++++++ vars/pkgs/nerdfonts.yml | 1 + 17 files changed, 152 insertions(+), 172 deletions(-) create mode 100644 tasks/archive/nerdfonts.yml create mode 100644 tasks/config/zfs.yml delete mode 100644 tasks/src/nerdfonts.yml diff --git a/tasks/archive/nerdfonts.yml b/tasks/archive/nerdfonts.yml new file mode 100644 index 0000000..3607dc1 --- /dev/null +++ b/tasks/archive/nerdfonts.yml @@ -0,0 +1,29 @@ +# vim: set filetype=yaml.ansible : +--- +- name: Linux installation + when: ansible_system == 'Linux' + block: + - name: Create nerdfonts directories + become: "{{ ext_become }}" + loop: "{{ nerdfonts.fonts }}" + loop_control: + loop_var: font + register: nerdfont_result + ansible.builtin.file: + path: "{{ nerdfonts.install_path }}/{{ font }}" + state: directory + mode: '0755' + + - name: Download and extract nerdfonts + when: + - nerdfont_result is changed or + nerdfonts.force_install + become: "{{ ext_become }}" + loop: "{{ nerdfonts.fonts }}" + loop_control: + loop_var: font + ansible.builtin.unarchive: + creates: "{{ nerdfonts.install_path }}/{{ font }}/README.md" + src: "{{ nerdfonts.base_url }}/{{ font }}.tar.xz" + dest: "{{ nerdfonts.install_path }}/{{ font }}" + remote_src: true diff --git a/tasks/config/bitwarden.yml b/tasks/config/bitwarden.yml index fc69046..1dbfbf7 100644 --- a/tasks/config/bitwarden.yml +++ b/tasks/config/bitwarden.yml @@ -1,7 +1,12 @@ # vim: set filetype=yaml.ansible : --- -install_prefix: "{{ default_install_prefix }}" -install_method: flatpak -dobecome: true -owner: root -group: root +- name: Set bitwarden install method + ansible.builtin.set_fact: + bw: + method: "{{ pkgconfig.bitwarden.method[ansible_distribution] | default('appimage') }}" + +- name: Set bitwarden config + ansible.builtin.set_fact: + bw: + pkg: "{{ pkgconfig.bitwarden[bw.method] }}" + method: "{{ bw.method }}" diff --git a/tasks/config/nerdfonts.yml b/tasks/config/nerdfonts.yml index 44c44fe..d7155f0 100644 --- a/tasks/config/nerdfonts.yml +++ b/tasks/config/nerdfonts.yml @@ -1,10 +1,15 @@ # vim: set filetype=yaml.ansible : --- -install: - - CascadiaCode - - FiraCode - - Hasklig - - Lilex - - Monoid - - NerdFontsSymbolsOnly -system_install: false +- name: Set facts for nerdfonts + ansible.builtin.set_fact: + nerdfonts: + fonts: + - CascadiaCode + - FiraCode + - Hasklig + - Lilex + - Monoid + - NerdFontsSymbolsOnly + install_path: "{{ path_prefix }}/{{ pkgconfig.nerdfonts.path }}" + base_url: "{{ pkgconfig.nerdfonts.base_url }}" + force_install: "{{ pkgconfig.force_install_nerdfonts | default(false) }}" diff --git a/tasks/config/zfs.yml b/tasks/config/zfs.yml new file mode 100644 index 0000000..8fab6e4 --- /dev/null +++ b/tasks/config/zfs.yml @@ -0,0 +1,24 @@ +--- +- name: Set zfs facts for RedHat based distros + when: + - ansible_os_family == 'RedHat' + block: + - name: Set distro name + ansible.builtin.set_fact: + rhname: "{%if ansible_distribution == 'Fedora' %}fedora{% else %}epel{% endif %}" + + - name: Get rpm_dist for RedHat + changed_when: false + register: rpm_dist + ansible.builtin.command: # is there a better way to get this? + cmd: rpm --eval "%{dist}" + +- name: Set ZFS config + ansible.builtin.set_fact: + zfs: + repo_pkg: "{{ pkgconfig.zfs.repo_base }}/{{ rhname }}/zfs-release-{{ pkgconfig.zfs[rhname].release }}{{ rpm_dist.stdout }}.noarch.rpm" + deps: "{{ pkgconfig.zfs.build_deps[ansible_os_family] }}" + pkgs: "{{ pkgconfig.zfs.pkgs[ansible_os_family] }}" + release: "{{ ansible_distribution_release }}" + gpg_key: "{{ pkgconfig.zfs.gpg_key }}" + gpg_fp: "{{ pkgconfig.zfs.gpg_key_fingerprint }}" diff --git a/tasks/facts.yml b/tasks/facts.yml index b748b90..ea9f02b 100644 --- a/tasks/facts.yml +++ b/tasks/facts.yml @@ -2,31 +2,31 @@ --- - name: Set facts for installation ansible.builtin.set_fact: - ext_become: "{{ not use_local }}" # if use_local is true, don't use sudo for external packages - path_prefix: "{% if use_local %}{{ lookup(ansible.builtin.env, 'HOME') }}{% else %}{{ defaults.path.prefix }}{% endif %}" + ext_become: "{{ not use_local }}" + path_prefix: "{% if use_local %}{{ lookup('ansible.builtin.env', 'HOME') }}/.local{% else %}{{ defaults.path.prefix }}{% endif %}" - name: Set Linux specific facts when: - ansible_system == 'Linux' ansible.builtin.set_fact: - app_images: [] # app_images to install - flatpak_method: "{% if use_local %}user{% else %}system{% endif %}" - flatpak_remotes: # flatpak remotes, includes flathub by default + flatpak_remote: # flatpak remotes, includes flathub by default - name: flathub url: https://dl.flathub.org/repo/flathub.flatpakrepo - flatpaks: [] # flatpak packages to install - snap_pkgs: [] # snpacraft.io packages + flatpak_method: "{% if use_local %}user{% else %}system{% endif %}" + pkg_appimage: [] # app_images to install + pkg_flatpak: [] # flatpak packages to install + pkg_snap: [] # snpacraft.io packages sys_pkg_become: true # Linux package managers require sudo access - name: Set macOS specific facts when: - ansible_distribution == 'MacOSX' ansible.builtin.set_fact: - brew_taps: [] # homebrew taps to add - cask_pkgs: [] # homebrew casks + brewtap: [] # homebrew taps to add pipx_exec: "/opt/homebrew/bin/pipx" + pkg_cask: [] # homebrew casks + pkg_tap: [] # homebrew tap packages sys_pkg_become: false # homebrew doesn't require sudo access - tap_pkgs: [] # homebrew tap packages - name: Set paths ansible.builtin.set_fact: @@ -40,10 +40,10 @@ - name: Set OS independant facts ansible.builtin.set_fact: - archive_pkgs: [] # packages installed via prebuilt archive - cargo_pkgs: [] # rust packages from cargo - go_pkgs: [] # go applications - npm_pkgs: [] # npm commands - pipx_pkgs: [] # pipx packages - src_pkgs: [] # packages built from source - sys_pkgs: [] # system package manager packages, homebrew on macOS, dnf for RedHat based, apt for Debian Based + pkg_archive: [] # packages installed via prebuilt archive + pkg_cargo: [] # rust packages from cargo + pkg_go: [] # go applications + pkg_npm: [] # npm commands + pkg_pipx: [] # pipx packages + pkg_src: [] # packages built from source + pkg_sys: [] # system package manager packages, homebrew on macOS, dnf for RedHat based, apt for Debian Based diff --git a/tasks/macos.yml b/tasks/macos.yml index adc94d2..c5836ab 100644 --- a/tasks/macos.yml +++ b/tasks/macos.yml @@ -16,3 +16,4 @@ - name: Workaround to install homebrew taps ansible.builtin.command: cmd: "brew install {{ (tap_pkgs | unique) | join(' ') }}" + changed_when: true diff --git a/tasks/main.yml b/tasks/main.yml index 95cb8d1..a9d097f 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -83,11 +83,6 @@ file: go.yml - name: Install local npm packages - become: "{% if ansible_system == 'Linux' %}true{% else %}false{% endif %}" - community.general.npm: - global: true - name: "{{ npmpkg }}" - state: latest loop: "{{ npmpkgs | unique }}" loop_control: loop_var: pkg diff --git a/tasks/pkgs/bitwarden.yml b/tasks/pkgs/bitwarden.yml index ee91dd8..8bd22b7 100644 --- a/tasks/pkgs/bitwarden.yml +++ b/tasks/pkgs/bitwarden.yml @@ -1,48 +1,19 @@ # vim: set filetype=yaml.ansible : --- -- name: Read bitwarden configuration - ansible.builtin.include_vars: - file: bitwarden.yml - name: _bitwarden - -- name: Set bitwarden configuration - ansible.builtin.set_fact: - pkgconfig_bitwarden: "{{ _bitwarden | ansible.builtin.combine(pkgconfig.bitwarden) }}" - -- name: Set bitwarden facts - ansible.builtin.set_fact: - bw: - appimg: "{{ pkgconfig_bitwarden.appimage }}" - become: "{{ pkgconfig_bitwarden.dobecome }}" - flatpak: "{{ pkgconfig_bitwarden.flatpak }}" - group: "{{ pkgconfig_bitwarden.group }}" - instdir: "{{ pkgconfig_bitwarden.install_dir }}" - instmtd: "{{ pkgconfig_bitwarden.install_method }}" - bindir: "{{ pkgconfig_bitwarden.install_prefix }}/bin" - owner: "{{ pkgconfig_bitwarden.owner }}" - - name: Append to flatpkgs when: - - ansible_os_family != 'Darwin' - - bw.instmtd == 'flatpak' - block: - - name: Ensure flatpak runtime activated - ansible.builtin.include_tasks: - file: pkgs/flatpak.yml - when: flatpak is undefined - - - name: Append to flatpkgs - ansible.builtin.set_fact: - flatpkgs: "{{ flatpkgs + [bw.flatpak] }}" + - bw.method == 'flatpak' + ansible.builtin.set_fact: + pkg_flatpak: "{{ pkg_flatpak + [bw.pkg] }}" - name: Append to srcpkgs when: - - ansible_os_family != 'Darwin' - - bw.instmtd == 'appimage' + - bw.method == 'appimage' ansible.builtin.set_fact: - syspkgs: "{{ appimages + ['bitwarden'] }}" + pkg_appimage: "{{ pkg_appimage + [bw.pkg] }}" - name: Append to caskpkgs - when: ansible_os_family == 'Darwin' + when: + - bw.method == 'brew' ansible.builtin.set_fact: - caskpkgs: "{{ caskpkgs + ['bitwarden'] }}" + pkg_cask: "{{ pkg_cask + [bw.pkg.name] }}" diff --git a/tasks/pkgs/fd.yml b/tasks/pkgs/fd.yml index 799f842..bc0e22b 100644 --- a/tasks/pkgs/fd.yml +++ b/tasks/pkgs/fd.yml @@ -1,5 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- name: append to syspkgs +- name: Append to pkg_sys ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + pkgconfig.fd.pkg[ansible_os_family] }}" + pkg_sys: "{{ pkg_sys + pkgconfig.fd.pkg[ansible_os_family] }}" diff --git a/tasks/pkgs/hyperfine.yml b/tasks/pkgs/hyperfine.yml index 640aba3..1a393d5 100644 --- a/tasks/pkgs/hyperfine.yml +++ b/tasks/pkgs/hyperfine.yml @@ -1,5 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- name: append to syspkgs +- name: Append to pkg_sys ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'hyperfine' ] }}" + pkg_sys: "{{ pkg_sys + ['hyperfine'] }}" diff --git a/tasks/pkgs/nerdfonts.yml b/tasks/pkgs/nerdfonts.yml index 287fe39..cfc9d2e 100644 --- a/tasks/pkgs/nerdfonts.yml +++ b/tasks/pkgs/nerdfonts.yml @@ -1,20 +1,14 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_vars: - file: nerdfonts.yml - name: _nerdfonts -- ansible.builtin.set_fact: - pkgconfig_nerdfonts: "{{ _nerdfonts | ansible.builtin.combine(pkgconfig.nerdfonts) }}" - -- name: append to srcpkgs +- name: Append to srcpkgs ansible.builtin.set_fact: - srcpkgs: "{{ srcpkgs + [ 'nerdfonts' ] }}" + pkg_archive: "{{ pkg_archive + ['nerdfonts'] }}" when: ansible_system == 'Linux' -- name: append to caskpkgs +- name: Append to caskpkgs ansible.builtin.set_fact: - caskpkgs: "{{ caskpkgs + [ pkgconfig_nerdfonts.fonts[font].brew ] }}" - loop: "{{ pkgconfig_nerdfonts.install }}" + pkg_cask: "{{ pkg_cask + [nerdfonts.fonts[font].brew] }}" + loop: "{{ nerdfonts.fonts }}" loop_control: loop_var: font when: ansible_system == 'Darwin' diff --git a/tasks/pkgs/stow.yml b/tasks/pkgs/stow.yml index 556cbe6..7792eca 100644 --- a/tasks/pkgs/stow.yml +++ b/tasks/pkgs/stow.yml @@ -1,5 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- name: append to pkgs +- name: Append to pkgs ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'stow' ] }}" + pkg_sys: "{{ pkg_sys + [ 'stow' ] }}" diff --git a/tasks/pkgs/zfs.yml b/tasks/pkgs/zfs.yml index 83cd170..cae72cd 100644 --- a/tasks/pkgs/zfs.yml +++ b/tasks/pkgs/zfs.yml @@ -1,68 +1,55 @@ # vim: set filetype=yaml.ansible : --- - name: Linux based installation + when: + - ansible_os_family != 'Darwin' block: - name: RedHat based configuration + when: + - ansible_os_family == 'RedHat' block: - - ansible.builtin.set_fact: - rhname: "{%if ansible_distribution == 'Fedora' %}fedora{% else %}epel{% endif %}" - - ansible.builtin.command: - cmd: rpm --eval "%{dist}" - register: rpm_dist - - - name: add openzfs gpg_key + - name: Add openzfs gpg_key + become: "{{ sys_pkg_become }}" ansible.builtin.rpm_key: - key: "{{ pkgconfig.zfs.gpg_key }}" - fingerprint: "{{ pkgconfig.zfs.gpg_key_fingerprint }}" + key: "{{ zfs.gpg_key }}" + fingerprint: "{{ zfs.gpg_fp }}" state: present - become: true - - name: enable openzfs repository + - name: Enable openzfs repository + become: "{{ sys_pkg_become }}" ansible.builtin.dnf: - name: "{{ pkgconfig.zfs.repo_base }}{{ rhname }}/zfs-release-{{ pkgconfig.zfs[rhname].release }}{{ rpm_dist.stdout }}.noarch.rpm" - state: "{{ install_state }}" - become: true - - - name: install zfs deps - ansible.builtin.set_fact: - syspkgs: "{{ pkgconfig.zfs.deps[ansible_os_family] }}" - when: ansible_os_family == 'RedHat' + name: "{{ zfs.repo_pkg }}" + state: present - name: Debian configuration when: ansible_os_family == 'Debian' block: - - name: enable openzfs repository + - name: Enable openzfs repository + become: "{{ sys_pkg_become }}" ansible.builtin.apt_repository: repo: | - deb http://deb.debian.org/debian {{ ansible_distribution_release }}-backports main contrib - deb-src http://deb.debian.org/debian {{ ansible_distribution_release }}-backports main contrib - filename: "{{ ansible_distribution_release }}-backports" + deb http://deb.debian.org/debian {{ zfs.release }}-backports main contrib + deb-src http://deb.debian.org/debian {{ zfs.release }}-backports main contrib + filename: "{{ zfs.release }}-backports" state: present update_cache: false - become: true - - name: pin zfs package to backports + - name: Pin zfs package to backports + become: "{{ sys_pkg_become }}" ansible.builtin.file: content: | Package: src:zfs-linux - Pin: release n={{ ansible_distribution_release }}-backports + Pin: release n={{ zfs.release }}-backports Pin-Priority: 990 dest: /etc/apt/preferences.d/90_zfs state: present - become: true + mode: '0644' - - name: install zfs deps - ansible.builtin.set_fact: - syspkgs: "{{ pkgconfig.zfs.deps[ansible_os_family] }}" - become: true - - - name: append to pkgs + - name: Append to pkgs ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + pkgconfig.zfs.pkgs[ansible_os_family] }}" - become: true - when: ansible_os_family != 'Darwin' + pkg_sys: "{{ pkg_sys + zfs.deps + zfs.pkgs }}" -- name: append to caskpkgs - ansible.builtin.set_fact: - caskpkgs: "{{ caskpkgs + [ 'openzfs' ] }}" +- name: Append to caskpkgs when: ansible_os_family == 'Darwin' + ansible.builtin.set_fact: + pkg_cask: "{{ pkg_cask + ['openzfs'] }}" diff --git a/tasks/pkgs/zsh.yml b/tasks/pkgs/zsh.yml index 7e9ff21..ca93dcd 100644 --- a/tasks/pkgs/zsh.yml +++ b/tasks/pkgs/zsh.yml @@ -1,10 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- name: append to pkgs +- name: Append to pkgs ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'zsh' ] }}" - when: ansible_os_family != 'Darwin' - -- debug: - msg: "macOS already has zsh, skipping" - when: ansible_os_family == 'Darwin' + pkg_sys: "{{ pkg_sys + ['zsh'] }}" diff --git a/tasks/src/nerdfonts.yml b/tasks/src/nerdfonts.yml deleted file mode 100644 index 546c88d..0000000 --- a/tasks/src/nerdfonts.yml +++ /dev/null @@ -1,37 +0,0 @@ -# vim: set filetype=yaml.ansible : -# Install nerdfonts for each platform ---- -- name: linux installation - when: ansible_system == 'Linux' - block: - - name: set install path for non-system installs - ansible.builtin.set_fact: - nerdfonts_install_path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.local/share/fonts" - when: not pkgconfig_nerdfonts.system_install - - - name: set install path for system wide installs - ansible.builtin.set_fact: - nerdfonts_install_path: "/usr/local/share/fonts" - when: pkgconfig_nerdfonts.system_install - - - name: create nerdfonts directories - ansible.builtin.file: - path: "{{ nerdfonts_install_path }}/{{ font }}" - state: directory - become: "{{ pkgconfig_nerdfonts.system_install }}" - loop: "{{ pkgconfig_nerdfonts.install }}" - loop_control: - loop_var: font - register: nerdfont_result - - - name: Download and extract nerdfonts - ansible.builtin.unarchive: - creates: "{{ nerdfonts_install_path }}/{{ font }}/README.md" - src: "{{ pkgconfig_nerdfonts.base_url }}/{{ font }}.tar.xz" - dest: "{{ nerdfonts_install_path }}/{{ font }}" - remote_src: true - when: nerdfont_result is changed - become: "{{ pkgconfig_nerdfonts.system_install }}" - loop: "{{ pkgconfig_nerdfonts.install }}" - loop_control: - loop_var: font diff --git a/vars/pkgs/bitwarden.yml b/vars/pkgs/bitwarden.yml index 7c2f823..d846a47 100644 --- a/vars/pkgs/bitwarden.yml +++ b/vars/pkgs/bitwarden.yml @@ -5,3 +5,13 @@ bitwarden: appimage: name: bitwarden.appimage url: https://vault.bitwarden.com/download/?app=desktop&platform=linux&variant=appimage + snap: + name: bitwarden + brew: + name: bitwarden + method: + RedHat: appimage + Debian: appimage + Fedora: flatpak + Ubuntu: snap + MacOSX: brew diff --git a/vars/pkgs/nerdfonts.yml b/vars/pkgs/nerdfonts.yml index 6b658ac..abcb1a1 100644 --- a/vars/pkgs/nerdfonts.yml +++ b/vars/pkgs/nerdfonts.yml @@ -137,3 +137,4 @@ nerdfonts: ZedMono: brew: font-zed-mono-nerd-font base_url: https://github.com/ryanoasis/nerd-fonts/releases/latest/download + path: share/fonts From c0400949c32a0c8c19a374165c53b4fdd9f8a0f6 Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Thu, 20 Feb 2025 12:22:50 -0700 Subject: [PATCH 21/38] more packages fixed - removed nushell. Not using it, not going to use again anytime soon --- tasks/cargo.yml | 6 +++--- tasks/config/broot.yml | 8 +++++++ tasks/config/choose.yml | 7 ++++++ tasks/config/git.yml | 6 ++++++ tasks/config/libreoffice.yml | 7 +++++- tasks/config/neovide.yml | 9 ++++++-- tasks/config/nushell.yml | 3 --- tasks/config/python3.yml | 5 +++++ tasks/config/xh.yml | 7 ++++++ tasks/config/zig.yml | 9 +++++--- tasks/pkgs/ansible-lint.yml | 4 ++-- tasks/pkgs/bat.yml | 4 ++-- tasks/pkgs/blender.yml | 8 +++---- tasks/pkgs/broot.yml | 21 ++++++------------ tasks/pkgs/btop.yml | 4 ++-- tasks/pkgs/choose.yml | 18 ++++++---------- tasks/pkgs/editorconfig.yml | 4 ++-- tasks/pkgs/fzf.yml | 4 ++-- tasks/pkgs/git.yml | 7 ++---- tasks/pkgs/libreoffice.yml | 41 +++++++++++++++--------------------- tasks/pkgs/neovide.yml | 25 ++++++++-------------- tasks/pkgs/nerdfonts.yml | 2 +- tasks/pkgs/nushell.yml | 26 ----------------------- tasks/pkgs/pipx.yml | 6 ++---- tasks/pkgs/python3-pip.yml | 7 ++---- tasks/pkgs/tmux.yml | 6 ++---- tasks/pkgs/xh.yml | 18 ++++++---------- tasks/src/nushell.yml | 19 ----------------- vars/pkgs/broot.yml | 1 + vars/pkgs/choose.yml | 2 ++ vars/pkgs/libreoffice.yml | 4 +++- vars/pkgs/neovide.yml | 1 + vars/pkgs/nushell.yml | 37 -------------------------------- vars/pkgs/xh.yml | 2 ++ 34 files changed, 132 insertions(+), 206 deletions(-) create mode 100644 tasks/config/broot.yml create mode 100644 tasks/config/choose.yml create mode 100644 tasks/config/git.yml delete mode 100644 tasks/config/nushell.yml create mode 100644 tasks/config/python3.yml create mode 100644 tasks/config/xh.yml delete mode 100644 tasks/pkgs/nushell.yml delete mode 100644 tasks/src/nushell.yml create mode 100644 vars/pkgs/choose.yml delete mode 100644 vars/pkgs/nushell.yml create mode 100644 vars/pkgs/xh.yml diff --git a/tasks/cargo.yml b/tasks/cargo.yml index 3c22986..d163ac7 100644 --- a/tasks/cargo.yml +++ b/tasks/cargo.yml @@ -3,7 +3,7 @@ - name: Install cargo pkg become: "{{ archive_become }}" community.general.cargo: - name: "{{ pkg.cargo.pkg }}" - version: "{{ pkg.ver }}" + name: "{{ pkg.name }}" + version: "{{ pkg.vers }}" path: "{{ paths.cargo }}" - locked: "{{ pkg.cargo.locked }}" + locked: "{{ pkg.locked | default(true) }}" diff --git a/tasks/config/broot.yml b/tasks/config/broot.yml new file mode 100644 index 0000000..89c6f1f --- /dev/null +++ b/tasks/config/broot.yml @@ -0,0 +1,8 @@ +--- +- name: Set broot config + ansible.builtin.set_fact: + broot: + vers: "{{ pkgconfig.broot.version }}" + name: broot + locked: true + deps: "{{ pkgconfig.broot.build_deps[ansible_os_family] }}" diff --git a/tasks/config/choose.yml b/tasks/config/choose.yml new file mode 100644 index 0000000..bdca115 --- /dev/null +++ b/tasks/config/choose.yml @@ -0,0 +1,7 @@ +--- +- name: Set choose config + ansible.builtin.set_fact: + choose: + name: choose + vers: "{{ pkgconfig.choose.version }}" + locked: true diff --git a/tasks/config/git.yml b/tasks/config/git.yml new file mode 100644 index 0000000..174d937 --- /dev/null +++ b/tasks/config/git.yml @@ -0,0 +1,6 @@ +# vim: set filetype=yaml.ansible : +--- +- name: Set git config + ansible.builtin.set_fact: + git: + pkgs: "{{ pkgconfig.git.pkgs[ansible_system] }}" diff --git a/tasks/config/libreoffice.yml b/tasks/config/libreoffice.yml index be06690..da006a8 100644 --- a/tasks/config/libreoffice.yml +++ b/tasks/config/libreoffice.yml @@ -1,3 +1,8 @@ # vim: set filetype=yaml.ansible : --- -use_flatpak: false +- name: Set libreoffice config + ansible.builtin.set_fact: + libreoffice: + method: "{{ pkgconfig.libreoffice.method }}" + flatpak: "{{ pkgconfig.libreoffice.flatpak }}" + syspkgs: "{{ pkgconfig.libreoffice[ansible_os_family] }}" diff --git a/tasks/config/neovide.yml b/tasks/config/neovide.yml index 79eea81..8f205ac 100644 --- a/tasks/config/neovide.yml +++ b/tasks/config/neovide.yml @@ -1,4 +1,9 @@ # vim: set filetype=yaml.ansible : --- -version: 0.14.0 -install_prefix: "{{ default_install_prefix }}" +- name: Set neovide config + ansible.builtin.set_fact: + neovide: + name: neovide + deps: "{{ pkgconfig.neovide.build_deps[ansible_os_family] }}" + vers: "{{ pkgconfig.neovide.version }}" + locked: true diff --git a/tasks/config/nushell.yml b/tasks/config/nushell.yml deleted file mode 100644 index 4bedf01..0000000 --- a/tasks/config/nushell.yml +++ /dev/null @@ -1,3 +0,0 @@ -# vim: set filetype=yaml.ansible : ---- -install_extra: true diff --git a/tasks/config/python3.yml b/tasks/config/python3.yml new file mode 100644 index 0000000..986bacb --- /dev/null +++ b/tasks/config/python3.yml @@ -0,0 +1,5 @@ +--- +- name: Set python3 config + ansible.builtin.set_fact: + python3: + pkgs: "{{ pkgconfig.python3.pkgs[ansible_system] }}" diff --git a/tasks/config/xh.yml b/tasks/config/xh.yml new file mode 100644 index 0000000..7a97674 --- /dev/null +++ b/tasks/config/xh.yml @@ -0,0 +1,7 @@ +--- +- name: Set xh config + ansible.builtin.set_fact: + xh: + vers: "{{ pkgconfig.xh.version }}" + name: xh + locked: true diff --git a/tasks/config/zig.yml b/tasks/config/zig.yml index ca65e2c..48270c4 100644 --- a/tasks/config/zig.yml +++ b/tasks/config/zig.yml @@ -1,5 +1,8 @@ # vim: set filetype=yaml.ansible : --- -version: 0.13.0 -install_prefix: "{{ default_install_prefix }}" -install_path: /opt/zig +- name: Set zig configuration + ansible.builtin.set_fact: + zig: + version: 0.13.0 + install_prefix: "{{ default_install_prefix }}" + install_path: /opt/zig diff --git a/tasks/pkgs/ansible-lint.yml b/tasks/pkgs/ansible-lint.yml index ae73c58..cd46295 100644 --- a/tasks/pkgs/ansible-lint.yml +++ b/tasks/pkgs/ansible-lint.yml @@ -1,5 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- name: append to pkgs +- name: Append to pkgs ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'ansible-lint' ] }}" + pkg_sys: "{{ pkg_sys + ['ansible-lint'] }}" diff --git a/tasks/pkgs/bat.yml b/tasks/pkgs/bat.yml index cfcbe11..1b86536 100644 --- a/tasks/pkgs/bat.yml +++ b/tasks/pkgs/bat.yml @@ -1,5 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- name: append to syspkgs +- name: Append to pkg_sys ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'bat' ] }}" + pkg_sys: "{{ pkg_sys + ['bat'] }}" diff --git a/tasks/pkgs/blender.yml b/tasks/pkgs/blender.yml index eece2b2..4de466d 100644 --- a/tasks/pkgs/blender.yml +++ b/tasks/pkgs/blender.yml @@ -1,11 +1,11 @@ # vim: set filetype=yaml.ansible : --- -- name: append to pkgs +- name: Append to pkgs ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'blender' ] }}" + pkg_sys: "{{ pkg_sys + ['blender'] }}" when: ansible_os_family != 'Darwin' -- name: append to caskpkgs +- name: Append to caskpkgs ansible.builtin.set_fact: - caskpkgs: "{{ caskpkgs + [ 'blender' ] }}" + pkg_cask: "{{ pkg_cask + ['blender'] }}" when: ansible_os_family == 'Darwin' diff --git a/tasks/pkgs/broot.yml b/tasks/pkgs/broot.yml index 417266a..a91750b 100644 --- a/tasks/pkgs/broot.yml +++ b/tasks/pkgs/broot.yml @@ -1,21 +1,14 @@ # vim: set filetype=yaml.ansible : --- -- name: linux specific install - block: - - ansible.builtin.include_tasks: - file: "pkgs/rust.yml" - when: pkgconfig_rust is undefined - - - name: append to syspkgs and cargopkgs - ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + pkgconfig.broot.deps[ansible_os_family] }}" - cargopkgs: "{{ cargopkgs + [ 'broot' ] }}" - +- name: Append to pkg_sys and pkg_cargo when: - ansible_os_family != 'Darwin' - -- name: append to syspkgs ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'broot' ] }}" + pkg_sys: "{{ pkg_sys + broot.deps }}" + pkg_cargo: "{{ pkg_cargo + [broot] }}" + +- name: Append to pkg_sys when: - ansible_os_family == 'Darwin' + ansible.builtin.set_fact: + pkg_sys: "{{ pkg_sys + ['broot'] }}" diff --git a/tasks/pkgs/btop.yml b/tasks/pkgs/btop.yml index 2ca6525..96448e2 100644 --- a/tasks/pkgs/btop.yml +++ b/tasks/pkgs/btop.yml @@ -1,5 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- name: append to pkgs +- name: Append to pkgs ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'btop' ] }}" + pkg_sys: "{{ pkg_sys + ['btop'] }}" diff --git a/tasks/pkgs/choose.yml b/tasks/pkgs/choose.yml index 7df38b8..5bddfc7 100644 --- a/tasks/pkgs/choose.yml +++ b/tasks/pkgs/choose.yml @@ -1,19 +1,13 @@ # vim: set filetype=yaml.ansible : --- -- name: linux specific - block: - - ansible.builtin.include_tasks: - file: "pkgs/rust.yml" - when: - - pkgconfig_rust is undefined - - name: append to cargopkgs - ansible.builtin.set_fact: - cargopkgs: "{{ cargopkgs + [ 'choose' ] }}" +- name: Append to cargopkgs when: - ansible_os_family != 'Darwin' - -- name: append to syspkgs ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'choose-rust' ] }}" + pkg_cargo: "{{ pkg_cargo + [choose] }}" + +- name: Append to pkg_sys when: - ansible_os_family == 'Darwin' + ansible.builtin.set_fact: + pkg_sys: "{{ pkg_sys + ['choose-rust'] }}" diff --git a/tasks/pkgs/editorconfig.yml b/tasks/pkgs/editorconfig.yml index a1c9c50..3622ecd 100644 --- a/tasks/pkgs/editorconfig.yml +++ b/tasks/pkgs/editorconfig.yml @@ -1,5 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- name: append to pkgs +- name: Append to pkgs ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'editorconfig' ] }}" + pkg_sys: "{{ pkg_sys + ['editorconfig'] }}" diff --git a/tasks/pkgs/fzf.yml b/tasks/pkgs/fzf.yml index 5bd7e5c..ee9ea30 100644 --- a/tasks/pkgs/fzf.yml +++ b/tasks/pkgs/fzf.yml @@ -1,5 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- name: append to pkgs +- name: Append to pkgs ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'fzf' ] }}" + pkg_sys: "{{ pkg_sys + ['fzf'] }}" diff --git a/tasks/pkgs/git.yml b/tasks/pkgs/git.yml index f07bf34..f5ec4a5 100644 --- a/tasks/pkgs/git.yml +++ b/tasks/pkgs/git.yml @@ -1,8 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.set_fact: - git: true - -- name: append to pkgs +- name: Append to pkgs ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + pkgconfig.git.pkgs[ansible_system] }}" + pkg_sys: "{{ pkg_sys + git.pkgs }}" diff --git a/tasks/pkgs/libreoffice.yml b/tasks/pkgs/libreoffice.yml index d8afbd4..a20c153 100644 --- a/tasks/pkgs/libreoffice.yml +++ b/tasks/pkgs/libreoffice.yml @@ -1,30 +1,23 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_vars: - file: libreoffice.yml - name: _libreoffice -- ansible.builtin.set_fact: - pkgconfig_libreoffice: "{{ _libreoffice | ansible.builtin.combine(pkgconfig.libreoffice) }}" - -- block: - - ansible.builtin.include_tasks: - file: pkgs/flatpak.yml - when: flatpak is undefined - - name: append to flatpkgs +- name: Linux specific methods + when: + - ansible_system == 'Linux' + block: + - name: Append to flatpkgs + when: + - libreoffice.method == 'flatpak' ansible.builtin.set_fact: - flatpkgs: "{{ flatpkgs + pkgconfig_libreoffice.flatpak }}" - when: - - ansible_os_family != 'Darwin' - - pkgconfig_libreoffice.use_flatpak + flatpkgs: "{{ flatpkgs + libreoffice.flatpak }}" -- block: - - ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + pkgconfig_libreoffice[ansible_os_family] }}" - when: - - ansible_os_family != 'Darwin' - - not pkgconfig_libreoffice.use_flatpak + - name: Append to pkg_sys + when: + - libreoffice.method == 'sys' + ansible.builtin.set_fact: + sys_pkg: "{{ sys_pkg + libreoffice.syspkgs }}" -- name: append to caskpkgs +- name: Append to caskpkgs + when: + - ansible_system == 'Darwin' ansible.builtin.set_fact: - caskpkgs: "{{ caskpkgs + [ 'libreoffice' ] }}" - when: ansible_os_family == 'Darwin' + pkg_cask: "{{ pkg_cask + ['libreoffice'] }}" diff --git a/tasks/pkgs/neovide.yml b/tasks/pkgs/neovide.yml index 3b2360b..3618477 100644 --- a/tasks/pkgs/neovide.yml +++ b/tasks/pkgs/neovide.yml @@ -1,21 +1,14 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_vars: - file: neovide.yml - name: _neovide -- ansible.builtin.set_fact: - pkgconfig_neovide: "{{ _neovide | ansible.builtin.combine(pkgconfig.neovide) }}" -- ansible.builtin.include_tasks: - file: pkgs/rust.yml - when: pkgconfig_rust is undefined - -- name: append to pkgs +- name: Append to pkgs + when: + - ansible_system == 'Linux' ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + pkgconfig_neovide.deps[ansible_os_family] }}" - srcpkgs: "{{ srcpkgs + [ 'neovide' ] }}" - when: ansible_system == 'Linux' + pkg_sys: "{{ pkg_sys + neovide.deps }}" + pkg_cargo: "{{ pkg_cargo + [neovide] }}" -- name: append neovide to caskpkgs +- name: Append neovide to caskpkgs + when: + - ansible_system == 'Darwin' ansible.builtin.set_fact: - caskpkgs: "{{ caskpkgs + [ 'neovide' ] }}" - when: ansible_system == 'Darwin' + pkg_cask: "{{ pkg_cask + ['neovide'] }}" diff --git a/tasks/pkgs/nerdfonts.yml b/tasks/pkgs/nerdfonts.yml index cfc9d2e..b489d6b 100644 --- a/tasks/pkgs/nerdfonts.yml +++ b/tasks/pkgs/nerdfonts.yml @@ -7,7 +7,7 @@ - name: Append to caskpkgs ansible.builtin.set_fact: - pkg_cask: "{{ pkg_cask + [nerdfonts.fonts[font].brew] }}" + pkg_cask: "{{ pkg_cask + [pkgconfig.nerdfonts.fonts[font].brew] }}" loop: "{{ nerdfonts.fonts }}" loop_control: loop_var: font diff --git a/tasks/pkgs/nushell.yml b/tasks/pkgs/nushell.yml deleted file mode 100644 index 332843e..0000000 --- a/tasks/pkgs/nushell.yml +++ /dev/null @@ -1,26 +0,0 @@ -# vim: set filetype=yaml.ansible : ---- -- ansible.builtin.include_vars: - file: nushell.yml - name: _nushell -- ansible.builtin.set_fact: - pkgconfig_nushell: "{{ _nushell | ansible.builtin.combine(pkgconfig.nushell) }}" - -- ansible.builtin.include_tasks: - file: pkgs/rust.yml - when: pkgconfig_rust is undefined - -- ansible.builtin.include_tasks: - file: pkgs/carapace.yml - when: pkgconfig_carapace is undefined - -- name: append to pkgs - ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + pkgconfig_nushell.deps[ansible_os_family] }}" - cargopkgs: "{{ cargopkgs + pkgconfig_nushell.pkgs[ansible_os_family] }}" - -- name: add nushell extras - ansible.builtin.set_fact: - cargopkgs: "{{ cargopkgs + pkgconfig_nushell.nupkgs_extra }}" - when: - pkgconfig_nushell.install_extra diff --git a/tasks/pkgs/pipx.yml b/tasks/pkgs/pipx.yml index 8c353c1..dcfe774 100644 --- a/tasks/pkgs/pipx.yml +++ b/tasks/pkgs/pipx.yml @@ -1,7 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.set_fact: - pipx: true -- name: append to pkgs +- name: Append to pkgs ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'pipx' ] }}" + pkg_sys: "{{ pkg_sys + ['pipx'] }}" diff --git a/tasks/pkgs/python3-pip.yml b/tasks/pkgs/python3-pip.yml index d568f87..f784fb4 100644 --- a/tasks/pkgs/python3-pip.yml +++ b/tasks/pkgs/python3-pip.yml @@ -1,8 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.set_fact: - python3: true - -- name: append to pkgs +- name: Append to pkgs ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + pkgconfig.python3.pkgs[ansible_system] }}" + pkg_sys: "{{ pkg_sys + python3.pkgs }}" diff --git a/tasks/pkgs/tmux.yml b/tasks/pkgs/tmux.yml index 98d489c..663e09d 100644 --- a/tasks/pkgs/tmux.yml +++ b/tasks/pkgs/tmux.yml @@ -1,7 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- name: append to pkgs +- name: Append to pkgs ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'tmux' ] }}" - tags: - - packages + pkg_sys: "{{ pkg_sys + ['tmux'] }}" diff --git a/tasks/pkgs/xh.yml b/tasks/pkgs/xh.yml index b8afd36..2162acf 100644 --- a/tasks/pkgs/xh.yml +++ b/tasks/pkgs/xh.yml @@ -1,19 +1,13 @@ # vim: set filetype=yaml.ansible : --- -- name: append to syspkgs - ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'xh' ] }}" +- name: Append to pkg_sys when: - ansible_os_family == 'Darwin' + ansible.builtin.set_fact: + pkg_sys: "{{ pkg_sys + ['xh'] }}" -- name: linux specific install - block: - - ansible.builtin.include_tasks: - file: "pkgs/rust.yml" - when: pkgconfig_rust is undefined - - - name: add to cargopkgs - ansible.builtin.set_fact: - cargopkgs: "{{ cargopkgs + [ 'xh' ] }}" +- name: Add to cargopkgs when: - ansible_os_family != 'Darwin' + ansible.builtin.set_fact: + pkg_cargo: "{{ pkg_cargo + [xh] }}" diff --git a/tasks/src/nushell.yml b/tasks/src/nushell.yml deleted file mode 100644 index 94b1828..0000000 --- a/tasks/src/nushell.yml +++ /dev/null @@ -1,19 +0,0 @@ -# vim: set filetype=yaml.ansible : ---- -- ansible.builtin.include_vars: - file: nushell.yml - name: _nushell - -- name: install nushell via cargo - become: true - ansible.builtin.command: - cmd: - - cargo - - install - - --root - - "{{ _nushell.install_prefix }}" - - "{{ nuitem }}" - - --locked - loop_control: - loop_var: nuitem - loop: "{{ _nushell.nu_pkgs_list }}" diff --git a/vars/pkgs/broot.yml b/vars/pkgs/broot.yml index 69db166..40a9f2b 100644 --- a/vars/pkgs/broot.yml +++ b/vars/pkgs/broot.yml @@ -1,4 +1,5 @@ broot: + version: 1.44.7 build_deps: Debian: - build-essential diff --git a/vars/pkgs/choose.yml b/vars/pkgs/choose.yml new file mode 100644 index 0000000..b07ea00 --- /dev/null +++ b/vars/pkgs/choose.yml @@ -0,0 +1,2 @@ +choose: + version: 1.3.6 diff --git a/vars/pkgs/libreoffice.yml b/vars/pkgs/libreoffice.yml index 5604c0f..de536f6 100644 --- a/vars/pkgs/libreoffice.yml +++ b/vars/pkgs/libreoffice.yml @@ -1,6 +1,8 @@ libreoffice: + method: flatpak flatpak: - - org.libreoffice.LibreOffice + name: org.libreoffice.LibreOffice + remote: flathub Debian: - libreoffice RedHat: diff --git a/vars/pkgs/neovide.yml b/vars/pkgs/neovide.yml index f32e2f1..b26ee0c 100644 --- a/vars/pkgs/neovide.yml +++ b/vars/pkgs/neovide.yml @@ -1,4 +1,5 @@ neovide: + version: 0.14.0 git_repo: https://github.com/neovide/neovide.git build_deps: RedHat: diff --git a/vars/pkgs/nushell.yml b/vars/pkgs/nushell.yml deleted file mode 100644 index 6a58049..0000000 --- a/vars/pkgs/nushell.yml +++ /dev/null @@ -1,37 +0,0 @@ -nushell: - build_deps: - Darwin: - - openssl - - cmake - Debian: - - pkg-config - - libssl-dev - - build-essential - RedHat: - - libxcb - - openssl-devel - - libX11-devel - nupkgs_extra: [] - nupkgs_common: - - nu - - nu_plugin_compress - - nu_plugin_desktop_notifications - - nu_plugin_dns - - nu_plugin_file_dialog - - nu_plugin_formats - - nu_plugin_gstat - - nu_plugin_hashes - - nu_plugin_hcl - - nu_plugin_highlight - - nu_plugin_inc - - nu_plugin_json_path - - nu_plugin_net - - nu_plugin_polars - - nu_plugin_query - - nu_plugin_selector - pkgs: - Darwin: - - nu_plugin_plist - Debian: [] - RedHat: - - nu_plugin_rpm diff --git a/vars/pkgs/xh.yml b/vars/pkgs/xh.yml new file mode 100644 index 0000000..c0c70ac --- /dev/null +++ b/vars/pkgs/xh.yml @@ -0,0 +1,2 @@ +xh: + version: 0.24.0 From 41b1acc06710d674696745029884bee761b72a46 Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Thu, 20 Feb 2025 15:03:54 -0700 Subject: [PATCH 22/38] more fixs for packages --- handlers/main.yml | 2 +- tasks/addpkg.yml | 22 +------- tasks/archive/luals.yml | 36 ++++++++++++ tasks/config/alacritty.yml | 11 ++-- tasks/config/carapace.yml | 6 +- tasks/config/clangd.yml | 4 ++ tasks/config/consul.yml | 4 ++ tasks/config/hashicorp.yml | 13 +++++ tasks/config/kitty.yml | 4 ++ tasks/config/libreoffice.yml | 2 +- tasks/config/lua-language-server.yml | 5 -- tasks/config/luals.yml | 14 +++++ tasks/config/nerdfonts.yml | 2 +- tasks/config/zfs.yml | 14 +---- tasks/config/zig.yml | 4 +- tasks/facts.yml | 26 ++++++--- tasks/main.yml | 8 +-- tasks/pkgs/alacritty.yml | 12 ++-- tasks/pkgs/carapace.yml | 32 +++++------ tasks/pkgs/clangd.yml | 8 +-- tasks/pkgs/consul.yml | 21 +++---- tasks/pkgs/hashicorp.yml | 3 + tasks/pkgs/kitty.yml | 4 +- tasks/pkgs/libreoffice.yml | 2 +- tasks/pkgs/lua-language-server.yml | 22 ++------ .../{hashicorp_repo.yml => hashicorp.yml} | 4 -- tasks/repos/{terra_repo.yml => terra.yml} | 0 tasks/src/alacritty.yml | 7 --- tasks/src/lua-language-server.yml | 56 ------------------- vars/pkgs/alacritty.yml | 10 +--- vars/pkgs/carapace.yml | 10 ++++ vars/pkgs/consul.yml | 7 ++- vars/pkgs/hashicorp.yml | 6 +- vars/pkgs/luals.yml | 1 + 34 files changed, 181 insertions(+), 201 deletions(-) create mode 100644 tasks/archive/luals.yml create mode 100644 tasks/config/clangd.yml create mode 100644 tasks/config/consul.yml create mode 100644 tasks/config/hashicorp.yml create mode 100644 tasks/config/kitty.yml delete mode 100644 tasks/config/lua-language-server.yml create mode 100644 tasks/config/luals.yml create mode 100644 tasks/pkgs/hashicorp.yml rename tasks/repos/{hashicorp_repo.yml => hashicorp.yml} (96%) rename tasks/repos/{terra_repo.yml => terra.yml} (100%) delete mode 100644 tasks/src/alacritty.yml delete mode 100644 tasks/src/lua-language-server.yml diff --git a/handlers/main.yml b/handlers/main.yml index bea301b..a82b36c 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,6 +1,6 @@ # vim: set filetype=yaml.ansible : --- -- name: Depend go +- name: Dep end go ansible.builtin.include_tasks: file: addpkg.yml vars: diff --git a/tasks/addpkg.yml b/tasks/addpkg.yml index 111855a..3935707 100644 --- a/tasks/addpkg.yml +++ b/tasks/addpkg.yml @@ -1,31 +1,11 @@ # vim: set filetype=yaml.ansible : --- -- name: "Check if task exists for {{ pkg }}" - ansible.builtin.stat: - path: "{{ role_path }}/tasks/pkgs/{{ pkg }}.yml" - register: stat_pkg - -- name: Dump stat_pkg - ansible.builtin.debug: - var: stat_pkg - -- name: "Check if specialized configuration exists for {{ pkg }}" - ansible.builtin.stat: - path: "{{ role_path }}/tasks/config/{{ pkg }}.yml" - register: stat_config - -- name: Dump stat_config - ansible.builtin.debug: - var: stat_config - - name: "Load specialized configuration if it exists for {{ pkg }}" when: - - stat_config.stat.exists + - pkgconfig[pkg] is defined ansible.builtin.include_tasks: file: "config/{{ pkg }}.yml" - name: "Add include task for {{ pkg }}" - when: - - stat_pkg.stat.exists ansible.builtin.include_tasks: file: "pkgs/{{ pkg }}.yml" diff --git a/tasks/archive/luals.yml b/tasks/archive/luals.yml new file mode 100644 index 0000000..b0af1f5 --- /dev/null +++ b/tasks/archive/luals.yml @@ -0,0 +1,36 @@ +# vim: set filetype=yaml.ansible : +--- +- name: Create temp path + register: d_luals_dl_tmp + ansible.builtin.tempfile: + state: directory + prefix: luals_dl. + +- name: Get latest lua-language-server + become: "{{ ext_become }}" + ansible.builtin.get_url: + dest: "{{ d_luals_dl_tmp.path }}/{{ luals_vars.archive }}" + url: "{{ luals_vars.url }}/{{ luals_vars.archive }}" + mode: "0644" + decompress: false + +- name: Create install_path + become: "{{ ext_become }}" + ansible.builtin.file: + state: directory + path: "{{ path.archive }}/luals" + mode: "0755" + +- name: Extract lua language server archive + become: "{{ ext_become }}" + ansible.builtin.unarchive: + dest: "{{ path.archive }}/luals" + src: "{{ d_luals_dl_tmp.path }}/{{ luals_vars.archive }}" + remote_src: true + +- name: Link lua language server binary + become: "{{ ext_become }}" + ansible.builtin.file: + state: link + src: "{{ path.bin }}/lua-language-server" + path: "{{ path.archive }}/luals/bin/lua-language-server" diff --git a/tasks/config/alacritty.yml b/tasks/config/alacritty.yml index 3b8e511..5a26957 100644 --- a/tasks/config/alacritty.yml +++ b/tasks/config/alacritty.yml @@ -4,10 +4,7 @@ ansible.builtin.set_fact: alacritty: deps: "{{ pkgconfig.alacritty[ansible_os_family].build_deps }}" - ver: "{{ pkgconfig.alacritty.version }}" - repo: "{{ pkgconfig.alacritty.git_repo }}" - pkgs: "{{ pkgconfig.alacritty[ansible_os_family].pkgs | default(omit) }}" - bin: "{{ paths.install }}/bin/alacritty" - cargo: - locked: true - pkg: alacritty + vers: "{{ pkgconfig.alacritty.version }}" + cask: "{{ pkgconfig.alacritty.cask | default(omit) }}" + locked: true + name: alacritty diff --git a/tasks/config/carapace.yml b/tasks/config/carapace.yml index 431be9c..1263a5f 100644 --- a/tasks/config/carapace.yml +++ b/tasks/config/carapace.yml @@ -1,3 +1,7 @@ # vim: set filetype=yaml.ansible : --- -version: 1.1.1 +- name: Set carapace config + ansible.builtin.set_fact: + carapace: + pkgs: "{{ pkgconfig.carapace.pkgs[ansible_system] }}" + repo: "{{ pkgconfig.carapace.repo[ansible_os_family] }}" diff --git a/tasks/config/clangd.yml b/tasks/config/clangd.yml new file mode 100644 index 0000000..6777ccb --- /dev/null +++ b/tasks/config/clangd.yml @@ -0,0 +1,4 @@ +- name: Set clangd config + ansible.builtin.set_fact: + clangd: + pkgs: "{{ pkgconfig.clangd.pkg[ansible_os_family] }}" diff --git a/tasks/config/consul.yml b/tasks/config/consul.yml new file mode 100644 index 0000000..379cc81 --- /dev/null +++ b/tasks/config/consul.yml @@ -0,0 +1,4 @@ +- name: Set configuration for consul + ansible.builtin.set_fact: + consul: + pkgs: "{{ pkgconfig.consul.pkgs[ansible_system] }}" diff --git a/tasks/config/hashicorp.yml b/tasks/config/hashicorp.yml new file mode 100644 index 0000000..fb4bf55 --- /dev/null +++ b/tasks/config/hashicorp.yml @@ -0,0 +1,13 @@ +- name: Set OS name for RedHat family + when: + - ansible_os_famly == 'RedHat' + ansible.builtin.set_fact: + hashicorp: + repo: "{{ pkgconfig.hashicorp.Linux[rpm_dist.stdout] }}" + +- name: Set repo for debian + when: + - ansible_os_family == 'Debian' + ansible.builtin.set_Fact: + hashicorp: + repo: "{{ pkgconfig.hashicorp.Linux.Debian }}" diff --git a/tasks/config/kitty.yml b/tasks/config/kitty.yml new file mode 100644 index 0000000..cb964ec --- /dev/null +++ b/tasks/config/kitty.yml @@ -0,0 +1,4 @@ +- name: Set kitty config + ansible.buitlin.set_fact: + kitty: + pkgs: "{{ pkgconfig.kitty.pkgs[ansible_system] }}" diff --git a/tasks/config/libreoffice.yml b/tasks/config/libreoffice.yml index da006a8..33b99ce 100644 --- a/tasks/config/libreoffice.yml +++ b/tasks/config/libreoffice.yml @@ -5,4 +5,4 @@ libreoffice: method: "{{ pkgconfig.libreoffice.method }}" flatpak: "{{ pkgconfig.libreoffice.flatpak }}" - syspkgs: "{{ pkgconfig.libreoffice[ansible_os_family] }}" + pkgs: "{{ pkgconfig.libreoffice[ansible_os_family] }}" diff --git a/tasks/config/lua-language-server.yml b/tasks/config/lua-language-server.yml deleted file mode 100644 index ab39904..0000000 --- a/tasks/config/lua-language-server.yml +++ /dev/null @@ -1,5 +0,0 @@ -# vim: set filetype=yaml.ansible : ---- -version: 3.13.5 -install_prefix: "{{ default_install_prefix }}" -install_path: /opt/lua-language-server diff --git a/tasks/config/luals.yml b/tasks/config/luals.yml new file mode 100644 index 0000000..fb78ce4 --- /dev/null +++ b/tasks/config/luals.yml @@ -0,0 +1,14 @@ +# vim: set filetype=yaml.ansible : +--- +- name: Set luals config + ansible.builtin.set_fact: + luals: + vers: "{{ pkgconfig.luals.version }}" + sys: "{{ pkgconfig.luals.sysmap[ansible_system] }}" + arch: "{{ pkgconfig.luals.archmap[ansible_architecture] }}" + +- name: Set luals variables + ansible.builtin.set_fact: + luals_vars: + archive: "lua-language-server-{{ luals.vers }}-{{ luals.sys }}-{{ luals.arch }}.tar.gz" + url: "{{ pkgconfig.luals.base_url }}/{{ luals.vers }}" diff --git a/tasks/config/nerdfonts.yml b/tasks/config/nerdfonts.yml index d7155f0..45b951a 100644 --- a/tasks/config/nerdfonts.yml +++ b/tasks/config/nerdfonts.yml @@ -10,6 +10,6 @@ - Lilex - Monoid - NerdFontsSymbolsOnly - install_path: "{{ path_prefix }}/{{ pkgconfig.nerdfonts.path }}" + install_path: "{{ path.prefix }}/{{ pkgconfig.nerdfonts.path }}" base_url: "{{ pkgconfig.nerdfonts.base_url }}" force_install: "{{ pkgconfig.force_install_nerdfonts | default(false) }}" diff --git a/tasks/config/zfs.yml b/tasks/config/zfs.yml index 8fab6e4..3de179f 100644 --- a/tasks/config/zfs.yml +++ b/tasks/config/zfs.yml @@ -1,17 +1,9 @@ --- -- name: Set zfs facts for RedHat based distros +- name: Set distro name when: - ansible_os_family == 'RedHat' - block: - - name: Set distro name - ansible.builtin.set_fact: - rhname: "{%if ansible_distribution == 'Fedora' %}fedora{% else %}epel{% endif %}" - - - name: Get rpm_dist for RedHat - changed_when: false - register: rpm_dist - ansible.builtin.command: # is there a better way to get this? - cmd: rpm --eval "%{dist}" + ansible.builtin.set_fact: + rhname: "{%if ansible_distribution == 'Fedora' %}fedora{% else %}epel{% endif %}" - name: Set ZFS config ansible.builtin.set_fact: diff --git a/tasks/config/zig.yml b/tasks/config/zig.yml index 48270c4..ab09d5a 100644 --- a/tasks/config/zig.yml +++ b/tasks/config/zig.yml @@ -4,5 +4,5 @@ ansible.builtin.set_fact: zig: version: 0.13.0 - install_prefix: "{{ default_install_prefix }}" - install_path: /opt/zig + install_prefix: "{{ path.prefix }}" + install_path: "{{ path.archive }}/zig" diff --git a/tasks/facts.yml b/tasks/facts.yml index ea9f02b..6455071 100644 --- a/tasks/facts.yml +++ b/tasks/facts.yml @@ -3,7 +3,8 @@ - name: Set facts for installation ansible.builtin.set_fact: ext_become: "{{ not use_local }}" - path_prefix: "{% if use_local %}{{ lookup('ansible.builtin.env', 'HOME') }}/.local{% else %}{{ defaults.path.prefix }}{% endif %}" + path: + prefix: "{% if use_local %}{{ lookup('ansible.builtin.env', 'HOME') }}/.local{% else %}{{ defaults.path.prefix }}{% endif %}" - name: Set Linux specific facts when: @@ -18,6 +19,14 @@ pkg_snap: [] # snpacraft.io packages sys_pkg_become: true # Linux package managers require sudo access +- name: Set rpm dist if RedHat based + when: + - ansible_os_family == 'RedHat' + changed_when: false + register: rpm_dist + ansible.builtin.command: + cmd: rpm --eval "%{dist}" + - name: Set macOS specific facts when: - ansible_distribution == 'MacOSX' @@ -30,13 +39,14 @@ - name: Set paths ansible.builtin.set_fact: - paths: - appimage: "{{ appimage_path | default(path_prefix ~ defaults.path.suffix.appimage) }}" - archive: "{{ archive_path | default(path_prefix ~ defaults.path.suffix.archive) }}" - bin: "{{ bin_path | default(path_prefix ~ defaults.path.suffix.bin) }}" - cargo: "{{ cargo_path | default(path_prefix ~ defaults.path.suffix.cargo) }}" - go: "{{ goroot | default(path_prefix ~ defaults.path.suffix.go) }}" - pipx: "{{ pipx_path | default(path_prefix ~ defaults.path.suffix.pipx) }}" + path: + prefix: "{{ path.prefix }}" + appimage: "{{ path.appimage | default(path.prefix ~ defaults.path.suffix.appimage) }}" + archive: "{{ path.archive | default(path.prefix ~ defaults.path.suffix.archive) }}" + bin: "{{ path.bin | default(path.prefix ~ defaults.path.suffix.bin) }}" + cargo: "{{ path.cargo | default(path.prefix ~ defaults.path.suffix.cargo) }}" + go: "{{ path.go | default(path.prefix ~ defaults.path.suffix.go) }}" + pipx: "{{ path.pipx | default(path.prefix ~ defaults.path.suffix.pipx) }}" - name: Set OS independant facts ansible.builtin.set_fact: diff --git a/tasks/main.yml b/tasks/main.yml index a9d097f..f4169de 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -6,15 +6,15 @@ ansible.builtin.include_tasks: file: facts.yml -- name: Ensure required paths exist +- name: Ensure required path exist become: "{{ ext_become }}" - loop: "{{ paths | dict2items }}" + loop: "{{ path | dict2items }}" loop_control: - loop_var: path + loop_var: p ansible.builtin.file: state: directory mode: '0755' - path: "{{ path.value }}" + path: "{{ p.value }}" - name: Read default package configuration ansible.builtin.include_vars: diff --git a/tasks/pkgs/alacritty.yml b/tasks/pkgs/alacritty.yml index 9a50439..36d737f 100644 --- a/tasks/pkgs/alacritty.yml +++ b/tasks/pkgs/alacritty.yml @@ -1,16 +1,18 @@ # vim: set filetype=yaml.ansible : --- - name: Linux based installation - when: ansible_system == 'Linux' + when: + - ansible_system == 'Linux' block: - name: Append to pkgs notify: - Depend cargo ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + alacritty.deps }}" - srcpkgs: "{{ cargopkgs + [alacritty] }}" + pkg_sys: "{{ pkg_sys + alacritty.deps }}" + pkg_cargo: "{{ pkg_cargo + [alacritty] }}" - name: Append alacritty to caskpkgs + when: + - ansible_system == 'Darwin' ansible.builtin.set_fact: - caskpkgs: "{{ caskpkgs + alacritty.pkgs }}" - when: ansible_system == 'Darwin' + caskpkgs: "{{ caskpkgs + alacritty.cask }}" diff --git a/tasks/pkgs/carapace.yml b/tasks/pkgs/carapace.yml index fc9d0cb..e951935 100644 --- a/tasks/pkgs/carapace.yml +++ b/tasks/pkgs/carapace.yml @@ -1,31 +1,27 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_vars: - file: carapace.yml - name: _carapace -- ansible.builtin.set_fact: - pkgconfig_carapace: "{{ _carapace | ansible.builtin.combine(pkgconfig.carapace) }}" - -- name: enable carapace yum repository +- name: Enable carapace yum repository + when: + - ansible_os_family == 'RedHat' + become: true ansible.builtin.yum_repository: - name: carapace-yum - description: carapace-yum - baseurl: https://yum.fury.io/rsteube/ + name: "{{ carapace.repo.name }}" + description: "{{ carapace.repo.description }}" + baseurl: "{{ charapace.repo.baseurl }}" enabled: true gpgcheck: false state: present - when: ansible_os_family == 'RedHat' - become: true -- name: enable carapace apt repository +- name: Enable carapace apt repository + when: + - ansible_os_family == 'Debian' become: true ansible.builtin.apt_repository: - repo: "deb [trusted=yes] https://apt.fury.io/rsteube/ /" + repo: "{{ carapace.repo.repo }}" + filename: "{{ carapace.repo.name }}" state: present update_cache: false - filename: carapace - when: ansible_os_family == 'Debian' -- name: add carapace to syspkgs +- name: Add carapace to pkg_sys ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + pkgconfig_carapace.pkgs[ansible_system] }}" + pkg_sys: "{{ pkg_sys + carapace.pkgs }}" diff --git a/tasks/pkgs/clangd.yml b/tasks/pkgs/clangd.yml index e6de283..d7ee19d 100644 --- a/tasks/pkgs/clangd.yml +++ b/tasks/pkgs/clangd.yml @@ -1,7 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.set_fact: - clangd: true - -- ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + pkgconfig.clangd.pkgs[ansible_os_family] }}" +- name: Append clangd to pkg_sys + ansible.builtin.set_fact: + pkg_sys: "{{ pkg_sys + clangd.pkgs }}" diff --git a/tasks/pkgs/consul.yml b/tasks/pkgs/consul.yml index 888e435..df8987a 100644 --- a/tasks/pkgs/consul.yml +++ b/tasks/pkgs/consul.yml @@ -1,16 +1,13 @@ # vim: set filetype=yaml.ansible : -# load hashicorp configuration --- -- name: ensure hashicorp repo is active - ansible.builtin.include_tasks: - file: "pkgs/hashicorp_repo.yml" - when: hashicorp is undefined - -- name: append to syspkgs +- name: Append to pkg_sys + when: + - ansible_system == 'Linux' ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ pkgconfig.consul[ansible_system] ] }}" - when: ansible_system == 'Linux' + pkg_sys: "{{ pkg_sys + consul.pkgs }}" -- ansible.builtin.set_fact: - tappkgs: "{{ tappkgs + [ pkgconfig.consul[ansible_system] ] }}" - when: ansible_system == 'Darwin' +- name: Append to pkg_tap + when: + - ansible_system == 'Darwin' + ansible.builtin.set_fact: + pkg_tap: "{{ pkg_tap + consul.pkgs }}" diff --git a/tasks/pkgs/hashicorp.yml b/tasks/pkgs/hashicorp.yml new file mode 100644 index 0000000..3f73007 --- /dev/null +++ b/tasks/pkgs/hashicorp.yml @@ -0,0 +1,3 @@ +- name: Enable hashicorp repository + ansible.builtin.include_tasks: + file: repos/hashicorp.yml diff --git a/tasks/pkgs/kitty.yml b/tasks/pkgs/kitty.yml index 9988f12..a814194 100644 --- a/tasks/pkgs/kitty.yml +++ b/tasks/pkgs/kitty.yml @@ -1,5 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- name: add to syspkgs +- name: Add to pkg_sys ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + pkgconfig.kitty.pkgs[ansible_system] }}" + pkg_sys: "{{ pkg_sys + kitty.pkgs }}" diff --git a/tasks/pkgs/libreoffice.yml b/tasks/pkgs/libreoffice.yml index a20c153..05b13eb 100644 --- a/tasks/pkgs/libreoffice.yml +++ b/tasks/pkgs/libreoffice.yml @@ -14,7 +14,7 @@ when: - libreoffice.method == 'sys' ansible.builtin.set_fact: - sys_pkg: "{{ sys_pkg + libreoffice.syspkgs }}" + sys_pkg: "{{ sys_pkg + libreoffice.pkgs }}" - name: Append to caskpkgs when: diff --git a/tasks/pkgs/lua-language-server.yml b/tasks/pkgs/lua-language-server.yml index cbfeae3..0e94466 100644 --- a/tasks/pkgs/lua-language-server.yml +++ b/tasks/pkgs/lua-language-server.yml @@ -1,23 +1,11 @@ # vim: set filetype=yaml.ansible : --- -- name: Linux specific configuration - when: - - ansible_os_family != 'Darwin' - block: - - name: Load lua-language-server config - ansible.builtin.include_vars: - file: lua-language-server.yml - name: _luals - - name: Combine loaded config with defaults - ansible.builtin.set_fact: - pkgconfig_luals: "{{ _luals | ansible.builtin.combine(pkgconfig.luals) }}" +- name: Append to pkgs + ansible.builtin.set_fact: + srcpkgs: "{{ srcpkgs + ['lua-language-server'] }}" - - name: Append to pkgs - ansible.builtin.set_fact: - srcpkgs: "{{ srcpkgs + ['lua-language-server'] }}" - -- name: Append to syspkgs +- name: Append to pkg_sys when: - ansible_os_family == 'Darwin' ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + ['lua-language-server'] }}" + pkg_sys: "{{ pkg_sys + ['lua-language-server'] }}" diff --git a/tasks/repos/hashicorp_repo.yml b/tasks/repos/hashicorp.yml similarity index 96% rename from tasks/repos/hashicorp_repo.yml rename to tasks/repos/hashicorp.yml index 35534d6..a1af55c 100644 --- a/tasks/repos/hashicorp_repo.yml +++ b/tasks/repos/hashicorp.yml @@ -1,9 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- name: Set hashicorp flag - ansible.builtin.set_fact: - hashicorp: true - - name: RedHat repository when: - ansible_os_family == 'RedHat' diff --git a/tasks/repos/terra_repo.yml b/tasks/repos/terra.yml similarity index 100% rename from tasks/repos/terra_repo.yml rename to tasks/repos/terra.yml diff --git a/tasks/src/alacritty.yml b/tasks/src/alacritty.yml deleted file mode 100644 index afb3015..0000000 --- a/tasks/src/alacritty.yml +++ /dev/null @@ -1,7 +0,0 @@ -# vim: set filetype=yaml.ansible : ---- -- name: Build and install alacritty - become: "{{ not use_local }}" - ansible.builtin.command: - creates: "{{ alacritty.bin }}" - cmd: "cargo install --root {{ paths.cargo }} alacritty@{{ alacritty.ver }}" diff --git a/tasks/src/lua-language-server.yml b/tasks/src/lua-language-server.yml deleted file mode 100644 index 58743ed..0000000 --- a/tasks/src/lua-language-server.yml +++ /dev/null @@ -1,56 +0,0 @@ -# vim: set filetype=yaml.ansible : ---- -- name: Set needed variables lua language server - ansible.builtin.set_fact: - luals_sys: pkgconfig_luals.sysmap[ansible_system] - luals_arch: pkgconfig_luals.archmap[ansible_architecture] - luals_ver: pkgconfig_luals.version - luals_instpath: pkgconfig_luals.install_path - luals_instpfx: pkgconfig_luals.install_prefix - luals_burl: pkgconfig_luals.base_url - -- name: Set luals archive name - ansible.builtin.set_fact: - luals_pkg: "lua-language-server-{{ luals_ver }}-{{ lualsl_sys }}-{{ luals_arch }}.tar.gz" - -- name: Check if lua language server is already installed - ansible.builtin.stat: - path: "{{ luals_instpath }}/bin/lua-language-server" - register: r_luals_stat - -- name: Install lua-language-server - when: not r_luals_stat.stat.exists - block: - - name: Create temp path - ansible.builtin.tempfile: - state: directory - prefix: luals_dl. - register: d_luals_dl_tmp - - - name: Get latest lua-language-server - ansible.builtin.get_url: - dest: "{{ d_luals_dl_tmp.path }}/{{ luals_pkg }}" - url: "{{ luals_burl }}/{{ luals_ver }}/{{ luals_pkg }}" - mode: "0644" - decompress: false - - - name: Create install_path - ansible.builtin.file: - state: directory - path: "{{ luals_instpath }}" - mode: "0755" - become: true - - - name: Extract lua language server archive - ansible.builtin.unarchive: - dest: "{{ luals_instpath }}" - src: "{{ d_luals_dl_tmp.path }}/{{ luals_pkg }}" - remote_src: true - become: true - - - name: Link lua language server binary - ansible.builtin.file: - state: link - src: "{{ luals_instpath }}/bin/lua-language-server" - path: "{{ luals_instpfx }}/bin/lua-language-server" - become: true diff --git a/vars/pkgs/alacritty.yml b/vars/pkgs/alacritty.yml index 4e319d5..61866bd 100644 --- a/vars/pkgs/alacritty.yml +++ b/vars/pkgs/alacritty.yml @@ -1,7 +1,6 @@ alacritty: - version: 0.15.0 + version: 0.15.1 RedHat: - pkgs: [] build_deps: - cmake - freetype-devel @@ -10,7 +9,6 @@ alacritty: - libxkbcommon-devel - g++ Debian: - pkgs: [] build_deps: - cmake - pkg-config @@ -19,7 +17,5 @@ alacritty: - libxcb-xfixes0-dev - libxkbcommon-dev - python3 - Darwin: - pkgs: - - alacritty - git_repo: https://github.com/alacritty/alacritty.git + cask: + - alacritty diff --git a/vars/pkgs/carapace.yml b/vars/pkgs/carapace.yml index 61e873c..b9a604f 100644 --- a/vars/pkgs/carapace.yml +++ b/vars/pkgs/carapace.yml @@ -1,6 +1,16 @@ carapace: + version: 0.2.0 pkgs: Linux: - carapace-bin Darwin: - carapace + repo: + RedHat: + name: carapace-yum + description: carapace-yum + baseurl: https://yum.fury.io/rsteube/ + Debian: + repo: "deb [trusted=yes] https://apt.fury.io/rsteube/ /" + name: carapace + Darwin: {} diff --git a/vars/pkgs/consul.yml b/vars/pkgs/consul.yml index 7da455d..e912d6b 100644 --- a/vars/pkgs/consul.yml +++ b/vars/pkgs/consul.yml @@ -1,3 +1,6 @@ consul: - Linux: consul - Darwin: hashicorp/tap/consul + pkgs: + Linux: + - consul + Darwin: + - hashicorp/tap/consul diff --git a/vars/pkgs/hashicorp.yml b/vars/pkgs/hashicorp.yml index ec06e5b..725b706 100644 --- a/vars/pkgs/hashicorp.yml +++ b/vars/pkgs/hashicorp.yml @@ -1,8 +1,8 @@ hashicorp: Linux: - RedHat: + ".el9": repo: https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo - Fedora: + fedora: repo: https://rpm.releases.hashicorp.com/fedora/hashicorp.repo - Debian: + debian: repo: "deb [arch={{ ansible_architecture }} signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com {{ ansible_distribution_release }} main" diff --git a/vars/pkgs/luals.yml b/vars/pkgs/luals.yml index 483477c..1571760 100644 --- a/vars/pkgs/luals.yml +++ b/vars/pkgs/luals.yml @@ -1,4 +1,5 @@ luals: + version: 3.13.5 base_url: https://github.com/LuaLS/lua-language-server/releases/download sysmap: Darwin: darwin From 481385af57d4fc4ef7120b36da7beeb8520ee205 Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Fri, 21 Feb 2025 09:05:23 -0700 Subject: [PATCH 23/38] add and fix handlers - use handlers for pre-installation dependencies like repos --- handlers/main.yml | 16 +++++++++++++++- tasks/facts.yml | 2 +- tasks/main.yml | 3 +++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index a82b36c..2638708 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,6 +1,6 @@ # vim: set filetype=yaml.ansible : --- -- name: Dep end go +- name: Depend go ansible.builtin.include_tasks: file: addpkg.yml vars: @@ -17,3 +17,17 @@ pkg: rust ansible.builtin.include_tasks: file: addpkg.yml + +- name: Depend zig + vars: + pkg: zig + ansible.builtin.include_tasks: + file: addpkg.yml + +- name: Depend terra repo + ansible.builtin.include_tasks: + file: repos/terra.yml + +- name: Depend hashicorp repo + ansible.builtin.include_tasks: + file: repos/hashicorp.yml diff --git a/tasks/facts.yml b/tasks/facts.yml index 6455071..5321479 100644 --- a/tasks/facts.yml +++ b/tasks/facts.yml @@ -14,7 +14,7 @@ - name: flathub url: https://dl.flathub.org/repo/flathub.flatpakrepo flatpak_method: "{% if use_local %}user{% else %}system{% endif %}" - pkg_appimage: [] # app_images to install + pkg_appimage: [] # appimages to install pkg_flatpak: [] # flatpak packages to install pkg_snap: [] # snpacraft.io packages sys_pkg_become: true # Linux package managers require sudo access diff --git a/tasks/main.yml b/tasks/main.yml index f4169de..d720d31 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -30,6 +30,9 @@ ansible.builtin.include_tasks: file: addpkg.yml +- name: Flush handlers to ensure dependencies are installed + ansible.builtin.meta: flush_handlers + - name: Install sys_pkgs list using system package manager become: "{{ sys_pkg_become }}" ansible.builtin.package: From 4b995a3c077a184c44f7f9b0281f5feb4b3c5819 Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Fri, 21 Feb 2025 09:54:07 -0700 Subject: [PATCH 24/38] more fixs being done --- tasks/appimage.yml | 26 +++++++++++++++++ tasks/appimage/bitwarden.yml | 31 -------------------- tasks/config/bitwarden.yml | 18 +++++++++--- tasks/config/fd.yml | 4 +++ tasks/config/ghostty.yml | 28 ++++++++++++++---- tasks/config/kitty.yml | 2 +- tasks/config/neovim.yml | 26 +++++++++++------ tasks/main.yml | 13 +++++++-- tasks/pkgs/bitwarden.yml | 12 ++++---- tasks/pkgs/fd.yml | 2 +- tasks/pkgs/ghostty.yml | 55 +++++++++++++++++++----------------- tasks/repos/terra.yml | 12 ++++---- vars/pkgs/bitwarden.yml | 3 +- vars/pkgs/fd.yml | 2 +- vars/pkgs/ghostty.yml | 13 ++++++++- vars/pkgs/neovim.yml | 10 ++++++- 16 files changed, 162 insertions(+), 95 deletions(-) create mode 100644 tasks/appimage.yml delete mode 100644 tasks/appimage/bitwarden.yml create mode 100644 tasks/config/fd.yml diff --git a/tasks/appimage.yml b/tasks/appimage.yml new file mode 100644 index 0000000..df1a6b0 --- /dev/null +++ b/tasks/appimage.yml @@ -0,0 +1,26 @@ +# vim: set filetype=yaml.ansible : +--- +- name: Install appimage + become: "{{ archive_become }}" + block: + - name: Ensure appimage path exists + ansible.builtin.file: + path: "{{ path.appimage }}/{{ pkg.link_name }}" + mode: '0755' + state: directory + + - name: Fetch appimage + become: "{{ archive_become }}" + ansible.builtin.get_url: + mode: '0755' + decompress: false + backup: true + url: "{{ pkg.url }}" + dest: "{{ path.appimage }}/{{ pkg.link_name }}/{{ pkg.file }}" + + - name: Link appimage to bin + become: "{{ archive_become }}" + ansible.builtin.file: + state: link + src: "{{ path.appimage }}/{{ pkg.link_name }}/{{ pkg.file }}" + path: "{{ path.bindir }}/{{ pkg.link_name }}" diff --git a/tasks/appimage/bitwarden.yml b/tasks/appimage/bitwarden.yml deleted file mode 100644 index a2b8b5d..0000000 --- a/tasks/appimage/bitwarden.yml +++ /dev/null @@ -1,31 +0,0 @@ -# vim: set filetype=yaml.ansible : ---- -- name: Install bitwarden appimage - become: "{{ bw_become }}" - become_user: "{% if bw_become %}{{ bw_owner }}{% else %}~{% endif %}" - when: - - bw_instmtd == 'appimage' - block: - - name: Ensure install path exists - ansible.builtin.file: - state: directory - mode: '0755' - path: "{{ apimage_pfx }}/bitwarden" - owner: "{{ bw_owner }}" - group: "{{ bw_group }}" - - - name: Fetch bitwarden appimage - ansible.builtin.get_url: - mode: '0755' - decompress: false - backup: true - url: "{{ bw.appimg.url }}" - dest: "{{ appimage_pfx }}/{{ bw.appimg.name }}" - owner: "{{ bw_owner }}" - group: "{{ bw_group }}" - - - name: Link bitwarden appimage - ansible.builtin.file: - state: link - src: "{{ appimage_pfx }}/{{ bw.appimg.name }}" - path: "{{ bw.bindir }}/bitwarden" diff --git a/tasks/config/bitwarden.yml b/tasks/config/bitwarden.yml index 1dbfbf7..e348fec 100644 --- a/tasks/config/bitwarden.yml +++ b/tasks/config/bitwarden.yml @@ -2,11 +2,21 @@ --- - name: Set bitwarden install method ansible.builtin.set_fact: - bw: + bitwarden: method: "{{ pkgconfig.bitwarden.method[ansible_distribution] | default('appimage') }}" - name: Set bitwarden config ansible.builtin.set_fact: - bw: - pkg: "{{ pkgconfig.bitwarden[bw.method] }}" - method: "{{ bw.method }}" + bitwarden: + pkg: "{{ pkgconfig.bitwarden[bitwarden.method] }}" + method: "{{ bitwarden.method }}" + +- name: Set bitwarden config for appimage install + when: + - bitwarden.method == 'appimage' + ansible.builtin.set_fact: + bitwarden: + method: appimage + file: "{{ pkgconfig.bitwarden.appimage.name }}" + link_name: "{{ pkgconfig.bitwarden.appimage.link_name }}" + url: "{{ pkgconfig.bitwarden.appimage.url }}" diff --git a/tasks/config/fd.yml b/tasks/config/fd.yml new file mode 100644 index 0000000..861fdbc --- /dev/null +++ b/tasks/config/fd.yml @@ -0,0 +1,4 @@ +- name: Set fd config + ansible.builtin.set_fact: + fd: + pkgs: "{{ pkgconfig.fd.pkgs[ansible_os_famly] }}" diff --git a/tasks/config/ghostty.yml b/tasks/config/ghostty.yml index 7e30ecb..efd0350 100644 --- a/tasks/config/ghostty.yml +++ b/tasks/config/ghostty.yml @@ -1,8 +1,24 @@ # vim: set filetype=yaml.ansible : --- -version: v1.0.1 -optimize: ReleaseFast -build: false -dobecome: true -owner: root -group: root +- name: Set ghostty install method + ansible.builtin.set_fact: + ghostty: + method: "{{ pkgconfig.ghostty.method[ansible_distribution] | default(pkgconfig.ghostty.method.default) }}" + +- name: Set ghostty config + ansible.builtin.set_fact: + ghostty: + arch: "{{ pkgconfig.ghostty.archmap[ansible_architecture] }}" + deps: "{{ pkgconfig.ghostty.build_deps[ansible_os_family] }}" + vers: "{{ pkgconfig.ghostty.version }}" + pkg: "{{ pkgconfig.ghosty[ghostty.method] }}" + +- name: Set ghostty config for appimage install + when: + - ghostty.method == 'appimage' + ansible.builtin.set_fact: + ghostty: + method: appimage + file: "Ghostty-{{ ghostty.vers }}-{{ ghostty.arch }}.AppImage" + link_name: "{{ pkgconfig.ghostty.appimage.link_name }}" + url: "{{ pkgconfig.ghostty.appimage.base_url }}/v{{ ghostty.vers }}/Ghostty-{{ ghostty.vers }}-{{ ghostty.arch }}.AppImage" diff --git a/tasks/config/kitty.yml b/tasks/config/kitty.yml index cb964ec..135d300 100644 --- a/tasks/config/kitty.yml +++ b/tasks/config/kitty.yml @@ -1,4 +1,4 @@ - name: Set kitty config - ansible.buitlin.set_fact: + ansible.builtin.set_fact: kitty: pkgs: "{{ pkgconfig.kitty.pkgs[ansible_system] }}" diff --git a/tasks/config/neovim.yml b/tasks/config/neovim.yml index 4e11e56..dae52c5 100644 --- a/tasks/config/neovim.yml +++ b/tasks/config/neovim.yml @@ -1,10 +1,20 @@ # vim: set filetype=yaml.ansible : --- -version: v0.10.3 -install_prefix: "{{ default_install_prefix }}" -install_dir: /opt/nvim -install_method: appimage -build_type: Release -dobecome: true -owner: root -group: root +- name: Set neovim install method + ansible.builtin.set_fact: + neovim: + method: "{{ pkgconfig.neovim.method[ansible_distribution] | default(pkgconfig.neovim.method.default) }}" + +- name: Set neovim config + ansible.builtin.set_fact: + neovim: + vers: "v{{ pkgconfig.neovim.version }}" + +- name: Set neovim config for appimage install + when: + - neovim.method == 'appimage' + ansible.builtin.set_fact: + neovim: + file: "nvim-linux-{{ ansible_architecture }}.appimage" + link_name: nvim + url: "{{ pkgconfig.neovim.appimage.base_url }}/{{ neovim.vers }}/nvim-linux-{{ ansible_architecture }}.appimage" diff --git a/tasks/main.yml b/tasks/main.yml index d720d31..5f44006 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -51,13 +51,22 @@ - name: Install archive_pkgs when: - - archive_pkgs|length > 0 - loop: "{{ archive_pkgs }}" + - pkg_archive|length > 0 + loop: "{{ pkg_archive }}" loop_control: loop_var: pkg ansible.builtin.include_tasks: file: "archive/{{ pkg }}.yml" +- name: Install appimages + when: + - pkg_appimage|length > 0 + loop: "{{ pkg_appimage }}" + loop_control: + loop_var: pkg + ansible.builtin.include_tasks: + file: appimage.yml + - name: Build and install source packages when: - src_pkgs|length > 0 diff --git a/tasks/pkgs/bitwarden.yml b/tasks/pkgs/bitwarden.yml index 8bd22b7..84b7ed7 100644 --- a/tasks/pkgs/bitwarden.yml +++ b/tasks/pkgs/bitwarden.yml @@ -2,18 +2,18 @@ --- - name: Append to flatpkgs when: - - bw.method == 'flatpak' + - bitwarden.method == 'flatpak' ansible.builtin.set_fact: - pkg_flatpak: "{{ pkg_flatpak + [bw.pkg] }}" + pkg_flatpak: "{{ pkg_flatpak + [bitwarden.pkg] }}" - name: Append to srcpkgs when: - - bw.method == 'appimage' + - bitwarden.method == 'appimage' ansible.builtin.set_fact: - pkg_appimage: "{{ pkg_appimage + [bw.pkg] }}" + pkg_appimage: "{{ pkg_appimage + [bitwarden.pkg] }}" - name: Append to caskpkgs when: - - bw.method == 'brew' + - bitwarden.method == 'brew' ansible.builtin.set_fact: - pkg_cask: "{{ pkg_cask + [bw.pkg.name] }}" + pkg_cask: "{{ pkg_cask + [bitwarden.pkg.name] }}" diff --git a/tasks/pkgs/fd.yml b/tasks/pkgs/fd.yml index bc0e22b..9b534b1 100644 --- a/tasks/pkgs/fd.yml +++ b/tasks/pkgs/fd.yml @@ -2,4 +2,4 @@ --- - name: Append to pkg_sys ansible.builtin.set_fact: - pkg_sys: "{{ pkg_sys + pkgconfig.fd.pkg[ansible_os_family] }}" + pkg_sys: "{{ pkg_sys + fd.pkgs }}" diff --git a/tasks/pkgs/ghostty.yml b/tasks/pkgs/ghostty.yml index d4bd987..bdead87 100644 --- a/tasks/pkgs/ghostty.yml +++ b/tasks/pkgs/ghostty.yml @@ -1,32 +1,35 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_vars: - file: ghostty.yml - name: _ghostty -- ansible.builtin.set_fact: - pkgconfig_ghostty: "{{ _ghostty | ansible.builtin.combine(pkgconfig.ghostty) }}" - -- name: ensure dependencies +- name: Source pkg installation + when: + - ghostty.method == 'src' or block: - - ansible.builtin.include_tasks: - file: "pkgs/terra_repo.yml" - when: terrarepo is undefined - - - name: append to pkgs + - name: Build ghostty from source ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'ghostty' ] }}" - when: ansible_distribution == 'Fedora' or - not pkgconfig_ghostty.build + pkg_sys: "{{ pkg_sys + ghostty.deps }}" + pkg_src: "{{ pkg_src + ['ghostty'] }}" -- name: build ghostty from source - block: - - ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + pkgconfig_ghostty.deps[ansible_os_family] }}" - srcpkgs: "{{ srcpkgs + ['ghostty'] }}" - when: (ansible_distribution != 'Fedora' and ansible_system == 'Linux') or - pkgconfig_ghostty.build - -- name: append ghostty to caskpkgs +- name: Appimage installation + when: + - ghostty.method == 'appimage' + - ansible_distribution != 'MacOSX' ansible.builtin.set_fact: - caskpkgs: "{{ caskpkgs + [ 'ghostty' ] }}" - when: ansible_distribution == 'MacOSX' + pkg_appimage: "{{ pkg_appimage + ghostty_vars.appimage }}" + +- name: Sys pkg installation + when: + - ghostty.method == 'sys' + block: + - name: Append to pkgs + when: + - ansible_distribution == 'Fedora' + notify: + - Depend terra repo + ansible.builtin.set_fact: + pkg_sys: "{{ pkg_sys + ['ghostty'] }}" + +- name: Cask pkg installation + when: + - ghostty.method == 'brew' + ansible.builtin.set_fact: + pkg_cask: "{{ pkg_cask + ['ghostty'] }}" diff --git a/tasks/repos/terra.yml b/tasks/repos/terra.yml index 676c560..4a23e02 100644 --- a/tasks/repos/terra.yml +++ b/tasks/repos/terra.yml @@ -1,22 +1,24 @@ # vim: set filetype=yaml.ansible : --- -- name: enable terra repo for fedora - when: ansible_distribution == 'Fedora' +- name: Enable terra repo for fedora + when: + - ansible_distribution == 'Fedora' block: - - name: enable terra repo for fedora >=41 + - name: Enable terra repo for fedora >=41 become: true when: ansible_distribution_major_version|int >= 41 ansible.builtin.command: creates: /etc/yum.repos.d/terra.repo cmd: "dnf config-manager addrepo --from-repofile={{ pkgconfig.terrarepo.repo }}" - - name: enable terra repo for fedora < 41 + - name: Enable terra repo for fedora < 41 become: true when: ansible_distribution_major_version|int < 41 ansible.builtin.command: creates: /etc/yum.repos.d/terra.repo cmd: "dnf config-manager --add-repo {{ pkgconfig.terrarepo.repo }}" - - ansible.builtin.dnf: + - name: Install terra release package + ansible.builtin.dnf: name: terra-release state: present diff --git a/vars/pkgs/bitwarden.yml b/vars/pkgs/bitwarden.yml index d846a47..0dc8ba5 100644 --- a/vars/pkgs/bitwarden.yml +++ b/vars/pkgs/bitwarden.yml @@ -3,6 +3,7 @@ bitwarden: name: com.bitwarden.desktop remote: flathub appimage: + link_name: bitwarden name: bitwarden.appimage url: https://vault.bitwarden.com/download/?app=desktop&platform=linux&variant=appimage snap: @@ -10,8 +11,6 @@ bitwarden: brew: name: bitwarden method: - RedHat: appimage - Debian: appimage Fedora: flatpak Ubuntu: snap MacOSX: brew diff --git a/vars/pkgs/fd.yml b/vars/pkgs/fd.yml index 46b005c..8e5c94d 100644 --- a/vars/pkgs/fd.yml +++ b/vars/pkgs/fd.yml @@ -1,5 +1,5 @@ fd: - pkg: + pkgs: Darwin: - fd RedHat: diff --git a/vars/pkgs/ghostty.yml b/vars/pkgs/ghostty.yml index 5ca6614..0a4492f 100644 --- a/vars/pkgs/ghostty.yml +++ b/vars/pkgs/ghostty.yml @@ -1,4 +1,6 @@ ghostty: + version: 1.1.2+1 + optimize: ReleaseFast build_deps: Debian: - libgtk-4-dev @@ -6,4 +8,13 @@ ghostty: RedHat: - gtk4-devel - libadwaita-devel - git_repo: https://github.com/ghostty-org/ghostty + archmap: + arm64: aarch64 + x86_64: x86_64 + appimage: + base_url: https://github.com/psadi/ghostty-appimage/releases/download/ + link_name: ghostty + method: + default: appimage + Fedora: sys + MacOSX: brew diff --git a/vars/pkgs/neovim.yml b/vars/pkgs/neovim.yml index 2bc60b3..9badcd4 100644 --- a/vars/pkgs/neovim.yml +++ b/vars/pkgs/neovim.yml @@ -1,3 +1,11 @@ neovim: + version: 0.10.4 git_repo: https://github.com/neovim/neovim - appimage_url_pfx: https://github.com/neovim/neovim/releases/download + appimage: + base_url: https://github.com/neovim/neovim/releases/download + link_name: nvim + method: + default: appimage + Fedora: sys + Ubuntu: sys + MacOSX: sys From 852fe8eb7d66cd59fde0bdead5a62d654d3eed11 Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Fri, 21 Feb 2025 22:59:24 -0700 Subject: [PATCH 25/38] more package fixes --- handlers/main.yml | 20 ++++++- tasks/archive/go.yml | 56 +++++++++---------- tasks/archive/nerdfonts.yml | 6 +- tasks/config/go.yml | 15 +++-- tasks/config/neovim.yml | 3 + tasks/config/nerdfonts.yml | 2 +- tasks/config/nextcloud.yml | 13 +++++ tasks/go.yml | 6 +- tasks/main.yml | 41 ++++++++------ tasks/pkgs/air.yml | 4 +- tasks/pkgs/alacritty.yml | 2 +- tasks/pkgs/ansible-language-server.yml | 10 ++-- tasks/pkgs/ansible.yml | 4 +- tasks/pkgs/bashls.yml | 10 ++-- tasks/pkgs/bitwarden.yml | 8 ++- tasks/pkgs/blender.yml | 10 ++-- tasks/pkgs/broot.yml | 4 +- tasks/pkgs/btop.yml | 2 +- tasks/pkgs/buf.yml | 10 ++-- tasks/pkgs/bufls.yml | 10 ++-- tasks/pkgs/cheat.yml | 11 ++-- tasks/pkgs/checkmake.yml | 10 ++-- tasks/pkgs/choose.yml | 6 +- tasks/pkgs/cmake.yml | 4 +- tasks/pkgs/cmakelang.yml | 10 ++-- tasks/pkgs/commitlint-cli.yml | 10 ++-- tasks/pkgs/commitlint-config-conventional.yml | 10 ++-- tasks/pkgs/consul.yml | 4 ++ tasks/pkgs/cssls.yml | 10 ++-- tasks/pkgs/curlie.yml | 6 +- tasks/pkgs/dbeaver.yml | 20 +++---- tasks/pkgs/dockerls.yml | 10 ++-- tasks/pkgs/dotenv-linter.yml | 10 ++-- tasks/pkgs/duf.yml | 11 ++-- tasks/pkgs/dust.yml | 24 ++++---- tasks/pkgs/eslint.yml | 10 ++-- tasks/pkgs/eza.yml | 10 ++-- tasks/pkgs/firefox.yml | 14 +++-- tasks/pkgs/flatpak.yml | 8 +-- tasks/pkgs/ghostty.yml | 4 +- tasks/pkgs/glow.yml | 10 ++-- tasks/pkgs/go.yml | 8 +-- tasks/pkgs/godot.yml | 23 ++++---- tasks/pkgs/gopls.yml | 10 ++-- tasks/pkgs/gping.yml | 24 ++++---- tasks/pkgs/hashicorp.yml | 3 - tasks/pkgs/heroic.yml | 23 ++++---- tasks/pkgs/htmlls.yml | 10 ++-- tasks/pkgs/htmx-lsp.yml | 8 +-- tasks/pkgs/httpie.yml | 24 ++++---- tasks/pkgs/hugo.yml | 4 +- tasks/pkgs/intelephense.yml | 10 ++-- tasks/pkgs/jinja-lsp.yml | 10 ++-- tasks/pkgs/jq.yml | 4 +- tasks/pkgs/jsonls.yml | 10 ++-- tasks/pkgs/lazygit.yml | 10 ++-- tasks/pkgs/libreoffice.yml | 23 ++++---- tasks/pkgs/lua-language-server.yml | 6 +- tasks/pkgs/markdownlint-cli.yml | 10 ++-- tasks/pkgs/mcfly.yml | 20 +++---- tasks/pkgs/neovide.yml | 4 +- tasks/pkgs/neovim.yml | 49 ++-------------- tasks/pkgs/nerdfonts.yml | 10 ++-- tasks/pkgs/nextcloud.yml | 32 ++++++----- tasks/pkgs/nginxls.yml | 10 ++-- tasks/pkgs/nodejs.yml | 2 +- tasks/pkgs/nomad.yml | 12 ++-- tasks/pkgs/packer.yml | 19 ++++--- tasks/pkgs/templ.yml | 10 ++-- vars/pkgs/neovim.yml | 3 + vars/pkgs/nextcloud.yml | 4 ++ 71 files changed, 403 insertions(+), 440 deletions(-) create mode 100644 tasks/config/nextcloud.yml delete mode 100644 tasks/pkgs/hashicorp.yml create mode 100644 vars/pkgs/nextcloud.yml diff --git a/handlers/main.yml b/handlers/main.yml index 2638708..a2565ef 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -6,9 +6,27 @@ vars: pkg: go +- name: Depend flatpak + vars: + pkg: flatpak + ansible.builtin.include_tasks: + file: addpkg.yml + +- name: Depend node + vars: + pkg: nodejs + ansible.builtin.include_tasks: + file: addpkg.yml + +- name: Depend pipx + vars: + pkg: pipx + ansible.builtin.include_tasks: + file: addpkg.yml + - name: Depend cargo vars: - pkg: cargo + pkg: rust ansible.builtin.include_tasks: file: addpkg.yml diff --git a/tasks/archive/go.yml b/tasks/archive/go.yml index 51cd288..2b5a37d 100644 --- a/tasks/archive/go.yml +++ b/tasks/archive/go.yml @@ -1,44 +1,44 @@ # vim: set filetype=yaml.ansible : --- -- name: Check if archive already exists +- name: Check if go is already installed ansible.builtin.stat: - path: "{{ paths.archive }}/{{ go_archive }}" - register: stat_go_archive + path: "{{ path.go }}/VERSION" + register: stat_path_go + +- name: Check version of installed go + when: + - stat_path_go.stat.exists + ansible.builtin.set_fact: + do_go_install: "{{ not (go.vers in lookup('ansible.builtin.file', path.go ~ '/VERSION')) }}" - name: Install/update go when: - - not stat_go_archive.exists + - do_go_install or + not stat_path_go.stat.exists block: - name: Download go archive become: "{{ sys_pkg_become }}" + register: get_url_go ansible.builtin.get_url: - dest: "{{ paths.cache }}/{{ go_archive }}" + dest: "{{ path.cache }}/{{ go.archive }}" url: "{{ go.url }}" checksum: "{{ go.sum }}" decompress: false mode: '0644' - register: get_url_go - - name: Ensure go install dir exists - become: "{{ sys_pkg_become }}" - ansible.builtin.file: - path: "{{ go.inst_path }}" - state: directory - mode: '0755' + - name: Extract go package for Linux + become: "{{ ext_become }}" + when: + - ansible_system == 'Linux' + ansible.builtin.unarchive: + dest: "{{ path.prefix }}" + src: "{{ d_go_dl_tmp.path }}/{{ go.archive }}" + remote_src: true -- name: Extract go package - become: "{{ sys_pkg_become }}" - when: - - ansible_system == 'Linux' - ansible.builtin.unarchive: - dest: "{{ paths.archive }}/go" - src: "{{ d_go_dl_tmp.path }}/{{ go_archive }}" - remote_src: true - -- name: Install go macOS use pkg file - become: true - when: - - ansible_system == 'Darwin' - ansible.builtin.command: - creates: "{{ go.inst_path }}" - cmd: "installer -pkg {{ d_go_dl_tmp.path }}/{{ go_archive }} -target /" + - name: Install go macOS using pkg file + become: true + when: + - ansible_distribution == 'MacOSX' + ansible.builtin.command: + creates: "{{ path.go }}" + cmd: "installer -pkg {{ d_go_dl_tmp.path }}/{{ go.archive }} -target /" diff --git a/tasks/archive/nerdfonts.yml b/tasks/archive/nerdfonts.yml index 3607dc1..b24e9f5 100644 --- a/tasks/archive/nerdfonts.yml +++ b/tasks/archive/nerdfonts.yml @@ -10,7 +10,7 @@ loop_var: font register: nerdfont_result ansible.builtin.file: - path: "{{ nerdfonts.install_path }}/{{ font }}" + path: "{{ path.prefix }}/{{ nerdfonts.path }}/{{ font }}" state: directory mode: '0755' @@ -23,7 +23,7 @@ loop_control: loop_var: font ansible.builtin.unarchive: - creates: "{{ nerdfonts.install_path }}/{{ font }}/README.md" + creates: "{{ path.prefix }}/{{ nerdfonts.path }}/{{ font }}/README.md" src: "{{ nerdfonts.base_url }}/{{ font }}.tar.xz" - dest: "{{ nerdfonts.install_path }}/{{ font }}" + dest: "{{ path.prefix }}/{{ nerdfonts.path }}/{{ font }}" remote_src: true diff --git a/tasks/config/go.yml b/tasks/config/go.yml index bdb83a6..b47c418 100644 --- a/tasks/config/go.yml +++ b/tasks/config/go.yml @@ -2,21 +2,20 @@ --- - name: Set go configuration ansible.builtin.set_fact: - do_install_go: false # defaults to false to save on having to set facts needlessly go: - ver: "{{ pkgconfig.go.version }}" arch: "{{ pkgconfig_go.archmap[ansible_architecture] }}" - sys: "{{ ansible_system | lower }}" ext: "{{ pkgconfig.go.extmap[ansible_system] }}" + sys: "{{ ansible_system | lower }}" + vers: "{{ pkgconfig.go.version }}" - name: Set go composite facts ansible.builtin.set_fact: go: - ver: "{{ go.ver }}" arch: "{{ go.arch }}" - sys: "{{ go.sys }}" - ext: "{{ go.ext }}" archive: "go{{ go.ver }}.{{ go.sys }}-{{ go.arch }}.{{ pkgconfig_go.extmap[ansible_system] }}" - sum: "{{ pkgconfig.go.sums[go.ver][ansible_system][go.arch] }}" + ext: "{{ go.ext }}" + inst_path: "{{ path.install }}/go" + sum: "{{ pkgconfig.go.sums[go.vers][ansible_system][go.arch] }}" + sys: "{{ go.sys }}" url: "{{ pkgconfig.go.base_url }}/{{ go.archive }}" - inst_path: "{{ paths.install }}/go" + vers: "{{ go.vers }}" diff --git a/tasks/config/neovim.yml b/tasks/config/neovim.yml index dae52c5..d4c6ace 100644 --- a/tasks/config/neovim.yml +++ b/tasks/config/neovim.yml @@ -8,13 +8,16 @@ - name: Set neovim config ansible.builtin.set_fact: neovim: + method: "{{ neovim.method }}" vers: "v{{ pkgconfig.neovim.version }}" + pkgs: "{{ pkgconfig.neovim.pkgs[ansible_distribution] | default(pkgconfig.neovim.pkgs.default) }}" - name: Set neovim config for appimage install when: - neovim.method == 'appimage' ansible.builtin.set_fact: neovim: + method: "{{ neovim.method }}" file: "nvim-linux-{{ ansible_architecture }}.appimage" link_name: nvim url: "{{ pkgconfig.neovim.appimage.base_url }}/{{ neovim.vers }}/nvim-linux-{{ ansible_architecture }}.appimage" diff --git a/tasks/config/nerdfonts.yml b/tasks/config/nerdfonts.yml index 45b951a..61e31ce 100644 --- a/tasks/config/nerdfonts.yml +++ b/tasks/config/nerdfonts.yml @@ -10,6 +10,6 @@ - Lilex - Monoid - NerdFontsSymbolsOnly - install_path: "{{ path.prefix }}/{{ pkgconfig.nerdfonts.path }}" + path: "{{ pkgconfig.nerdfonts.path }}" base_url: "{{ pkgconfig.nerdfonts.base_url }}" force_install: "{{ pkgconfig.force_install_nerdfonts | default(false) }}" diff --git a/tasks/config/nextcloud.yml b/tasks/config/nextcloud.yml new file mode 100644 index 0000000..ebbaa2f --- /dev/null +++ b/tasks/config/nextcloud.yml @@ -0,0 +1,13 @@ +- name: Set nextcloud install method + ansible.builtin.set_fact: + nextcloud: + method: "{{ pkgconfig.nextcloud.method | default('flatpak') }}" + +- name: Set nextcloud config + when: + - nextcloud.method == 'flatpak' + ansible.builtin.set_fact: + nextcloud: + method: "{{ nextcloud.method }}" + name: "{{ pkgconfig.nextcloud.flatpak.name }}" + remote: "{{ pkgconfig.nextcloud.flatpak.remote }}" diff --git a/tasks/go.yml b/tasks/go.yml index 3532985..333e55f 100644 --- a/tasks/go.yml +++ b/tasks/go.yml @@ -2,10 +2,10 @@ - name: Install go packages become: "{{ archive_become }}" environment: - GOBIN: "{{ paths.bin }}" - PATH: "{{ paths.go }}/bin:$PATH" + GOBIN: "{{ path.bin }}" + PATH: "{{ path.go }}/bin:$PATH" ansible.builtin.command: - creates: "{{ paths.bin }}/{{ pkg.bin }}" + creates: "{{ path.bin }}/{{ pkg.bin }}" cmd: - go - install diff --git a/tasks/main.yml b/tasks/main.yml index 5f44006..af0b02d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -33,23 +33,31 @@ - name: Flush handlers to ensure dependencies are installed ansible.builtin.meta: flush_handlers +- name: Add needed MacOS packages + when: + - ansible_distribution == 'MacOSX' + ansible.builtin.set_fact: + pkg_sys: "{{ pkg_sys + ['gnu-tar', 'virtualenv'] }}" + - name: Install sys_pkgs list using system package manager become: "{{ sys_pkg_become }}" ansible.builtin.package: - name: "{{ sys_pkgs | unique }}" + name: "{{ pkg_sys | unique }}" state: present -- name: Linux based OS - when: ansible_system == 'Linux' +- name: Linux specific tasks + when: + - ansible_system == 'Linux' ansible.builtin.include_tasks: file: linux.yml -- name: Darwin/macOS based OS - when: ansible_distribution == 'MacOSX' +- name: MacOS specific tasks + when: + - ansible_distribution == 'MacOSX' ansible.builtin.include_tasks: file: macos.yml -- name: Install archive_pkgs +- name: Install pkg_archive when: - pkg_archive|length > 0 loop: "{{ pkg_archive }}" @@ -58,7 +66,7 @@ ansible.builtin.include_tasks: file: "archive/{{ pkg }}.yml" -- name: Install appimages +- name: Install pkg_appimage when: - pkg_appimage|length > 0 loop: "{{ pkg_appimage }}" @@ -69,8 +77,8 @@ - name: Build and install source packages when: - - src_pkgs|length > 0 - loop: "{{ src_pkgs | unique }}" + - pkg_src|length > 0 + loop: "{{ pkg_src | unique }}" loop_control: loop_var: pkg ansible.builtin.include_tasks: @@ -78,8 +86,8 @@ - name: Install cargo packages when: - - cargo_pkgs|length > 0 - loop: "{{ cargo_pkgs | unique }}" + - pkg_cargo|length > 0 + loop: "{{ pkg_cargo | unique }}" loop_control: loop_var: pkg ansible.builtin.include_tasks: @@ -87,24 +95,25 @@ - name: Install go packages when: - - go_pkgs|length > 0 - loop: "{{ go_pkgs | unique }}" + - pkg_go|length > 0 + loop: "{{ pkg_go | unique }}" loop_control: loop_var: pkg ansible.builtin.include_tasks: file: go.yml - name: Install local npm packages - loop: "{{ npmpkgs | unique }}" + loop: "{{ pkg_npm | unique }}" loop_control: loop_var: pkg ansible.builtin.include_tasks: file: npm.yml - name: Install python pipx packages for user - loop: "{{ pipx_pkgs | unique }}" + when: + - pkg_pipx|length > 0 + loop: "{{ pkg_pipx | unique }}" loop_control: loop_var: pkg - when: pipx_pkgs|length > 0 ansible.builtin.include_tasks: file: pipx.yml diff --git a/tasks/pkgs/air.yml b/tasks/pkgs/air.yml index 0c1ab44..556db60 100644 --- a/tasks/pkgs/air.yml +++ b/tasks/pkgs/air.yml @@ -1,7 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- name: Add to go_pkgs +- name: Add to pkg_go notify: - Depend go ansible.builtin.set_fact: - go_pkgs: "{{ go_pkgs + [air] }}" + pkg_go: "{{ pkg_go + [air] }}" diff --git a/tasks/pkgs/alacritty.yml b/tasks/pkgs/alacritty.yml index 36d737f..cece2d4 100644 --- a/tasks/pkgs/alacritty.yml +++ b/tasks/pkgs/alacritty.yml @@ -15,4 +15,4 @@ when: - ansible_system == 'Darwin' ansible.builtin.set_fact: - caskpkgs: "{{ caskpkgs + alacritty.cask }}" + pkg_cask: "{{ pkg_cask + alacritty.cask }}" diff --git a/tasks/pkgs/ansible-language-server.yml b/tasks/pkgs/ansible-language-server.yml index f70ee4a..31eaa7f 100644 --- a/tasks/pkgs/ansible-language-server.yml +++ b/tasks/pkgs/ansible-language-server.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: pkgs/nodejs.yml - when: nodejs is undefined - -- name: add to npmpkgs +- name: Add to pkg_npm + notify: + - Depend node ansible.builtin.set_fact: - npmpkgs: "{{ npmpkgs + ['@ansible/ansible-language-server'] }}" + pkg_npm: "{{ pkg_npm + ['@ansible/ansible-language-server'] }}" diff --git a/tasks/pkgs/ansible.yml b/tasks/pkgs/ansible.yml index 4516c65..06f153b 100644 --- a/tasks/pkgs/ansible.yml +++ b/tasks/pkgs/ansible.yml @@ -1,5 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- name: append to pkgs +- name: Append to pkgs ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'ansible' ] }}" + pkg_sys: "{{ pkg_sys + ['ansible'] }}" diff --git a/tasks/pkgs/bashls.yml b/tasks/pkgs/bashls.yml index d3b6bf8..bc6d704 100644 --- a/tasks/pkgs/bashls.yml +++ b/tasks/pkgs/bashls.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: pkgs/nodejs.yml - when: nodejs is undefined - -- name: add to npmpkgs +- name: Add to pkg_npm + notify: + - Depend node ansible.builtin.set_fact: - npmpkgs: "{{ npmpkgs + [ 'bash-language-server' ] }}" + pkg_npm: "{{ pkg_npm + ['bash-language-server'] }}" diff --git a/tasks/pkgs/bitwarden.yml b/tasks/pkgs/bitwarden.yml index 84b7ed7..8748d1b 100644 --- a/tasks/pkgs/bitwarden.yml +++ b/tasks/pkgs/bitwarden.yml @@ -1,18 +1,20 @@ # vim: set filetype=yaml.ansible : --- -- name: Append to flatpkgs +- name: Append to pkg_flatpak when: - bitwarden.method == 'flatpak' + notify: + - Depend flatpak ansible.builtin.set_fact: pkg_flatpak: "{{ pkg_flatpak + [bitwarden.pkg] }}" -- name: Append to srcpkgs +- name: Append to pkg_appimage when: - bitwarden.method == 'appimage' ansible.builtin.set_fact: pkg_appimage: "{{ pkg_appimage + [bitwarden.pkg] }}" -- name: Append to caskpkgs +- name: Append to pkg_cask when: - bitwarden.method == 'brew' ansible.builtin.set_fact: diff --git a/tasks/pkgs/blender.yml b/tasks/pkgs/blender.yml index 4de466d..1c80133 100644 --- a/tasks/pkgs/blender.yml +++ b/tasks/pkgs/blender.yml @@ -1,11 +1,13 @@ # vim: set filetype=yaml.ansible : --- -- name: Append to pkgs +- name: Append to pkg_sys + when: + - ansible_system == 'Linux' ansible.builtin.set_fact: pkg_sys: "{{ pkg_sys + ['blender'] }}" - when: ansible_os_family != 'Darwin' -- name: Append to caskpkgs +- name: Append to pkg_cask + when: + - ansible_system == 'Darwin' ansible.builtin.set_fact: pkg_cask: "{{ pkg_cask + ['blender'] }}" - when: ansible_os_family == 'Darwin' diff --git a/tasks/pkgs/broot.yml b/tasks/pkgs/broot.yml index a91750b..77d5652 100644 --- a/tasks/pkgs/broot.yml +++ b/tasks/pkgs/broot.yml @@ -2,13 +2,13 @@ --- - name: Append to pkg_sys and pkg_cargo when: - - ansible_os_family != 'Darwin' + - ansible_system == 'Linux' ansible.builtin.set_fact: pkg_sys: "{{ pkg_sys + broot.deps }}" pkg_cargo: "{{ pkg_cargo + [broot] }}" - name: Append to pkg_sys when: - - ansible_os_family == 'Darwin' + - ansible_system == 'Darwin' ansible.builtin.set_fact: pkg_sys: "{{ pkg_sys + ['broot'] }}" diff --git a/tasks/pkgs/btop.yml b/tasks/pkgs/btop.yml index 96448e2..63dc7d4 100644 --- a/tasks/pkgs/btop.yml +++ b/tasks/pkgs/btop.yml @@ -1,5 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- name: Append to pkgs +- name: Append to pkg_ssys ansible.builtin.set_fact: pkg_sys: "{{ pkg_sys + ['btop'] }}" diff --git a/tasks/pkgs/buf.yml b/tasks/pkgs/buf.yml index a2b7495..a71f972 100644 --- a/tasks/pkgs/buf.yml +++ b/tasks/pkgs/buf.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: pkgs/go.yml - when: pkgconfig_go is undefined - -- name: add to gopkgs +- name: Add to pkg_go + notify: + - Depend go ansible.builtin.set_fact: - gopkgs: "{{ gopkgs + ['github.com/bufbuild/buf/cmd/buf@latest'] }}" + pkg_go: "{{ pkg_go + ['github.com/bufbuild/buf/cmd/buf@latest'] }}" diff --git a/tasks/pkgs/bufls.yml b/tasks/pkgs/bufls.yml index 2cc99e7..071ae3b 100644 --- a/tasks/pkgs/bufls.yml +++ b/tasks/pkgs/bufls.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: pkgs/go.yml - when: pkgconfig_go is undefined - -- name: add to gopkgs +- name: Add to pkg_go + notify: + - Depend go ansible.builtin.set_fact: - gopkgs: "{{ gopkgs + [ 'github.com/bufbuild/buf-language-server/cmd/bufls@latest' ] }}" + pkg_go: "{{ pkg_go + ['github.com/bufbuild/buf-language-server/cmd/bufls@latest'] }}" diff --git a/tasks/pkgs/cheat.yml b/tasks/pkgs/cheat.yml index 26d0b1d..6d40a7d 100644 --- a/tasks/pkgs/cheat.yml +++ b/tasks/pkgs/cheat.yml @@ -1,10 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: "pkgs/go.yml" - when: - - pkgconfig_go is undefined - -- name: append to gopkgs +- name: Append to pkg_go + notify: + - Depend go ansible.builtin.set_fact: - gopkgs: "{{ gopkgs + [ 'github.com/cheat/cheat/cmd/cheat@latest' ] }}" + pkg_go: "{{ pkg_go + ['github.com/cheat/cheat/cmd/cheat@latest'] }}" diff --git a/tasks/pkgs/checkmake.yml b/tasks/pkgs/checkmake.yml index 6dc1389..afc1233 100644 --- a/tasks/pkgs/checkmake.yml +++ b/tasks/pkgs/checkmake.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: pkgs/go.yml - when: pkgconfig_go is undefined - -- name: add to gopkgs +- name: Add to pkg_go + notify: + - Depend go ansible.builtin.set_fact: - gopkgs: "{{ gopkgs + ['github.com/mrtazz/checkmake/cmd/checkmake@latest'] }}" + pkg_go: "{{ pkg_go + ['github.com/mrtazz/checkmake/cmd/checkmake@latest'] }}" diff --git a/tasks/pkgs/choose.yml b/tasks/pkgs/choose.yml index 5bddfc7..267cbaa 100644 --- a/tasks/pkgs/choose.yml +++ b/tasks/pkgs/choose.yml @@ -2,12 +2,14 @@ --- - name: Append to cargopkgs when: - - ansible_os_family != 'Darwin' + - ansible_system == 'Linux' + notify: + - Depend cargo ansible.builtin.set_fact: pkg_cargo: "{{ pkg_cargo + [choose] }}" - name: Append to pkg_sys when: - - ansible_os_family == 'Darwin' + - ansible_system == 'Darwin' ansible.builtin.set_fact: pkg_sys: "{{ pkg_sys + ['choose-rust'] }}" diff --git a/tasks/pkgs/cmake.yml b/tasks/pkgs/cmake.yml index f6ae1b7..8ffcabc 100644 --- a/tasks/pkgs/cmake.yml +++ b/tasks/pkgs/cmake.yml @@ -1,5 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- name: append to pkgs +- name: Append to pkgs ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'cmake' ] }}" + pkg_sys: "{{ pkg_sys + ['cmake'] }}" diff --git a/tasks/pkgs/cmakelang.yml b/tasks/pkgs/cmakelang.yml index dceba97..eb13807 100644 --- a/tasks/pkgs/cmakelang.yml +++ b/tasks/pkgs/cmakelang.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: pkgs/pipx.yml - when: pipx is undefined - -- name: add to pipxpkgs +- name: Add to pkg_pipx + notify: + - Depend pipx ansible.builtin.set_fact: - pipxpkgs: "{{ pipxpkgs + ['cmakelang'] }}" + pkg_pipx: "{{ pkg_pipx + ['cmakelang'] }}" diff --git a/tasks/pkgs/commitlint-cli.yml b/tasks/pkgs/commitlint-cli.yml index f135c85..0431296 100644 --- a/tasks/pkgs/commitlint-cli.yml +++ b/tasks/pkgs/commitlint-cli.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: pkgs/nodejs.yml - when: nodejs is undefined - -- name: add to npmpkgs +- name: Add to pkg_npm + notify: + - Depend node ansible.builtin.set_fact: - npmpkgs: "{{ npmpkgs + ['@commitlint/cli'] }}" + pkg_npm: "{{ pkg_npm + ['@commitlint/cli'] }}" diff --git a/tasks/pkgs/commitlint-config-conventional.yml b/tasks/pkgs/commitlint-config-conventional.yml index 534dd80..0e1f073 100644 --- a/tasks/pkgs/commitlint-config-conventional.yml +++ b/tasks/pkgs/commitlint-config-conventional.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: pkgs/nodejs.yml - when: nodejs is undefined - -- name: add to npmpkgs +- name: Add to pkg_npm + notify: + - Depend node ansible.builtin.set_fact: - npmpkgs: "{{ npmpkgs + ['@commitlint/config-conventional'] }}" + pkg_npm: "{{ pkg_npm + ['@commitlint/config-conventional'] }}" diff --git a/tasks/pkgs/consul.yml b/tasks/pkgs/consul.yml index df8987a..9560e95 100644 --- a/tasks/pkgs/consul.yml +++ b/tasks/pkgs/consul.yml @@ -3,11 +3,15 @@ - name: Append to pkg_sys when: - ansible_system == 'Linux' + notify: + - Depend hashicorp repo ansible.builtin.set_fact: pkg_sys: "{{ pkg_sys + consul.pkgs }}" - name: Append to pkg_tap when: - ansible_system == 'Darwin' + notify: + - Depend hashicorp repo ansible.builtin.set_fact: pkg_tap: "{{ pkg_tap + consul.pkgs }}" diff --git a/tasks/pkgs/cssls.yml b/tasks/pkgs/cssls.yml index 0d5626d..d8ae9f6 100644 --- a/tasks/pkgs/cssls.yml +++ b/tasks/pkgs/cssls.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: pkgs/nodejs.yml - when: nodejs is undefined - -- name: add to npmpkgs +- name: Add to pkg_npm + notify: + - Depend node ansible.builtin.set_fact: - npmpkgs: "{{ npmpkgs + ['vscode-langservers-extracted'] }}" + pkg_npm: "{{ pkg_npm + ['vscode-langservers-extracted'] }}" diff --git a/tasks/pkgs/curlie.yml b/tasks/pkgs/curlie.yml index 7058f89..2a0eeab 100644 --- a/tasks/pkgs/curlie.yml +++ b/tasks/pkgs/curlie.yml @@ -1,5 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- name: append to gopkgs +- name: Append to pkg_go + notify: + - Depend go ansible.builtin.set_fact: - gopkgs: "{{ gopkgs + [ 'github.com/rs/curlie@latest' ] }}" + pkg_go: "{{ pkg_go + ['github.com/rs/curlie@latest'] }}" diff --git a/tasks/pkgs/dbeaver.yml b/tasks/pkgs/dbeaver.yml index 40f4579..65baefa 100644 --- a/tasks/pkgs/dbeaver.yml +++ b/tasks/pkgs/dbeaver.yml @@ -1,15 +1,15 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: pkgs/flatpak.yml - when: flatpkak is undefined - -- name: append to flatpkgs +- name: Append to pkg_flatpak + when: + - ansible_system == 'Linux' + notify: + - Depend flatpak ansible.builtin.set_fact: - flatpkgs: "{{ flatpkgs + [ 'io.dbeaver.DBeaverCommunity' ] }}" - when: ansible_os_family != 'Darwin' + pkg_flatpak: "{{ pkg_flatpak + ['io.dbeaver.DBeaverCommunity'] }}" -- name: append to caskpkgs +- name: Append to pkg_cask + when: + - ansible_system == 'Darwin' ansible.builtin.set_fact: - caskpkgs: "{{ caskpkgs + [ 'dbeaver-community' ] }}" - when: ansible_os_family == 'Darwin' + pkg_cask: "{{ pkg_cask + ['dbeaver-community'] }}" diff --git a/tasks/pkgs/dockerls.yml b/tasks/pkgs/dockerls.yml index 84b7df5..683275b 100644 --- a/tasks/pkgs/dockerls.yml +++ b/tasks/pkgs/dockerls.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: pkgs/nodejs.yml - when: nodejs is undefined - -- name: add to npmpkgs +- name: Add to pkg_npm + notify: + - Depend node ansible.builtin.set_fact: - npmpkgs: "{{ npmpkgs + ['dockerfile-language-server-nodejs'] }}" + pkg_npm: "{{ pkg_npm + ['dockerfile-language-server-nodejs'] }}" diff --git a/tasks/pkgs/dotenv-linter.yml b/tasks/pkgs/dotenv-linter.yml index 00b3226..159d84f 100644 --- a/tasks/pkgs/dotenv-linter.yml +++ b/tasks/pkgs/dotenv-linter.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: "pkgs/rust.yml" - when: pkgconfig_rust is undefined - -- name: add to cargopkgs +- name: Add to pkg_cargo + notify: + - Depend cargo ansible.builtin.set_fact: - cargopkgs: "{{ cargopkgs + [ 'dotenv-linter' ] }}" + pkg_cargo: "{{ pkg_cargo + ['dotenv-linter'] }}" diff --git a/tasks/pkgs/duf.yml b/tasks/pkgs/duf.yml index e7a2c90..e9bdc8f 100644 --- a/tasks/pkgs/duf.yml +++ b/tasks/pkgs/duf.yml @@ -1,10 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: "pkgs/go.yml" - when: - - pkgconfig_go is undefined - -- name: append to gopkgs +- name: Append to pkg_go + notify: + - Depend go ansible.builtin.set_fact: - gopkgs: "{{ gopkgs + [ 'github.com/muesli/duf@latest' ] }}" + pkg_go: "{{ pkg_go + ['github.com/muesli/duf@latest'] }}" diff --git a/tasks/pkgs/dust.yml b/tasks/pkgs/dust.yml index 0550922..2ef3ca6 100644 --- a/tasks/pkgs/dust.yml +++ b/tasks/pkgs/dust.yml @@ -1,19 +1,15 @@ # vim: set filetype=yaml.ansible : --- -- name: append to syspkgs +- name: Linux specific install + when: + - ansible_system == 'Linux' + notify: + - Depend cargo ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'dust' ] }}" + pkg_cargo: "{{ pkg_cargo + ['du-dust'] }}" + +- name: Append to pkg_sys when: - ansible_os_family == 'Darwin' - -- name: linux specific install - block: - - ansible.builtin.include_tasks: - file: "pkgs/rust.yml" - when: pkgconfig_rust is undefined - - - name: add to cargopkgs - ansible.builtin.set_fact: - cargopkgs: "{{ cargopkgs + [ 'du-dust' ] }}" - when: - - ansible_os_family != 'Darwin' + ansible.builtin.set_fact: + pkg_sys: "{{ pkg_sys + ['dust'] }}" diff --git a/tasks/pkgs/eslint.yml b/tasks/pkgs/eslint.yml index 0d5626d..d8ae9f6 100644 --- a/tasks/pkgs/eslint.yml +++ b/tasks/pkgs/eslint.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: pkgs/nodejs.yml - when: nodejs is undefined - -- name: add to npmpkgs +- name: Add to pkg_npm + notify: + - Depend node ansible.builtin.set_fact: - npmpkgs: "{{ npmpkgs + ['vscode-langservers-extracted'] }}" + pkg_npm: "{{ pkg_npm + ['vscode-langservers-extracted'] }}" diff --git a/tasks/pkgs/eza.yml b/tasks/pkgs/eza.yml index a1436d3..a657330 100644 --- a/tasks/pkgs/eza.yml +++ b/tasks/pkgs/eza.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: "pkgs/rust.yml" - when: pkgconfig_rust is undefined - -- name: add to cargopkgs +- name: Add to pkg_cargo + notify: + - Depend cargo ansible.builtin.set_fact: - cargopkgs: "{{ cargopkgs + [ 'eza' ] }}" + pkg_cargo: "{{ pkg_cargo + ['eza'] }}" diff --git a/tasks/pkgs/firefox.yml b/tasks/pkgs/firefox.yml index c4096bb..0b86d43 100644 --- a/tasks/pkgs/firefox.yml +++ b/tasks/pkgs/firefox.yml @@ -1,11 +1,13 @@ # vim: set filetype=yaml.ansible : --- -- name: append to pkgs +- name: Append to pkgs + when: + - ansible_system == 'Linux' ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'firefox' ] }}" - when: ansible_os_family != 'Darwin' + pkg_sys: "{{ pkg_sys + ['firefox'] }}" -- name: append to caskpkgs +- name: Append to pkg_cask + when: + - ansible_system == 'Darwin' ansible.builtin.set_fact: - caskpkgs: "{{ caskpkgs + [ 'firefox' ] }}" - when: ansible_os_family == 'Darwin' + pkg_cask: "{{ pkg_cask + ['firefox'] }}" diff --git a/tasks/pkgs/flatpak.yml b/tasks/pkgs/flatpak.yml index 8bfced9..9253dcb 100644 --- a/tasks/pkgs/flatpak.yml +++ b/tasks/pkgs/flatpak.yml @@ -1,7 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- name: append to syspkgs +- name: Append to pkg_sys + when: + - ansible_system == 'Linux' ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'flatpak' ] }}" - flatpak: true - when: ansible_os_family != 'Darwin' + pkg_sys: "{{ pkg_sys + ['flatpak'] }}" diff --git a/tasks/pkgs/ghostty.yml b/tasks/pkgs/ghostty.yml index bdead87..3701146 100644 --- a/tasks/pkgs/ghostty.yml +++ b/tasks/pkgs/ghostty.yml @@ -2,7 +2,9 @@ --- - name: Source pkg installation when: - - ghostty.method == 'src' or + - ghostty.method == 'src' + notify: + - Depend zig block: - name: Build ghostty from source ansible.builtin.set_fact: diff --git a/tasks/pkgs/glow.yml b/tasks/pkgs/glow.yml index a95cb1f..e463817 100644 --- a/tasks/pkgs/glow.yml +++ b/tasks/pkgs/glow.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: pkgs/go.yml - when: pkgconfig_go is undefined - -- name: add to gopkgs +- name: Add to pkg_go + notify: + - Depend go ansible.builtin.set_fact: - gopkgs: "{{ gopkgs + ['github.com/charmbracelet/glow@latest'] }}" + pkg_go: "{{ pkg_go + ['github.com/charmbracelet/glow@latest'] }}" diff --git a/tasks/pkgs/go.yml b/tasks/pkgs/go.yml index 13551a8..c92d2bd 100644 --- a/tasks/pkgs/go.yml +++ b/tasks/pkgs/go.yml @@ -2,12 +2,12 @@ --- - name: Install from archive when: - - prefer_archive + - go.use_archive ansible.builtin.set_fact: - archive_pkgs: "{{ archive_pkgs + ['go'] }}" + pkg_archive: "{{ pkg_archive + ['go'] }}" - name: Append to pkgs when: - - not prefer_archive + - not go.use_archive ansible.builtin.set_fact: - sys_pkgs: "{{ src_pkgs + ['go'] }}" + pkg_sys: "{{ pkg_sys + ['go'] }}" diff --git a/tasks/pkgs/godot.yml b/tasks/pkgs/godot.yml index c8071e7..0cd00fd 100644 --- a/tasks/pkgs/godot.yml +++ b/tasks/pkgs/godot.yml @@ -1,16 +1,15 @@ # vim: set filetype=yaml.ansible : --- -- block: - - ansible.builtin.include_tasks: - file: pkgs/flatpak.yml - when: flatpak is undefined - - name: append to flatpkgs - ansible.builtin.set_fact: - flatpkgs: "{{ flatpkgs + [ 'org.godotengine.Godot' ] }}" +- name: Append to pkg_flatpak when: - - ansible_os_family != 'Darwin' - -- name: append to caskpkgs + - ansible_system == 'Linux' + notify: + - Depend flatpak ansible.builtin.set_fact: - caskpkgs: "{{ caskpkgs + [ 'godot' ] }}" - when: ansible_os_family == 'Darwin' + pkg_flatpak: "{{ pkg_flatpak + ['org.godotengine.Godot'] }}" + +- name: Append to pkg_cask + when: + - ansible_system == 'Darwin' + ansible.builtin.set_fact: + pkg_cask: "{{ pkg_cask + ['godot'] }}" diff --git a/tasks/pkgs/gopls.yml b/tasks/pkgs/gopls.yml index 0ba993b..ff162b1 100644 --- a/tasks/pkgs/gopls.yml +++ b/tasks/pkgs/gopls.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: pkgs/go.yml - when: pkgconfig_go is undefined - -- name: add to gopkgs +- name: Add to pkg_go + notify: + - Depend go ansible.builtin.set_fact: - gopkgs: "{{ gopkgs + ['golang.org/x/tools/gopls@latest'] }}" + pkg_go: "{{ pkg_go + ['golang.org/x/tools/gopls@latest'] }}" diff --git a/tasks/pkgs/gping.yml b/tasks/pkgs/gping.yml index af0691f..794f94d 100644 --- a/tasks/pkgs/gping.yml +++ b/tasks/pkgs/gping.yml @@ -1,19 +1,15 @@ # vim: set filetype=yaml.ansible : --- -- name: append to syspkgs +- name: Append to pkg_sys + when: + - ansible_system == 'Darwin' ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'gping' ] }}" - when: - - ansible_os_family == 'Darwin' + pkg_sys: "{{ pkg_sys + ['gping'] }}" -- name: linux specific - block: - - ansible.builtin.include_tasks: - file: "pkgs/rust.yml" - when: - - pkgconfig_rust is undefined - - - ansible.builtin.set_fact: - cargopkgs: "{{ cargopkgs + [ 'gping' ] }}" +- name: Append to pkg_cargo when: - - ansible_os_family != 'Darwin' + - ansible_system == 'Linux' + notify: + - Depend cargo + ansible.builtin.set_fact: + pkg_cargo: "{{ pkg_cargo + ['gping'] }}" diff --git a/tasks/pkgs/hashicorp.yml b/tasks/pkgs/hashicorp.yml deleted file mode 100644 index 3f73007..0000000 --- a/tasks/pkgs/hashicorp.yml +++ /dev/null @@ -1,3 +0,0 @@ -- name: Enable hashicorp repository - ansible.builtin.include_tasks: - file: repos/hashicorp.yml diff --git a/tasks/pkgs/heroic.yml b/tasks/pkgs/heroic.yml index 347f0f0..cbc233d 100644 --- a/tasks/pkgs/heroic.yml +++ b/tasks/pkgs/heroic.yml @@ -1,16 +1,15 @@ # vim: set filetype=yaml.ansible : --- -- block: - - ansible.builtin.include_tasks: - file: pkgs/flatpak.yml - when: flatpak is undefined - - name: append to flatpkgs - ansible.builtin.set_fact: - flatpkgs: "{{ flatpkgs + [ 'com.heroicgameslauncher.hgl' ] }}" +- name: Append to pkg_flatpak when: - - ansible_os_family != 'Darwin' - -- name: append to caskpkgs + - ansible_system == 'Linux' + notify: + - Depend flatpak ansible.builtin.set_fact: - caskpkgs: "{{ caskpkgs + [ 'heroic' ] }}" - when: ansible_os_family == 'Darwin' + pkg_flatpak: "{{ pkg_flatpak + ['com.heroicgameslauncher.hgl'] }}" + +- name: Append to pkg_cask + when: + - ansible_os_family == 'Darwin' + ansible.builtin.set_fact: + pkg_cask: "{{ pkg_cask + ['heroic'] }}" diff --git a/tasks/pkgs/htmlls.yml b/tasks/pkgs/htmlls.yml index 0d5626d..d8ae9f6 100644 --- a/tasks/pkgs/htmlls.yml +++ b/tasks/pkgs/htmlls.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: pkgs/nodejs.yml - when: nodejs is undefined - -- name: add to npmpkgs +- name: Add to pkg_npm + notify: + - Depend node ansible.builtin.set_fact: - npmpkgs: "{{ npmpkgs + ['vscode-langservers-extracted'] }}" + pkg_npm: "{{ pkg_npm + ['vscode-langservers-extracted'] }}" diff --git a/tasks/pkgs/htmx-lsp.yml b/tasks/pkgs/htmx-lsp.yml index cfb63cd..32a7506 100644 --- a/tasks/pkgs/htmx-lsp.yml +++ b/tasks/pkgs/htmx-lsp.yml @@ -1,9 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: "pkgs/rust.yml" - when: pkgconfig_rust is undefined - -- name: add to cargopkgs +- name: Add to pkg_cargo ansible.builtin.set_fact: - cargopkgs: "{{ cargopkgs + [ 'htmx-lsp' ] }}" + pkg_cargo: "{{ pkg_cargo + ['htmx-lsp'] }}" diff --git a/tasks/pkgs/httpie.yml b/tasks/pkgs/httpie.yml index 2f83325..1596e77 100644 --- a/tasks/pkgs/httpie.yml +++ b/tasks/pkgs/httpie.yml @@ -1,15 +1,15 @@ # vim: set filetype=yaml.ansible : --- -- block: - - ansible.builtin.include_tasks: - file: pkgs/flatpak.yml - when: flatpak is undefined - - - ansible.builtin.set_fact: - flatpkgs: "{{ flatpkgs + [ 'io.httpie.Httpie' ] }}" - when: ansible_os_family != 'Darwin' - -- name: append to caskpkgs +- name: Append to pkg_flatpak + when: + - ansible_system == 'Linux' + notify: + - Depend flatpak ansible.builtin.set_fact: - caskpkgs: "{{ caskpkgs + [ 'httpie' ] }}" - when: ansible_os_family == 'Darwin' + pkg_flatpak: "{{ pkg_flatpak + ['io.httpie.Httpie'] }}" + +- name: Append to pkg_cask + when: + - ansible_os_family == 'Darwin' + ansible.builtin.set_fact: + pkg_cask: "{{ pkg_cask + ['httpie'] }}" diff --git a/tasks/pkgs/hugo.yml b/tasks/pkgs/hugo.yml index 5adcc54..ca0ad61 100644 --- a/tasks/pkgs/hugo.yml +++ b/tasks/pkgs/hugo.yml @@ -1,5 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- name: append to pkgs +- name: Append to pkgs ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'hugo' ] }}" + pkg_sys: "{{ pkg_sys + ['hugo'] }}" diff --git a/tasks/pkgs/intelephense.yml b/tasks/pkgs/intelephense.yml index d22c871..eb1a043 100644 --- a/tasks/pkgs/intelephense.yml +++ b/tasks/pkgs/intelephense.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: pkgs/nodejs.yml - when: nodejs is undefined - -- name: add to npmpkgs +- name: Add to pkg_npm + notify: + - Depend node ansible.builtin.set_fact: - npmpkgs: "{{ npmpkgs + [ 'intelephense' ] }}" + pkg_npm: "{{ pkg_npm + ['intelephense'] }}" diff --git a/tasks/pkgs/jinja-lsp.yml b/tasks/pkgs/jinja-lsp.yml index ff9c2af..93d54b8 100644 --- a/tasks/pkgs/jinja-lsp.yml +++ b/tasks/pkgs/jinja-lsp.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: "pkgs/rust.yml" - when: pkgconfig_rust is undefined - -- name: add to cargopkgs +- name: Add to pkg_cargo + notify: + - Depend cargo ansible.builtin.set_fact: - cargopkgs: "{{ cargopkgs + [ 'jinja-lsp' ] }}" + pkg_cargo: "{{ pkg_cargo + ['jinja-lsp'] }}" diff --git a/tasks/pkgs/jq.yml b/tasks/pkgs/jq.yml index c8e05e9..4911305 100644 --- a/tasks/pkgs/jq.yml +++ b/tasks/pkgs/jq.yml @@ -1,5 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- name: append to pkgs +- name: Append to pkgs ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'jq' ] }}" + pkg_sys: "{{ pkg_sys + ['jq'] }}" diff --git a/tasks/pkgs/jsonls.yml b/tasks/pkgs/jsonls.yml index 0d5626d..d8ae9f6 100644 --- a/tasks/pkgs/jsonls.yml +++ b/tasks/pkgs/jsonls.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: pkgs/nodejs.yml - when: nodejs is undefined - -- name: add to npmpkgs +- name: Add to pkg_npm + notify: + - Depend node ansible.builtin.set_fact: - npmpkgs: "{{ npmpkgs + ['vscode-langservers-extracted'] }}" + pkg_npm: "{{ pkg_npm + ['vscode-langservers-extracted'] }}" diff --git a/tasks/pkgs/lazygit.yml b/tasks/pkgs/lazygit.yml index de3ab98..06b0b12 100644 --- a/tasks/pkgs/lazygit.yml +++ b/tasks/pkgs/lazygit.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: pkgs/go.yml - when: pkgconfig_go is undefined - -- name: add to gopkgs +- name: Add to pkg_go + notify: + - Depend go ansible.builtin.set_fact: - gopkgs: "{{ gopkgs + ['github.com/jesseduffield/lazygit@latest'] }}" + pkg_go: "{{ pkg_go + ['github.com/jesseduffield/lazygit@latest'] }}" diff --git a/tasks/pkgs/libreoffice.yml b/tasks/pkgs/libreoffice.yml index 05b13eb..ecd7405 100644 --- a/tasks/pkgs/libreoffice.yml +++ b/tasks/pkgs/libreoffice.yml @@ -1,20 +1,17 @@ # vim: set filetype=yaml.ansible : --- -- name: Linux specific methods +- name: Append to flatpkgs when: - - ansible_system == 'Linux' - block: - - name: Append to flatpkgs - when: - - libreoffice.method == 'flatpak' - ansible.builtin.set_fact: - flatpkgs: "{{ flatpkgs + libreoffice.flatpak }}" + - libreoffice.method == 'flatpak' + ansible.builtin.set_fact: + flatpkgs: "{{ flatpkgs + libreoffice.flatpak }}" - - name: Append to pkg_sys - when: - - libreoffice.method == 'sys' - ansible.builtin.set_fact: - sys_pkg: "{{ sys_pkg + libreoffice.pkgs }}" +- name: Append to pkg_sys + when: + - libreoffice.method == 'sys' + - ansible_system == 'Linux' + ansible.builtin.set_fact: + sys_pkg: "{{ sys_pkg + libreoffice.pkgs }}" - name: Append to caskpkgs when: diff --git a/tasks/pkgs/lua-language-server.yml b/tasks/pkgs/lua-language-server.yml index 0e94466..b64bb6d 100644 --- a/tasks/pkgs/lua-language-server.yml +++ b/tasks/pkgs/lua-language-server.yml @@ -1,11 +1,13 @@ # vim: set filetype=yaml.ansible : --- - name: Append to pkgs + when: + - ansible_system == 'Linux' ansible.builtin.set_fact: - srcpkgs: "{{ srcpkgs + ['lua-language-server'] }}" + pkg_archive: "{{ pkg_archive + ['luals'] }}" - name: Append to pkg_sys when: - - ansible_os_family == 'Darwin' + - ansible_system == 'Darwin' ansible.builtin.set_fact: pkg_sys: "{{ pkg_sys + ['lua-language-server'] }}" diff --git a/tasks/pkgs/markdownlint-cli.yml b/tasks/pkgs/markdownlint-cli.yml index 06e13de..b31c30b 100644 --- a/tasks/pkgs/markdownlint-cli.yml +++ b/tasks/pkgs/markdownlint-cli.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: pkgs/nodejs.yml - when: nodejs is undefined - -- name: add to npmpkgs +- name: Add to pkg_npm + notify: + - Depend node ansible.builtin.set_fact: - npmpkgs: "{{ npmpkgs + ['markdownlint-cli'] }}" + pkg_npm: "{{ pkg_npm + ['markdownlint-cli'] }}" diff --git a/tasks/pkgs/mcfly.yml b/tasks/pkgs/mcfly.yml index 78fdadd..a90770e 100644 --- a/tasks/pkgs/mcfly.yml +++ b/tasks/pkgs/mcfly.yml @@ -1,19 +1,13 @@ # vim: set filetype=yaml.ansible : --- -- name: append to syspkgs - ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'mcfly' ] }}" +- name: Append to pkg_sys when: - ansible_os_family == 'Darwin' + ansible.builtin.set_fact: + pkg_sys: "{{ pkg_sys + ['mcfly'] }}" -- name: linux specific install - block: - - ansible.builtin.include_tasks: - file: "pkgs/rust.yml" - when: pkgconfig_rust is undefined - - - name: add to cargopkgs - ansible.builtin.set_fact: - cargopkgs: "{{ cargopkgs + [ 'mcfly' ] }}" +- name: Add to pkg_cargo when: - - ansible_os_family != 'Darwin' + - ansible_system == 'Linux' + ansible.builtin.set_fact: + pkg_cargo: "{{ pkg_cargo + ['mcfly'] }}" diff --git a/tasks/pkgs/neovide.yml b/tasks/pkgs/neovide.yml index 3618477..771045e 100644 --- a/tasks/pkgs/neovide.yml +++ b/tasks/pkgs/neovide.yml @@ -3,11 +3,13 @@ - name: Append to pkgs when: - ansible_system == 'Linux' + notify: + - Depend cargo ansible.builtin.set_fact: pkg_sys: "{{ pkg_sys + neovide.deps }}" pkg_cargo: "{{ pkg_cargo + [neovide] }}" -- name: Append neovide to caskpkgs +- name: Append neovide to pkg_cask when: - ansible_system == 'Darwin' ansible.builtin.set_fact: diff --git a/tasks/pkgs/neovim.yml b/tasks/pkgs/neovim.yml index 737dd68..0033bfc 100644 --- a/tasks/pkgs/neovim.yml +++ b/tasks/pkgs/neovim.yml @@ -1,50 +1,13 @@ # vim: set filetype=yaml.ansible : --- -- name: Load neovim config - ansible.builtin.include_vars: - file: neovim.yml - name: _neovim - -- name: Combine neovim default and user config - ansible.builtin.set_fact: - pkgconfig_neovim: "{{ _neovim | ansible.builtin.combine(pkgconfig.neovim) }}" - -- name: Set neovim facts - ansible.builtin.set_fact: - nvim: - appimg: "{{ pkgconfig_neovim.appimage }}" - become: "{{ pkgconfig_neovim.dobecome }}" - bldtype: "{{ pkgconfig_neovim.build_type }}" - group: "{{ pkgconfig_neovim.group }}" - instdir: "{{ pkgconfig_neovim.install_dir }}" - instmtd: "{{ pkgconfig_neovim.install_method }}" - instpfx: "{{ pkgconfig_neovim.install_prefix }}" - owner: "{{ pkgconfig_neovim.owner }}" - ver: "{{ pkgconfig_neovim.version }}" - -- name: Linux specific install +- name: Append to appimages when: - - ansible_system == 'Linux' - block: - # install system package when on an up to date distro - - name: Append to syspkgs - when: - - (ansible_distribution == 'Fedora') or - (ansible_distribution == 'Ubuntu') - - - name: Append to appimages - when: - - nvim.instmtd == 'appimage' - ansible.builtin.set_fact: - appimages: "{{ appimages + ['neovim'] }}" -- name: Append neovim to syspkgs - when: - - ansible_os_family == 'Darwin' + - nvim.method == 'appimage' ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + ['neovim'] }}" + pkg_appimage: "{{ pkg_appimage + ['neovim'] }}" -- name: Append neovim to srcpkgs +- name: Append neovim to pkg_sys when: - - nvim.instmtd == 'source' + - nvim.method == 'sys' ansible.builtin.set_fact: - srcpkgs: "{{ srcpkgs + ['neovim'] }}" + pkg_sys: "{{ pkg_sys + ['neovim'] }}" diff --git a/tasks/pkgs/nerdfonts.yml b/tasks/pkgs/nerdfonts.yml index b489d6b..78a2548 100644 --- a/tasks/pkgs/nerdfonts.yml +++ b/tasks/pkgs/nerdfonts.yml @@ -1,14 +1,16 @@ # vim: set filetype=yaml.ansible : --- - name: Append to srcpkgs + when: + - ansible_system == 'Linux' ansible.builtin.set_fact: pkg_archive: "{{ pkg_archive + ['nerdfonts'] }}" - when: ansible_system == 'Linux' - name: Append to caskpkgs - ansible.builtin.set_fact: - pkg_cask: "{{ pkg_cask + [pkgconfig.nerdfonts.fonts[font].brew] }}" + when: + - ansible_system == 'Darwin' loop: "{{ nerdfonts.fonts }}" loop_control: loop_var: font - when: ansible_system == 'Darwin' + ansible.builtin.set_fact: + pkg_cask: "{{ pkg_cask + [pkgconfig.nerdfonts.fonts[font].brew] }}" diff --git a/tasks/pkgs/nextcloud.yml b/tasks/pkgs/nextcloud.yml index 4ec2c47..54c63e7 100644 --- a/tasks/pkgs/nextcloud.yml +++ b/tasks/pkgs/nextcloud.yml @@ -1,17 +1,23 @@ # vim: set filetype=yaml.ansible : --- -- name: append to flatpkgs - block: - - ansible.builtin.include_tasks: - file: pkgs/flatpak.yml - when: flatpak is undefined - - - ansible.builtin.set_fact: - flatpkgs: "{{ flatpkgs + [ 'com.nextcloud.desktopclient.nextcloud' ] }}" +- name: Append to pkg_Flatpak when: - - ansible_os_family != 'Darwin' - -- name: append to caskpkgs + - ansible_system == 'Linux' + - nextcloud.method == 'flatpak' + notify: + - Depend flatpak ansible.builtin.set_fact: - caskpkgs: "{{ caskpkgs + [ 'nextcloud' ] }}" - when: ansible_os_family == 'Darwin' + pkg_flatpak: "{{ pkg_flatpak + [nextcloud] }}" + +- name: Append to pkg_sys + when: + - ansible_system == 'Linux' + - nextcloud.method == 'sys' + ansible.builtin.set_fact: + pkg_sys: "{{ pkg_sys + ['nextcloud'] }}" + +- name: Append to pkg_cask + when: + - ansible_os_family == 'Darwin' + ansible.builtin.set_fact: + pkg_cask: "{{ pkg_cask + ['nextcloud'] }}" diff --git a/tasks/pkgs/nginxls.yml b/tasks/pkgs/nginxls.yml index 428f990..b311db7 100644 --- a/tasks/pkgs/nginxls.yml +++ b/tasks/pkgs/nginxls.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: pkgs/pipx.yml - when: pipx is undefined - -- name: add to pipxpkgs +- name: Add to pkg_pipx + notify: + - Depend node ansible.builtin.set_fact: - pipxpkgs: "{{ pipxpkgs + ['nginx-language-server'] }}" + pkg_pipx: "{{ pkg_pipx + ['nginx-language-server'] }}" diff --git a/tasks/pkgs/nodejs.yml b/tasks/pkgs/nodejs.yml index 4209ead..c06d282 100644 --- a/tasks/pkgs/nodejs.yml +++ b/tasks/pkgs/nodejs.yml @@ -2,4 +2,4 @@ --- - name: Append to pkgs ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + pkgconfig.nodejs.pkgs[ansible_system] }}" + pkg_sys: "{{ pkg_sys + pkgconfig.nodejs.pkgs[ansible_system] }}" diff --git a/tasks/pkgs/nomad.yml b/tasks/pkgs/nomad.yml index b173d26..9868b19 100644 --- a/tasks/pkgs/nomad.yml +++ b/tasks/pkgs/nomad.yml @@ -1,11 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- name: ensure hashicorp repo is active - ansible.builtin.include_tasks: - file: "pkgs/hashicorp_repo.yml" - when: hashicorp is undefined - -- name: append to pkgs +- name: Append to pkgs + notify: + - Depend hashicorp repo ansible.builtin.set_fact: - tappkgs: "{{ tappkgs + [ pkgconfig.nomad[ansible_system] ] }}" - + pkg_tap: "{{ pkg_tap + [pkgconfig.nomad[ansible_system]] }}" diff --git a/tasks/pkgs/packer.yml b/tasks/pkgs/packer.yml index bb8e779..7ab6642 100644 --- a/tasks/pkgs/packer.yml +++ b/tasks/pkgs/packer.yml @@ -1,10 +1,15 @@ # vim: set filetype=yaml.ansible : --- -- name: ensure hashicorp repo is active - ansible.builtin.include_tasks: - file: "pkgs/hashicorp_repo.yml" - when: hashicorp is undefined - -- name: append to pkgs +- name: Append to pkg_tap + when: + - ansible_system == 'Darwin' ansible.builtin.set_fact: - tappkgs: "{{ tappkgs + [ pkgconfig.packer[ansible_system] ] }}" + pkg_tap: "{{ pkg_tap + [pkgconfig.packer[ansible_system]] }}" + +- name: Append to pkg_sys + when: + - ansible_system == 'Linux' + notify: + - Depend hashicorp repo + ansible.builtin.set_fact: + pkg_sys: "{{ pkg_sys + ['packer'] }}" diff --git a/tasks/pkgs/templ.yml b/tasks/pkgs/templ.yml index ef6f9e2..ca9028b 100644 --- a/tasks/pkgs/templ.yml +++ b/tasks/pkgs/templ.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: pkgs/go.yml - when: pkgconfig_go is undefined - -- name: add to gopkgs +- name: Add to pkg_go + notify: + - Depends go ansible.builtin.set_fact: - gopkgs: "{{ gopkgs + ['github.com/a-h/templ/cmd/templ@latest'] }}" + pkg_go: "{{ pkg_go + ['github.com/a-h/templ/cmd/templ@latest'] }}" diff --git a/vars/pkgs/neovim.yml b/vars/pkgs/neovim.yml index 9badcd4..14df1dc 100644 --- a/vars/pkgs/neovim.yml +++ b/vars/pkgs/neovim.yml @@ -9,3 +9,6 @@ neovim: Fedora: sys Ubuntu: sys MacOSX: sys + pkgs: + default: + - neovim diff --git a/vars/pkgs/nextcloud.yml b/vars/pkgs/nextcloud.yml new file mode 100644 index 0000000..8d6934d --- /dev/null +++ b/vars/pkgs/nextcloud.yml @@ -0,0 +1,4 @@ +nextcloud: + flatpak: + name: com.nextcloud.desktopclient.nextcloud + remote: flathub From 2d825d855dc1bfdb6cf5c8a07c02a767b481539d Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Sat, 22 Feb 2025 10:51:53 -0700 Subject: [PATCH 26/38] fix remaining packages to new format - still needs testing --- tasks/{src => archive}/zig.yml | 34 ++++++-------- tasks/{src => archive}/zls.yml | 36 +++++++-------- tasks/config/rust.yml | 5 +- tasks/pkgs/pandoc.yml | 4 +- tasks/pkgs/pgadmin.yml | 25 +++++----- tasks/pkgs/podman.yml | 4 +- tasks/pkgs/pyright.yml | 10 ++-- tasks/pkgs/{python3-pip.yml => python3.yml} | 0 tasks/pkgs/quobix-vacuum.yml | 10 ++-- tasks/pkgs/revive.yml | 10 ++-- tasks/pkgs/ripgrep.yml | 4 +- tasks/pkgs/rust.yml | 2 +- tasks/pkgs/sd.yml | 24 ++++------ tasks/pkgs/sqlfluff.yml | 10 ++-- tasks/pkgs/sqlls.yml | 11 ++--- tasks/pkgs/starship.yml | 11 ++--- tasks/pkgs/stow.yml | 4 +- tasks/pkgs/tailscale.yml | 51 ++++++++++++--------- tasks/pkgs/tailwindcss-languageserver.yml | 10 ++-- tasks/pkgs/templ.yml | 2 +- tasks/pkgs/terraform.yml | 11 ++--- tasks/pkgs/terraformls.yml | 21 ++++++--- tasks/pkgs/thunderbird.yml | 18 ++++---- tasks/pkgs/tidy.yml | 7 +-- tasks/pkgs/tldr.yml | 20 +++----- tasks/pkgs/vault.yml | 21 ++++++--- tasks/pkgs/xh.yml | 2 +- tasks/pkgs/yamlls.yml | 10 ++-- tasks/pkgs/zfs.yml | 14 +++--- tasks/pkgs/zig.yml | 10 +--- tasks/pkgs/zls.yml | 12 ++--- tasks/pkgs/zoxide.yml | 4 +- vars/pkgs/pgadmin.yml | 4 ++ 33 files changed, 200 insertions(+), 221 deletions(-) rename tasks/{src => archive}/zig.yml (59%) rename tasks/{src => archive}/zls.yml (54%) rename tasks/pkgs/{python3-pip.yml => python3.yml} (100%) create mode 100644 vars/pkgs/pgadmin.yml diff --git a/tasks/src/zig.yml b/tasks/archive/zig.yml similarity index 59% rename from tasks/src/zig.yml rename to tasks/archive/zig.yml index 662574e..a15bcc0 100644 --- a/tasks/src/zig.yml +++ b/tasks/archive/zig.yml @@ -1,46 +1,42 @@ # vim: set filetype=yaml.ansible : --- -- name: download zig archive +- name: Download zig archive ansible.builtin.set_fact: zig_path: "zig-{{ pkgconfig_zig.sysmap[ansible_system] }}-{{ pkgconfig_zig.archmap[ansible_architecture] }}-{{ pkgconfig_zig.version }}" zig_pkg: "zig-{{ pkgconfig_zig.sysmap[ansible_system] }}-{{ pkgconfig_zig.archmap[ansible_architecture] }}-{{ pkgconfig_zig.version }}.tar.xz" -- name: check if zig {{ pkgconfig_zig.version }} exists +- name: Check if zig exists ansible.builtin.stat: path: "{{ pkgconfig_zig.install_path }}/{{ zig_path }}/zig" register: r_zig_stat -- name: update/install zig +- name: Update/install zig + when: + - not r_zig_stat.stat.exists block: - - name: create temp path + - name: Create temp path ansible.builtin.tempfile: state: directory prefix: zig_dl. register: d_zig_dl_tmp - - name: download zig archive + - name: Download zig archive ansible.builtin.get_url: dest: "{{ d_zig_dl_tmp.path }}/{{ zig_pkg }}" url: "{{ pkgconfig_zig.base_url }}/{{ pkgconfig_zig.version }}/{{ zig_pkg }}" decompress: false + mode: '0644' - - name: create install_path - ansible.builtin.file: - state: directory - path: "{{ pkgconfig_zig.install_path }}" - become: true - - - name: extract zig package + - name: Extract zig package + become: "{{ ext_become }}" ansible.builtin.unarchive: - dest: "{{ pkgconfig_zig.install_path }}" + dest: "{{ path.archive }}/zig" src: "{{ d_zig_dl_tmp.path }}/{{ zig_pkg }}" remote_src: true - become: true - - name: link zig binary + - name: Link zig binary + become: "{{ ext_become }}" ansible.builtin.file: state: link - src: "{{ pkgconfig_zig.install_path }}/{{ zig_path }}/zig" - path: "{{ pkgconfig_zig.install_prefix }}/bin/zig" - become: true - when: not r_zig_stat.stat.exists + src: "{{ path.archive }}/{{ zig_path }}/zig" + path: "{{ path.bin }}/zig" diff --git a/tasks/src/zls.yml b/tasks/archive/zls.yml similarity index 54% rename from tasks/src/zls.yml rename to tasks/archive/zls.yml index 300975f..9f2d619 100644 --- a/tasks/src/zls.yml +++ b/tasks/archive/zls.yml @@ -1,46 +1,42 @@ # vim: set filetype=yaml.ansible : --- -- name: download zls archive +- name: Download zls archive ansible.builtin.set_fact: zls_path: "zls-{{ pkgconfig_zls.sysmap[ansible_system] }}-{{ pkgconfig_zls.archmap[ansible_architecture] }}-{{ pkgconfig_zls.version }}" zls_pkg: "zls-{{ pkgconfig_zls.sysmap[ansible_system] }}-{{ pkgconfig_zls.archmap[ansible_architecture] }}-{{ pkgconfig_zls.version }}.tar.xz" -- name: check if zls {{ pkgconfig_zls.version }} exists +- name: Check if zls exists ansible.builtin.stat: path: "{{ pkgconfig_zls.install_path }}/{{ zls_path }}/zls" register: r_zls_stat -- name: update/install zls +- name: Update/install zls + when: + - not r_zls_stat.stat.exists block: - - name: create temp path + - name: Create temp path ansible.builtin.tempfile: state: directory prefix: zls_dl. register: d_zls_dl_tmp - - name: download zls archive + - name: Download zls archive ansible.builtin.get_url: dest: "{{ d_zls_dl_tmp.path }}/{{ zls_pkg }}" - url: "{{ pkgconfig_zls.base_url }}/{{ zls_pkg }}" + url: "{{ pkgconfig.zls.base_url }}/{{ zls_pkg }}" decompress: false + mode: '0644' - - name: create install_path - ansible.builtin.file: - state: directory - path: "{{ pkgconfig_zls.install_path }}/{{ zls_path }}" - become: true - - - name: extract zls package + - name: Extract zls package + become: "{{ ext_become }}" ansible.builtin.unarchive: - dest: "{{ pkgconfig_zls.install_path }}/{{ zls_path }}" + dest: "{{ path.ardhive }}/{{ zls_path }}" src: "{{ d_zls_dl_tmp.path }}/{{ zls_pkg }}" remote_src: true - become: true - - name: link zls binary + - name: Link zls binary + become: "{{ ext_become }}" ansible.builtin.file: state: link - src: "{{ pkgconfig_zls.install_path }}/{{ zls_path }}/zls" - path: "{{ pkgconfig_zls.install_prefix }}/bin/zls" - become: true - when: not r_zls_stat.stat.exists + src: "{{ path.ardhive }}/{{ zls_path }}/zls" + path: "{{ path.bin }}/zls" diff --git a/tasks/config/rust.yml b/tasks/config/rust.yml index 1f1ac2d..56fdcc6 100644 --- a/tasks/config/rust.yml +++ b/tasks/config/rust.yml @@ -1,3 +1,6 @@ # vim: set filetype=yaml.ansible : --- -rustup_managed: false +- name: Set rust config + ansible.builtin.set_fact: + rust: + pkgs: "{{ pkgconfig.rust.pkgs[ansible_system] }}" diff --git a/tasks/pkgs/pandoc.yml b/tasks/pkgs/pandoc.yml index e148a03..8da3c55 100644 --- a/tasks/pkgs/pandoc.yml +++ b/tasks/pkgs/pandoc.yml @@ -1,5 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- name: append to pkgs +- name: Append to pkgs ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'pandoc' ] }}" + pkg_sys: "{{ pkg_sys + ['pandoc'] }}" diff --git a/tasks/pkgs/pgadmin.yml b/tasks/pkgs/pgadmin.yml index b74f8f8..0981b16 100644 --- a/tasks/pkgs/pgadmin.yml +++ b/tasks/pkgs/pgadmin.yml @@ -1,16 +1,15 @@ # vim: set filetype=yaml.ansible : --- -- block: - - ansible.builtin.include_tasks: - file: pkgs/flatpak.yml - when: flatpak is undefined +- name: Append to pkg_flatpak + when: + - ansible_system == 'Linux' + notify: + - Depend flatpak + ansible.builtin.set_fact: + pkg_flatpak: "{{ pkg_flatpak + [pkgconfig.pgadmin.flatpak] }}" - - name: append to syspkgs - ansible.builtin.set_fact: - flatpkgs: "{{ flatpkgs + [ 'org.pgadmin.pgadmin4'] }}" - when: ansible_os_family != 'Darwin' - -- name: append to caskpkgs - set_fact: - caskpkgs: "{{ caskpkgs + [ 'pgadmin4' ] }}" - when: ansible_os_family == 'Darwin' +- name: Append to pkg_cask + when: + - ansible_system == 'Darwin' + ansible.builtin.set_fact: + pkg_cask: "{{ pkg_cask + ['pgadmin4'] }}" diff --git a/tasks/pkgs/podman.yml b/tasks/pkgs/podman.yml index dab91e8..7183e96 100644 --- a/tasks/pkgs/podman.yml +++ b/tasks/pkgs/podman.yml @@ -1,5 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- name: append to pkgs +- name: Append to pkg_sys ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'podman' ] }}" + pkg_sys: "{{ pkg_sys + ['podman'] }}" diff --git a/tasks/pkgs/pyright.yml b/tasks/pkgs/pyright.yml index 45ff31e..591e5f9 100644 --- a/tasks/pkgs/pyright.yml +++ b/tasks/pkgs/pyright.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: pkgs/pipx.yml - when: pipx is undefined - -- name: add to pipxpkgs +- name: Add to pkg_pipx + notify: + - Depend pipx ansible.builtin.set_fact: - pipxpkgs: "{{ pipxpkgs + ['pyright'] }}" + pkg_pipx: "{{ pkg_pipx + ['pyright'] }}" diff --git a/tasks/pkgs/python3-pip.yml b/tasks/pkgs/python3.yml similarity index 100% rename from tasks/pkgs/python3-pip.yml rename to tasks/pkgs/python3.yml diff --git a/tasks/pkgs/quobix-vacuum.yml b/tasks/pkgs/quobix-vacuum.yml index 2e9ba17..922898a 100644 --- a/tasks/pkgs/quobix-vacuum.yml +++ b/tasks/pkgs/quobix-vacuum.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: pkgs/nodejs.yml - when: nodejs is undefined - -- name: add to npmpkgs +- name: Add to pkg_npm + notify: + - Depend node ansible.builtin.set_fact: - npmpkgs: "{{ npmpkgs + ['@quobix/vacuum'] }}" + pkg_npm: "{{ pkg_npm + ['@quobix/vacuum'] }}" diff --git a/tasks/pkgs/revive.yml b/tasks/pkgs/revive.yml index 468bf30..3a497cd 100644 --- a/tasks/pkgs/revive.yml +++ b/tasks/pkgs/revive.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: pkgs/go.yml - when: pkgconfig_go is undefined - -- name: add to gopkgs +- name: Add to pkg_go + notify: + - Depend go ansible.builtin.set_fact: - gopkgs: "{{ gopkgs + ['github.com/mgechev/revive@latest'] }}" + pkg_go: "{{ pkg_go + ['github.com/mgechev/revive@latest'] }}" diff --git a/tasks/pkgs/ripgrep.yml b/tasks/pkgs/ripgrep.yml index 06f6d60..8edeef5 100644 --- a/tasks/pkgs/ripgrep.yml +++ b/tasks/pkgs/ripgrep.yml @@ -1,5 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- name: append to pkgs +- name: Append to pkg_sys ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'ripgrep' ] }}" + pkg_sys: "{{ pkg_sys + ['ripgrep'] }}" diff --git a/tasks/pkgs/rust.yml b/tasks/pkgs/rust.yml index f7710c3..a1b9592 100644 --- a/tasks/pkgs/rust.yml +++ b/tasks/pkgs/rust.yml @@ -2,4 +2,4 @@ --- - name: Append to pkgs ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + pkgconfig.rust.pkgs }}" + pkg_sys: "{{ pkg_sys + pkgconfig.rust.pkgs }}" diff --git a/tasks/pkgs/sd.yml b/tasks/pkgs/sd.yml index 3260e36..159c154 100644 --- a/tasks/pkgs/sd.yml +++ b/tasks/pkgs/sd.yml @@ -1,19 +1,15 @@ # vim: set filetype=yaml.ansible : --- -- name: append to syspkgs +- name: Append to pkg_sys + when: + - ansible_system == 'Darwin' ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'sd' ] }}" - when: - - ansible_os_family == 'Darwin' + pkg_sys: "{{ pkg_sys + ['sd'] }}" -- name: linux specific install - block: - - ansible.builtin.include_tasks: - file: "pkgs/rust.yml" - when: pkgconfig_rust is undefined - - - name: add to cargopkgs - ansible.builtin.set_fact: - cargopkgs: "{{ cargopkgs + [ 'sd' ] }}" +- name: Add to pkg_cargo when: - - ansible_os_family != 'Darwin' + - ansible_system == 'Linux' + notify: + - Depend cargo + ansible.builtin.set_fact: + pkg_cargo: "{{ pkg_cargo + ['sd'] }}" diff --git a/tasks/pkgs/sqlfluff.yml b/tasks/pkgs/sqlfluff.yml index 3d406a2..27bfcca 100644 --- a/tasks/pkgs/sqlfluff.yml +++ b/tasks/pkgs/sqlfluff.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: pkgs/pipx.yml - when: pipx is undefined - -- name: add to pipxpkgs +- name: Add to pkg_pipx + notify: + - Depend pipx ansible.builtin.set_fact: - pipxpkgs: "{{ pipxpkgs + ['sqlfluff'] }}" + pkg_pipx: "{{ pkg_pipx + ['sqlfluff'] }}" diff --git a/tasks/pkgs/sqlls.yml b/tasks/pkgs/sqlls.yml index f2e738d..205bab9 100644 --- a/tasks/pkgs/sqlls.yml +++ b/tasks/pkgs/sqlls.yml @@ -1,10 +1,7 @@ # vim: filetype=yaml.ansible : --- -- name: Use nodejs - ansible.builtin.include_tasks: - file: pkgs/nodejs.yml - when: nodejs is undefined - -- name: Add to npmpkgs +- name: Add to pkg_npm + notify: + - Depend node ansible.builtin.set_fact: - npmpkgs: "{{ npmpkgs + ['sql-language-server'] }}" + pkg_npm: "{{ pkg_npm + ['sql-language-server'] }}" diff --git a/tasks/pkgs/starship.yml b/tasks/pkgs/starship.yml index 1998605..24afd5d 100644 --- a/tasks/pkgs/starship.yml +++ b/tasks/pkgs/starship.yml @@ -1,10 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- name: install rust and cargo - ansible.builtin.include_tasks: - file: "pkgs/rust.yml" - when: pkgconfig_rust is undefined - -- name: add to cargopkgs +- name: Add to pkg_cargo + notify: + - Depend cargo ansible.builtin.set_fact: - cargopkgs: "{{ cargopkgs + [ 'starship' ] }}" + pkg_cargo: "{{ pkg_cargo + ['starship'] }}" diff --git a/tasks/pkgs/stow.yml b/tasks/pkgs/stow.yml index 7792eca..52257a3 100644 --- a/tasks/pkgs/stow.yml +++ b/tasks/pkgs/stow.yml @@ -1,5 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- name: Append to pkgs +- name: Append to pkg_sys ansible.builtin.set_fact: - pkg_sys: "{{ pkg_sys + [ 'stow' ] }}" + pkg_sys: "{{ pkg_sys + ['stow'] }}" diff --git a/tasks/pkgs/tailscale.yml b/tasks/pkgs/tailscale.yml index 3149f0e..1d44134 100644 --- a/tasks/pkgs/tailscale.yml +++ b/tasks/pkgs/tailscale.yml @@ -1,12 +1,14 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.set_fact: - tailscale: true -- name: enable for linux +- name: Enable for linux + when: + - ansible_system == 'Linux' block: - - name: enable for RedHat distros + - name: Enable for RedHat distros + when: + - ansible_os_family == 'RedHat' block: - - name: fedora >=41 + - name: Fedora >=41 ansible.builtin.command: creates: /etc/yum.repos.d/tailscale.repo cmd: "dnf config-manager addrepo --from-repofile={{ pkgconfig.tailscale.url_base }}/fedora/tailscale.repo" @@ -15,7 +17,7 @@ - ansible_distribution == 'Fedora' - ansible_distribution_major_version|int >= 41 - - name: fedora <41 + - name: Fedora <41 ansible.builtin.command: creates: /etc/yum.repos.d/tailscale.repo cmd: "dnf config-manager --add-repo {{ pkgconfig.tailscale.url_base }}/fedora/tailscale.repo" @@ -24,35 +26,40 @@ - ansible_distribution == 'Fedora' - ansible_distribution_major_version|int < 41 - - name: rhel based distros + - name: Rhel based distros ansible.builtin.command: creates: /etc/yum.repos.d/tailscale.repo cmd: "dnf config-manager --add-repo {{ pkgconfig.tailscale.url_base }}/rhel/{{ ansible_os_major_version }}/tailscale.repo" become: true when: - ansible_distribution != 'Fedora' - when: ansible_os_family == 'RedHat' - - name: enable for Debian distros + - name: Enable for Debian distros + when: + - ansible_os_family == 'Debian' block: - - name: install tailscale keyring + - name: Install tailscale keyring block: - - ansible.builtin.get_url: + - name: Get tailscal keyring + become: "{{ sys_pkg_become }}" + ansible.builtin.get_url: url: "{{ pkgconfig.tailscale.url_base }}/debian/{{ pkgconfig.tailscale.release[ansible_os_release].gpg }}" dest: /usr/share/keyrings/tailscale-archive-keyring.gpg - become: true - - ansible.builtin.get_url: + mode: '0644' + + - name: Get tailscale repo list + become: "{{ sys_pkg_become }}" + ansible.builtin.get_url: url: "{{ pkgconfig.tailscale.url_base }}/debian/{{ pkgconfig.tailscale.release[ansible_os_release].list }}" dest: /etc/apt/sources.list.d/tailscale.list - become: true - when: ansible_os_family == 'Debian' + mode: '0644' - - name: append to syspkgs + - name: Append to pkg_sys ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'tailscale' ] }}" - when: ansible_os_family != 'Darwin' + pkg_sys: "{{ pkg_sys + ['tailscale'] }}" -- name: append to caskpkgs - set_fact: - caskpkgs: "{{ caskpkgs + [ 'tailscale' ] }}" - when: ansible_os_family == 'Darwin' +- name: Append to pkg_cask + when: + - ansible_system == 'Darwin' + ansible.builtin.set_fact: + pkg_cask: "{{ pkg_cask + ['tailscale'] }}" diff --git a/tasks/pkgs/tailwindcss-languageserver.yml b/tasks/pkgs/tailwindcss-languageserver.yml index f04ec3b..4d78fff 100644 --- a/tasks/pkgs/tailwindcss-languageserver.yml +++ b/tasks/pkgs/tailwindcss-languageserver.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: pkgs/nodejs.yml - when: nodejs is undefined - -- name: add to npmpkgs +- name: Add to pkg_npm + notify: + - Depend node ansible.builtin.set_fact: - npmpkgs: "{{ npmpkgs + ['@tailwindcss/language-server'] }}" + pkg_npm: "{{ pkg_npm + ['@tailwindcss/language-server'] }}" diff --git a/tasks/pkgs/templ.yml b/tasks/pkgs/templ.yml index ca9028b..ef5f66d 100644 --- a/tasks/pkgs/templ.yml +++ b/tasks/pkgs/templ.yml @@ -2,6 +2,6 @@ --- - name: Add to pkg_go notify: - - Depends go + - Depend go ansible.builtin.set_fact: pkg_go: "{{ pkg_go + ['github.com/a-h/templ/cmd/templ@latest'] }}" diff --git a/tasks/pkgs/terraform.yml b/tasks/pkgs/terraform.yml index 6880561..25bf5bc 100644 --- a/tasks/pkgs/terraform.yml +++ b/tasks/pkgs/terraform.yml @@ -1,10 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- name: ensure hashicorp repo is active - ansible.builtin.include_tasks: - file: "pkgs/hashicorp_repo.yml" - when: hashicorp is undefined - -- name: append to pkgs +- name: Append to pkgs + notify: + - Depend hashicorp repo ansible.builtin.set_fact: - tappkgs: "{{ tappkgs + [ pkgconfig.terraform[ansible_system] ] }}" + pkg_taps: "{{ pkg_taps + [pkgconfig.terraform[ansible_system]] }}" diff --git a/tasks/pkgs/terraformls.yml b/tasks/pkgs/terraformls.yml index e3477c3..6db41a0 100644 --- a/tasks/pkgs/terraformls.yml +++ b/tasks/pkgs/terraformls.yml @@ -1,10 +1,17 @@ # vim: set filetype=yaml.ansible : --- -- name: ensure hashicorp repo is active - ansible.builtin.include_tasks: - file: "pkgs/hashicorp_repo.yml" - when: hashicorp is undefined +- name: Append to pkgs + notify: + - Depend hashicorp repo + block: + - name: MacOS specific + when: + - ansible_system == 'Darwin' + ansible.builtin.set_fact: + pkg_taps: "{{ pkg_taps + [pkgconfig.terraformls[ansible_system]] }}" -- name: append to pkgs - ansible.builtin.set_fact: - tappkgs: "{{ tappkgs + [ pkgconfig.terraformls[ansible_system] ] }}" + - name: Linux specific + when: + - ansible_system == 'Linux' + ansible.builtin.set_fact: + pkg_sys: "{{ pkg_sys + ['terraformls'] }}" diff --git a/tasks/pkgs/thunderbird.yml b/tasks/pkgs/thunderbird.yml index 71ef48b..9fa2bdb 100644 --- a/tasks/pkgs/thunderbird.yml +++ b/tasks/pkgs/thunderbird.yml @@ -1,11 +1,13 @@ # vim: set filetype=yaml.ansible : --- -- name: append to syspkgs - set_fact: - syspkgs: "{{ syspkgs + [ 'thunderbird' ] }}" - when: ansible_os_family != 'Darwin' +- name: Append to pkg_sys + when: + - ansible_system == 'Linux' + ansible.builtin.set_fact: + pkg_sys: "{{ pkg_sys + ['thunderbird'] }}" -- name: append to caskpkgs - set_fact: - caskpkgs: "{{ caskpkgs + [ 'thunderbird' ] }}" - when: ansible_os_family == 'Darwin' +- name: Append to pkg_cask + when: + - ansible_system == 'Darwin' + ansible.builtin.set_fact: + pkg_cask: "{{ pkg_cask + ['thunderbird'] }}" diff --git a/tasks/pkgs/tidy.yml b/tasks/pkgs/tidy.yml index dd0e7b4..50d5672 100644 --- a/tasks/pkgs/tidy.yml +++ b/tasks/pkgs/tidy.yml @@ -1,8 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.set_fact: - tidy: true - -- name: append to pkgs +- name: Append to pkg_sys ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + pkgconfig.tidy.pkgs[ansible_system] }}" + pkg_sys: "{{ pkg_sys + pkgconfig.tidy.pkgs[ansible_system] }}" diff --git a/tasks/pkgs/tldr.yml b/tasks/pkgs/tldr.yml index 8fbaeb9..9eafc22 100644 --- a/tasks/pkgs/tldr.yml +++ b/tasks/pkgs/tldr.yml @@ -1,19 +1,13 @@ # vim: set filetype=yaml.ansible : --- -- name: append to syspkgs - ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'tlrc' ] }}" +- name: Append to pkg_sys when: - ansible_os_family == 'Darwin' + ansible.builtin.set_fact: + pkg_sys: "{{ pkg_sys + ['tlrc'] }}" -- name: linux specific install - block: - - ansible.builtin.include_tasks: - file: "pkgs/rust.yml" - when: pkgconfig_rust is undefined - - - name: add to cargopkgs - ansible.builtin.set_fact: - cargopkgs: "{{ cargopkgs + [ 'tlrc' ] }}" +- name: Add to pkg_cargo when: - - ansible_os_family != 'Darwin' + - ansible_system == 'Linux' + ansible.builtin.set_fact: + pkg_cargo: "{{ pkg_cargo + ['tlrc'] }}" diff --git a/tasks/pkgs/vault.yml b/tasks/pkgs/vault.yml index 9c139bf..70337c5 100644 --- a/tasks/pkgs/vault.yml +++ b/tasks/pkgs/vault.yml @@ -1,10 +1,17 @@ # vim: set filetype=yaml.ansible : --- -- name: ensure hashicorp repo is active - ansible.builtin.include_tasks: - file: "pkgs/hashicorp_repo.yml" - when: hashicorp is undefined +- name: Append to pkgs + notify: + - Depend hashicorp repo + block: + - name: MacOS specific + when: + - ansible_system == 'Darwin' + ansible.builtin.set_fact: + pkg_taps: "{{ pkg_taps + [pkgconfig.vault[ansible_system]] }}" -- name: append to pkgs - ansible.builtin.set_fact: - tappkgs: "{{ tappkgs + [ pkgconfig.vault[ansible_system] ] }}" + - name: Linux specific + when: + - ansible_system == 'Linux' + ansible.builtin.set_fact: + pkg_sys: "{{ pkg_sys + ['vault'] }}" diff --git a/tasks/pkgs/xh.yml b/tasks/pkgs/xh.yml index 2162acf..8a51d68 100644 --- a/tasks/pkgs/xh.yml +++ b/tasks/pkgs/xh.yml @@ -8,6 +8,6 @@ - name: Add to cargopkgs when: - - ansible_os_family != 'Darwin' + - ansible_system == 'Linux' ansible.builtin.set_fact: pkg_cargo: "{{ pkg_cargo + [xh] }}" diff --git a/tasks/pkgs/yamlls.yml b/tasks/pkgs/yamlls.yml index f23448d..e3d9210 100644 --- a/tasks/pkgs/yamlls.yml +++ b/tasks/pkgs/yamlls.yml @@ -1,9 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_tasks: - file: pkgs/nodejs.yml - when: nodejs is undefined - -- name: add to npmpkgs +- name: Add to pkg_npm + notify: + - Depend node ansible.builtin.set_fact: - npmpkgs: "{{ npmpkgs + ['yaml-language-server'] }}" + pkg_npm: "{{ pkg_npm + ['yaml-language-server'] }}" diff --git a/tasks/pkgs/zfs.yml b/tasks/pkgs/zfs.yml index cae72cd..6d367e2 100644 --- a/tasks/pkgs/zfs.yml +++ b/tasks/pkgs/zfs.yml @@ -2,7 +2,7 @@ --- - name: Linux based installation when: - - ansible_os_family != 'Darwin' + - ansible_system == 'Linux' block: - name: RedHat based configuration when: @@ -22,7 +22,8 @@ state: present - name: Debian configuration - when: ansible_os_family == 'Debian' + when: + - ansible_os_family == 'Debian' block: - name: Enable openzfs repository become: "{{ sys_pkg_become }}" @@ -37,19 +38,20 @@ - name: Pin zfs package to backports become: "{{ sys_pkg_become }}" ansible.builtin.file: + dest: /etc/apt/preferences.d/90_zfs + state: file + mode: '0644' content: | Package: src:zfs-linux Pin: release n={{ zfs.release }}-backports Pin-Priority: 990 - dest: /etc/apt/preferences.d/90_zfs - state: present - mode: '0644' - name: Append to pkgs ansible.builtin.set_fact: pkg_sys: "{{ pkg_sys + zfs.deps + zfs.pkgs }}" - name: Append to caskpkgs - when: ansible_os_family == 'Darwin' + when: + - ansible_os_family == 'Darwin' ansible.builtin.set_fact: pkg_cask: "{{ pkg_cask + ['openzfs'] }}" diff --git a/tasks/pkgs/zig.yml b/tasks/pkgs/zig.yml index a36c852..dfdd026 100644 --- a/tasks/pkgs/zig.yml +++ b/tasks/pkgs/zig.yml @@ -1,11 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_vars: - file: zig.yml - name: _zig -- ansible.builtin.set_fact: - pkgconfig_zig: "{{ _zig | ansible.builtin.combine(pkgconfig.zig) }}" - -- name: append to pkgs +- name: Append to pkgs ansible.builtin.set_fact: - srcpkgs: "{{ srcpkgs + [ 'zig' ] }}" + pkg_src: "{{ pkg_src + ['zig'] }}" diff --git a/tasks/pkgs/zls.yml b/tasks/pkgs/zls.yml index d61d26f..daae7c2 100644 --- a/tasks/pkgs/zls.yml +++ b/tasks/pkgs/zls.yml @@ -1,11 +1,7 @@ # vim: set filetype=yaml.ansible : --- -- ansible.builtin.include_vars: - file: zls.yml - name: _zls -- ansible.builtin.set_fact: - pkgconfig_zls: "{{ _zls | ansible.builtin.combine(pkgconfig.zls) }}" - -- name: append to pkgs +- name: Append to pkgs + notify: + - Depend zig ansible.builtin.set_fact: - srcpkgs: "{{ srcpkgs + [ 'zls' ] }}" + pkg_src: "{{ pkg_src + ['zls'] }}" diff --git a/tasks/pkgs/zoxide.yml b/tasks/pkgs/zoxide.yml index 5e9f779..abfa6fc 100644 --- a/tasks/pkgs/zoxide.yml +++ b/tasks/pkgs/zoxide.yml @@ -1,5 +1,5 @@ # vim: set filetype=yaml.ansible : --- -- name: append to pkgs +- name: Append to pkgs ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + [ 'zoxide' ] }}" + pkg_sys: "{{ pkg_sys + ['zoxide'] }}" diff --git a/vars/pkgs/pgadmin.yml b/vars/pkgs/pgadmin.yml new file mode 100644 index 0000000..959f4a4 --- /dev/null +++ b/vars/pkgs/pgadmin.yml @@ -0,0 +1,4 @@ +pgadmin: + flatpak: + name: org.pgadmin.pgadmin4 + remote: flathub From d1e8957f94dae9c5f25f328808c302b79aa24aaa Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Sat, 22 Feb 2025 14:59:18 -0700 Subject: [PATCH 27/38] fix packages --- tasks/appimage.yml | 6 +++--- tasks/archive/go.yml | 9 ++++----- tasks/archive/zls.yml | 22 ++++++---------------- tasks/cargo.yml | 2 +- tasks/config/clangd.yml | 2 +- tasks/config/fd.yml | 2 +- tasks/config/go.yml | 10 ++++++---- tasks/config/libreoffice.yml | 4 ++-- tasks/config/neovim.yml | 2 +- tasks/config/nodejs.yml | 4 ++++ tasks/config/pgadmin.yml | 6 ++++++ tasks/config/terraform.yml | 4 ++++ tasks/config/terraformls.yml | 4 ++++ tasks/config/tidy.yml | 4 ++++ tasks/config/zls.yml | 10 +++++++--- tasks/go.yml | 2 +- tasks/linux.yml | 10 ++++++---- tasks/macos.yml | 15 +++++++++------ tasks/main.yml | 6 ++++++ tasks/npm.yml | 2 +- tasks/pipx.yml | 2 +- tasks/pkgs/broot.yml | 2 ++ tasks/pkgs/direnv.yml | 3 +++ tasks/pkgs/ghostty.yml | 1 + tasks/pkgs/go.yml | 5 ++--- tasks/pkgs/libreoffice.yml | 9 ++++----- tasks/pkgs/neovim.yml | 4 ++-- tasks/pkgs/nodejs.yml | 2 +- tasks/pkgs/pgadmin.yml | 8 ++++---- tasks/pkgs/rust.yml | 2 +- tasks/pkgs/terraform.yml | 14 ++++++++++++-- tasks/pkgs/terraformls.yml | 4 ++-- tasks/pkgs/tidy.yml | 2 +- tasks/pkgs/vault.yml | 2 +- tasks/pkgs/zls.yml | 2 +- tasks/repos/hashicorp.yml | 17 ++++------------- tasks/src/ghostty.yml | 30 +++++++----------------------- tasks/src/neovim.yml | 10 ++++------ vars/pkgs/broot.yml | 1 + vars/pkgs/fd.yml | 4 +--- vars/pkgs/ghostty.yml | 1 + vars/pkgs/libreoffice.yml | 17 ++++++++++++----- vars/pkgs/neovim.yml | 4 ++-- vars/pkgs/pgadmin.yml | 8 ++++++++ vars/pkgs/terraform.yml | 7 +++++-- vars/pkgs/terraformls.yml | 7 +++++-- vars/pkgs/zls.yml | 1 + 47 files changed, 166 insertions(+), 129 deletions(-) create mode 100644 tasks/config/nodejs.yml create mode 100644 tasks/config/pgadmin.yml create mode 100644 tasks/config/terraform.yml create mode 100644 tasks/config/terraformls.yml create mode 100644 tasks/config/tidy.yml create mode 100644 tasks/pkgs/direnv.yml diff --git a/tasks/appimage.yml b/tasks/appimage.yml index df1a6b0..57965bf 100644 --- a/tasks/appimage.yml +++ b/tasks/appimage.yml @@ -1,7 +1,7 @@ # vim: set filetype=yaml.ansible : --- - name: Install appimage - become: "{{ archive_become }}" + become: "{{ ext_become }}" block: - name: Ensure appimage path exists ansible.builtin.file: @@ -10,7 +10,7 @@ state: directory - name: Fetch appimage - become: "{{ archive_become }}" + become: "{{ ext_become }}" ansible.builtin.get_url: mode: '0755' decompress: false @@ -19,7 +19,7 @@ dest: "{{ path.appimage }}/{{ pkg.link_name }}/{{ pkg.file }}" - name: Link appimage to bin - become: "{{ archive_become }}" + become: "{{ ext_become }}" ansible.builtin.file: state: link src: "{{ path.appimage }}/{{ pkg.link_name }}/{{ pkg.file }}" diff --git a/tasks/archive/go.yml b/tasks/archive/go.yml index 2b5a37d..94a1fbd 100644 --- a/tasks/archive/go.yml +++ b/tasks/archive/go.yml @@ -20,8 +20,8 @@ become: "{{ sys_pkg_become }}" register: get_url_go ansible.builtin.get_url: - dest: "{{ path.cache }}/{{ go.archive }}" - url: "{{ go.url }}" + dest: "{{ d_tempdir.path }}/{{ go.archive }}" + url: "{{ go.base_url }}/{{ go.archive }}" checksum: "{{ go.sum }}" decompress: false mode: '0644' @@ -32,7 +32,7 @@ - ansible_system == 'Linux' ansible.builtin.unarchive: dest: "{{ path.prefix }}" - src: "{{ d_go_dl_tmp.path }}/{{ go.archive }}" + src: "{{ d_tempdir.path }}/{{ go.archive }}" remote_src: true - name: Install go macOS using pkg file @@ -40,5 +40,4 @@ when: - ansible_distribution == 'MacOSX' ansible.builtin.command: - creates: "{{ path.go }}" - cmd: "installer -pkg {{ d_go_dl_tmp.path }}/{{ go.archive }} -target /" + cmd: "installer -pkg {{ d_tempdir.path }}/{{ go.archive }} -target /" diff --git a/tasks/archive/zls.yml b/tasks/archive/zls.yml index 9f2d619..355d5f7 100644 --- a/tasks/archive/zls.yml +++ b/tasks/archive/zls.yml @@ -2,41 +2,31 @@ --- - name: Download zls archive ansible.builtin.set_fact: - zls_path: "zls-{{ pkgconfig_zls.sysmap[ansible_system] }}-{{ pkgconfig_zls.archmap[ansible_architecture] }}-{{ pkgconfig_zls.version }}" - zls_pkg: "zls-{{ pkgconfig_zls.sysmap[ansible_system] }}-{{ pkgconfig_zls.archmap[ansible_architecture] }}-{{ pkgconfig_zls.version }}.tar.xz" - name: Check if zls exists ansible.builtin.stat: - path: "{{ pkgconfig_zls.install_path }}/{{ zls_path }}/zls" + path: "{{ path.archive }}/{{ zls_path }}/zls" register: r_zls_stat - name: Update/install zls - when: - - not r_zls_stat.stat.exists block: - - name: Create temp path - ansible.builtin.tempfile: - state: directory - prefix: zls_dl. - register: d_zls_dl_tmp - - name: Download zls archive ansible.builtin.get_url: - dest: "{{ d_zls_dl_tmp.path }}/{{ zls_pkg }}" - url: "{{ pkgconfig.zls.base_url }}/{{ zls_pkg }}" + dest: "{{ d_tempfile.path }}/{{ zls_pkg }}" + url: "{{ zls.base_url }}/{{ zls_pkg }}" decompress: false mode: '0644' - name: Extract zls package become: "{{ ext_become }}" ansible.builtin.unarchive: - dest: "{{ path.ardhive }}/{{ zls_path }}" - src: "{{ d_zls_dl_tmp.path }}/{{ zls_pkg }}" + dest: "{{ path.archive }}" + src: "{{ d_tempfile.path }}/{{ zls_pkg }}" remote_src: true - name: Link zls binary become: "{{ ext_become }}" ansible.builtin.file: state: link - src: "{{ path.ardhive }}/{{ zls_path }}/zls" + src: "{{ path.archive }}/{{ zls_path }}/zls" path: "{{ path.bin }}/zls" diff --git a/tasks/cargo.yml b/tasks/cargo.yml index d163ac7..7eb3a5c 100644 --- a/tasks/cargo.yml +++ b/tasks/cargo.yml @@ -1,7 +1,7 @@ # vim: set filetype=yaml.ansible --- - name: Install cargo pkg - become: "{{ archive_become }}" + become: "{{ ext_become }}" community.general.cargo: name: "{{ pkg.name }}" version: "{{ pkg.vers }}" diff --git a/tasks/config/clangd.yml b/tasks/config/clangd.yml index 6777ccb..eacd9b9 100644 --- a/tasks/config/clangd.yml +++ b/tasks/config/clangd.yml @@ -1,4 +1,4 @@ - name: Set clangd config ansible.builtin.set_fact: clangd: - pkgs: "{{ pkgconfig.clangd.pkg[ansible_os_family] }}" + pkgs: "{{ pkgconfig.clangd.pkgs[ansible_os_family] }}" diff --git a/tasks/config/fd.yml b/tasks/config/fd.yml index 861fdbc..dca7e72 100644 --- a/tasks/config/fd.yml +++ b/tasks/config/fd.yml @@ -1,4 +1,4 @@ - name: Set fd config ansible.builtin.set_fact: fd: - pkgs: "{{ pkgconfig.fd.pkgs[ansible_os_famly] }}" + pkgs: "{{ pkgconfig.fd.pkgs[ansible_system] }}" diff --git a/tasks/config/go.yml b/tasks/config/go.yml index b47c418..cce458e 100644 --- a/tasks/config/go.yml +++ b/tasks/config/go.yml @@ -3,7 +3,8 @@ - name: Set go configuration ansible.builtin.set_fact: go: - arch: "{{ pkgconfig_go.archmap[ansible_architecture] }}" + method: archive + arch: "{{ pkgconfig.go.archmap[ansible_architecture] }}" ext: "{{ pkgconfig.go.extmap[ansible_system] }}" sys: "{{ ansible_system | lower }}" vers: "{{ pkgconfig.go.version }}" @@ -11,11 +12,12 @@ - name: Set go composite facts ansible.builtin.set_fact: go: + method: archive arch: "{{ go.arch }}" - archive: "go{{ go.ver }}.{{ go.sys }}-{{ go.arch }}.{{ pkgconfig_go.extmap[ansible_system] }}" + archive: "go{{ go.vers }}.{{ go.sys }}-{{ go.arch }}.{{ pkgconfig.go.extmap[ansible_system] }}" ext: "{{ go.ext }}" - inst_path: "{{ path.install }}/go" + inst_path: "{{ path.prefix }}" sum: "{{ pkgconfig.go.sums[go.vers][ansible_system][go.arch] }}" sys: "{{ go.sys }}" - url: "{{ pkgconfig.go.base_url }}/{{ go.archive }}" + base_url: "{{ pkgconfig.go.base_url }}" vers: "{{ go.vers }}" diff --git a/tasks/config/libreoffice.yml b/tasks/config/libreoffice.yml index 33b99ce..6dbd69a 100644 --- a/tasks/config/libreoffice.yml +++ b/tasks/config/libreoffice.yml @@ -3,6 +3,6 @@ - name: Set libreoffice config ansible.builtin.set_fact: libreoffice: - method: "{{ pkgconfig.libreoffice.method }}" + method: "{{ pkgconfig.libreoffice.methods[ansible_distribution] | default(pkgconfig.libreoffice.methods.default) }}" flatpak: "{{ pkgconfig.libreoffice.flatpak }}" - pkgs: "{{ pkgconfig.libreoffice[ansible_os_family] }}" + pkgs: "{{ pkgconfig.libreoffice.pkgs[ansible_os_family] }}" diff --git a/tasks/config/neovim.yml b/tasks/config/neovim.yml index d4c6ace..eba49a8 100644 --- a/tasks/config/neovim.yml +++ b/tasks/config/neovim.yml @@ -3,7 +3,7 @@ - name: Set neovim install method ansible.builtin.set_fact: neovim: - method: "{{ pkgconfig.neovim.method[ansible_distribution] | default(pkgconfig.neovim.method.default) }}" + method: "{{ pkgconfig.neovim.methods[ansible_distribution] | default(pkgconfig.neovim.methods.default) }}" - name: Set neovim config ansible.builtin.set_fact: diff --git a/tasks/config/nodejs.yml b/tasks/config/nodejs.yml new file mode 100644 index 0000000..1ee3330 --- /dev/null +++ b/tasks/config/nodejs.yml @@ -0,0 +1,4 @@ +- name: Set nodejs config + ansible.builtin.set_fact: + nodejs: + pkgs: "{{ pkgconfig.nodejs.pkgs[ansible_system] }}" diff --git a/tasks/config/pgadmin.yml b/tasks/config/pgadmin.yml new file mode 100644 index 0000000..b458e7d --- /dev/null +++ b/tasks/config/pgadmin.yml @@ -0,0 +1,6 @@ +- name: Set pgadmin config + ansible.builtin.set_fact: + pgadmin: + method: "{{ pkgconfig.pgadmin.methods[ansible_distribution] | default(pkgconfig.pgadmin.methods.default) }}" + pkgs: "{{ pkgconfig.pgadmin.pkgs[ansible_system] }}" + flatpak: "{{ pkgconfig.pgadmin.flatpak }}" diff --git a/tasks/config/terraform.yml b/tasks/config/terraform.yml new file mode 100644 index 0000000..a9081ba --- /dev/null +++ b/tasks/config/terraform.yml @@ -0,0 +1,4 @@ +- name: Set terraform config + ansible.builtin.set_fact: + terraform: + pkgs: "{{ pkgconfig.terraform.pkgs[ansible_system] }}" diff --git a/tasks/config/terraformls.yml b/tasks/config/terraformls.yml new file mode 100644 index 0000000..4389106 --- /dev/null +++ b/tasks/config/terraformls.yml @@ -0,0 +1,4 @@ +- name: Set terraformls config + ansible.builtin.set_fact: + terraformls: + pkgs: "{{ pkgconfig.terraformls.pkgs[ansible_system] }}" diff --git a/tasks/config/tidy.yml b/tasks/config/tidy.yml new file mode 100644 index 0000000..8ea18c2 --- /dev/null +++ b/tasks/config/tidy.yml @@ -0,0 +1,4 @@ +- name: Set tidy config + ansible.builtin.set_fact: + tidy: + pkgs: "{{ pkgconfig.tidy.pkgs[ansible_system] }}" diff --git a/tasks/config/zls.yml b/tasks/config/zls.yml index e58bb40..b53b8e6 100644 --- a/tasks/config/zls.yml +++ b/tasks/config/zls.yml @@ -1,5 +1,9 @@ # vim: set filetype=yaml.ansible : --- -version: 0.13.0 -install_prefix: "{{ default_install_prefix }}" -install_path: /opt/zls +- name: Set zls config + ansible.builtin.set_fact: + zls: + path: "zls-{{ pkgconfig.zls.sysmap[ansible_system] }}-{{ pkgconfig.zls.archmap[ansible_architecture] }}-{{ pkgconfig.zls.version }}" + pkg: "zls-{{ pkgconfig.zls.sysmap[ansible_system] }}-{{ pkgconfig.zls.archmap[ansible_architecture] }}-{{ pkgconfig.zls.version }}.tar.xz" + vers: "{{ pkgconfig.zls.version }}" + base_url: "{{ pkgconfig.zls.base_url }}" diff --git a/tasks/go.yml b/tasks/go.yml index 333e55f..85cea83 100644 --- a/tasks/go.yml +++ b/tasks/go.yml @@ -1,6 +1,6 @@ --- - name: Install go packages - become: "{{ archive_become }}" + become: "{{ ext_become }}" environment: GOBIN: "{{ path.bin }}" PATH: "{{ path.go }}/bin:$PATH" diff --git a/tasks/linux.yml b/tasks/linux.yml index 121cd37..fd6d5c6 100644 --- a/tasks/linux.yml +++ b/tasks/linux.yml @@ -3,13 +3,13 @@ - name: Install flatpaks on Linux Systems when: - - flatpaks|length > 0 + - pkg_flatpak|length > 0 block: - name: Add flatpak remotes when: - - flatpak_remotes|length > 0 + - flatpak_remote|length > 0 become: "{{ ext_become }}" - loop: "{{ flatpak_remotes | unique }}" + loop: "{{ flatpak_remote | unique }}" loop_control: loop_var: remote community.general.flatpak_remote: @@ -20,8 +20,10 @@ state: present - name: Install flatpaks + when: + - pkg_flatpak|length > 0 become: "{{ ext_become }}" - loop: "{{ flatpaks | unique }}" + loop: "{{ pkg_flatpak | unique }}" loop_control: loop_var: flatpak community.general.flatpak: diff --git a/tasks/macos.yml b/tasks/macos.yml index c5836ab..8cc98ac 100644 --- a/tasks/macos.yml +++ b/tasks/macos.yml @@ -1,19 +1,22 @@ # vim: set filetype=yaml.ansible : --- - name: Tap homebrew taps + when: + - brewtap|length > 0 community.general.homebrew_tap: - name: "{{ brew_taps | unique }}" + name: "{{ brewtap | unique }}" state: present - when: brew_taps|length > 0 - name: Install homebrew casks + when: pkg_cask|length > 0 community.general.homebrew_cask: - name: "{{ cask_pkgs | unique }}" + name: "{{ pkg_cask | unique }}" state: present - when: cask_pkgs|length > 0 # TODO: fix the need to have this workaround - name: Workaround to install homebrew taps - ansible.builtin.command: - cmd: "brew install {{ (tap_pkgs | unique) | join(' ') }}" + when: + - pkg_tap|length > 0 changed_when: true + ansible.builtin.command: + cmd: "brew install {{ (pkg_tap | unique) | join(' ') }}" diff --git a/tasks/main.yml b/tasks/main.yml index af0b02d..b6e2809 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -2,6 +2,12 @@ --- # create all the facts used throughout the role, but shouldn't be touched # by the user +- name: Create temporary directory for downloads + ansible.builtin.tempfile: + state: directory + prefix: ansible_role_package. + register: d_tempdir + - name: Set installation facts ansible.builtin.include_tasks: file: facts.yml diff --git a/tasks/npm.yml b/tasks/npm.yml index 1b6e8ad..f07d1ab 100644 --- a/tasks/npm.yml +++ b/tasks/npm.yml @@ -1,7 +1,7 @@ # vim: set filetype=yaml.ansible : --- - name: Install npm pkg - become: "{{ archive_become }}" + become: "{{ ext_become }}" community.general.npm: global: true name: "{{ pkg }}" diff --git a/tasks/pipx.yml b/tasks/pipx.yml index 29ef20e..8e67a18 100644 --- a/tasks/pipx.yml +++ b/tasks/pipx.yml @@ -1,7 +1,7 @@ # vim: set filetype=yaml.ansible : --- - name: Install pipx pkg - become: "{{ archive_become }}" + become: "{{ ext_become }}" community.general.pipx: executable: "{{ pipx_exec }}" name: "{{ pipx_pkg }}" diff --git a/tasks/pkgs/broot.yml b/tasks/pkgs/broot.yml index 77d5652..5bb1666 100644 --- a/tasks/pkgs/broot.yml +++ b/tasks/pkgs/broot.yml @@ -3,6 +3,8 @@ - name: Append to pkg_sys and pkg_cargo when: - ansible_system == 'Linux' + notify: + - Depend cargo ansible.builtin.set_fact: pkg_sys: "{{ pkg_sys + broot.deps }}" pkg_cargo: "{{ pkg_cargo + [broot] }}" diff --git a/tasks/pkgs/direnv.yml b/tasks/pkgs/direnv.yml new file mode 100644 index 0000000..67accf7 --- /dev/null +++ b/tasks/pkgs/direnv.yml @@ -0,0 +1,3 @@ +- name: Append to pkg_sys + ansible.builtin.set_fact: + pkg_sys: "{{ pkg_sys + ['direnv'] }}" diff --git a/tasks/pkgs/ghostty.yml b/tasks/pkgs/ghostty.yml index 3701146..dc15649 100644 --- a/tasks/pkgs/ghostty.yml +++ b/tasks/pkgs/ghostty.yml @@ -3,6 +3,7 @@ - name: Source pkg installation when: - ghostty.method == 'src' + - ansible_distribution != 'MacOSX' notify: - Depend zig block: diff --git a/tasks/pkgs/go.yml b/tasks/pkgs/go.yml index c92d2bd..7431f03 100644 --- a/tasks/pkgs/go.yml +++ b/tasks/pkgs/go.yml @@ -2,12 +2,11 @@ --- - name: Install from archive when: - - go.use_archive + - go.method == 'archive' ansible.builtin.set_fact: pkg_archive: "{{ pkg_archive + ['go'] }}" - name: Append to pkgs - when: - - not go.use_archive + - go.method != 'archive' ansible.builtin.set_fact: pkg_sys: "{{ pkg_sys + ['go'] }}" diff --git a/tasks/pkgs/libreoffice.yml b/tasks/pkgs/libreoffice.yml index ecd7405..754c7e6 100644 --- a/tasks/pkgs/libreoffice.yml +++ b/tasks/pkgs/libreoffice.yml @@ -1,20 +1,19 @@ # vim: set filetype=yaml.ansible : --- -- name: Append to flatpkgs +- name: Append to pkg_flatpak when: - libreoffice.method == 'flatpak' ansible.builtin.set_fact: - flatpkgs: "{{ flatpkgs + libreoffice.flatpak }}" + pkg_flatpak: "{{ pkg_flatpak + libreoffice.flatpak }}" - name: Append to pkg_sys when: - libreoffice.method == 'sys' - - ansible_system == 'Linux' ansible.builtin.set_fact: sys_pkg: "{{ sys_pkg + libreoffice.pkgs }}" - name: Append to caskpkgs when: - - ansible_system == 'Darwin' + - libreoffice.method == 'cask' ansible.builtin.set_fact: - pkg_cask: "{{ pkg_cask + ['libreoffice'] }}" + pkg_cask: "{{ pkg_cask + libreoffice.pkgs }}" diff --git a/tasks/pkgs/neovim.yml b/tasks/pkgs/neovim.yml index 0033bfc..77191b7 100644 --- a/tasks/pkgs/neovim.yml +++ b/tasks/pkgs/neovim.yml @@ -2,12 +2,12 @@ --- - name: Append to appimages when: - - nvim.method == 'appimage' + - neovim.method == 'appimage' ansible.builtin.set_fact: pkg_appimage: "{{ pkg_appimage + ['neovim'] }}" - name: Append neovim to pkg_sys when: - - nvim.method == 'sys' + - neovim.method == 'sys' ansible.builtin.set_fact: pkg_sys: "{{ pkg_sys + ['neovim'] }}" diff --git a/tasks/pkgs/nodejs.yml b/tasks/pkgs/nodejs.yml index c06d282..4ee1ac1 100644 --- a/tasks/pkgs/nodejs.yml +++ b/tasks/pkgs/nodejs.yml @@ -2,4 +2,4 @@ --- - name: Append to pkgs ansible.builtin.set_fact: - pkg_sys: "{{ pkg_sys + pkgconfig.nodejs.pkgs[ansible_system] }}" + pkg_sys: "{{ pkg_sys + nodejs.pkgs }}" diff --git a/tasks/pkgs/pgadmin.yml b/tasks/pkgs/pgadmin.yml index 0981b16..6d219df 100644 --- a/tasks/pkgs/pgadmin.yml +++ b/tasks/pkgs/pgadmin.yml @@ -2,14 +2,14 @@ --- - name: Append to pkg_flatpak when: - - ansible_system == 'Linux' + - pgadmin.method == 'flatpak' notify: - Depend flatpak ansible.builtin.set_fact: - pkg_flatpak: "{{ pkg_flatpak + [pkgconfig.pgadmin.flatpak] }}" + pkg_flatpak: "{{ pkg_flatpak + [pgadmin.flatpak] }}" - name: Append to pkg_cask when: - - ansible_system == 'Darwin' + - pgadmin.method == 'cask' ansible.builtin.set_fact: - pkg_cask: "{{ pkg_cask + ['pgadmin4'] }}" + pkg_cask: "{{ pkg_cask + pgadmin.pkgs }}" diff --git a/tasks/pkgs/rust.yml b/tasks/pkgs/rust.yml index a1b9592..6ee7716 100644 --- a/tasks/pkgs/rust.yml +++ b/tasks/pkgs/rust.yml @@ -2,4 +2,4 @@ --- - name: Append to pkgs ansible.builtin.set_fact: - pkg_sys: "{{ pkg_sys + pkgconfig.rust.pkgs }}" + pkg_sys: "{{ pkg_sys + rust.pkgs }}" diff --git a/tasks/pkgs/terraform.yml b/tasks/pkgs/terraform.yml index 25bf5bc..3c3e297 100644 --- a/tasks/pkgs/terraform.yml +++ b/tasks/pkgs/terraform.yml @@ -3,5 +3,15 @@ - name: Append to pkgs notify: - Depend hashicorp repo - ansible.builtin.set_fact: - pkg_taps: "{{ pkg_taps + [pkgconfig.terraform[ansible_system]] }}" + block: + - name: MacOSX specific + when: + - ansible_distribution == 'MacOSX' + ansible.builtin.set_fact: + pkg_tap: "{{ pkg_tap + terraform.pkgs }}" + + - name: Linux specific + when: + - ansible_system == 'Linux' + ansible.builtin.set_fact: + pkg_sys: "{{ pkg_sys + terraform.pkgs }}" diff --git a/tasks/pkgs/terraformls.yml b/tasks/pkgs/terraformls.yml index 6db41a0..b5e3532 100644 --- a/tasks/pkgs/terraformls.yml +++ b/tasks/pkgs/terraformls.yml @@ -8,10 +8,10 @@ when: - ansible_system == 'Darwin' ansible.builtin.set_fact: - pkg_taps: "{{ pkg_taps + [pkgconfig.terraformls[ansible_system]] }}" + pkg_tap: "{{ pkg_tap + terraformls.pkgs }}" - name: Linux specific when: - ansible_system == 'Linux' ansible.builtin.set_fact: - pkg_sys: "{{ pkg_sys + ['terraformls'] }}" + pkg_sys: "{{ pkg_sys + terraformls.pkgs }}" diff --git a/tasks/pkgs/tidy.yml b/tasks/pkgs/tidy.yml index 50d5672..4404779 100644 --- a/tasks/pkgs/tidy.yml +++ b/tasks/pkgs/tidy.yml @@ -2,4 +2,4 @@ --- - name: Append to pkg_sys ansible.builtin.set_fact: - pkg_sys: "{{ pkg_sys + pkgconfig.tidy.pkgs[ansible_system] }}" + pkg_sys: "{{ pkg_sys + tidy.pkgs }}" diff --git a/tasks/pkgs/vault.yml b/tasks/pkgs/vault.yml index 70337c5..a42c509 100644 --- a/tasks/pkgs/vault.yml +++ b/tasks/pkgs/vault.yml @@ -8,7 +8,7 @@ when: - ansible_system == 'Darwin' ansible.builtin.set_fact: - pkg_taps: "{{ pkg_taps + [pkgconfig.vault[ansible_system]] }}" + pkg_tap: "{{ pkg_tap + [pkgconfig.vault[ansible_system]] }}" - name: Linux specific when: diff --git a/tasks/pkgs/zls.yml b/tasks/pkgs/zls.yml index daae7c2..74d0e21 100644 --- a/tasks/pkgs/zls.yml +++ b/tasks/pkgs/zls.yml @@ -4,4 +4,4 @@ notify: - Depend zig ansible.builtin.set_fact: - pkg_src: "{{ pkg_src + ['zls'] }}" + pkg_archive: "{{ pkg_archive + ['zls'] }}" diff --git a/tasks/repos/hashicorp.yml b/tasks/repos/hashicorp.yml index a1af55c..e2e0167 100644 --- a/tasks/repos/hashicorp.yml +++ b/tasks/repos/hashicorp.yml @@ -34,15 +34,9 @@ when: - ansible_os_family == 'Debian' block: - - name: Create temporary directory - ansible.builtin.tempfile: - state: directory - prefix: hashicorp. - register: d_hashicorp_tmp - - name: Get hashicorp archive gpg key ansible.builtin.get_url: - dest: "{{ d_hashicorp_tmp.path }}/gpg" + dest: "{{ d_tempdir.path }}/hashicorp_gpg" url: https://apt.releases.hashicorp.com/gpg mode: '0644' @@ -55,7 +49,7 @@ - --dearmor - -o - /usr/share/keyrings/hashicorp-archive-keyring.gpg - - "{{ d_hashicorp_tmp.path }}/gpg" + - "{{ d_tempdir.path }}/hashicorp_gpg" - name: Enable hasicorp repo for debian ansible.builtin.apt_repository: @@ -66,8 +60,5 @@ - name: MacOS specific configuration when: - ansible_distribution == 'MacOSX' - block: - - name: Enable hashicorp homebrew tap - when: ansible_os_family == 'Darwin' - ansible.builtin.set_fact: - brewtaps: "{{ brewtaps + ['hashicorp/tap'] }}" + ansible.builtin.set_fact: + brewtaps: "{{ brewtaps + ['hashicorp/tap'] }}" diff --git a/tasks/src/ghostty.yml b/tasks/src/ghostty.yml index 50eeb4e..b6c4210 100644 --- a/tasks/src/ghostty.yml +++ b/tasks/src/ghostty.yml @@ -2,32 +2,16 @@ --- - name: Build ghostty from source block: - - name: Create temp path - ansible.builtin.tempfile: - state: directory - prefix: ghostty. - register: d_ghostty_tmp - - name: Clone ghostty git repository ansible.builtin.git: depth: 1 - dest: "{{ d_ghostty_tmp.path }}/ghostty" - repo: "{{ pkgconfig_ghostty.git_repo }}" - version: "{{ pkgconfig_ghostty.version }}" + dest: "{{ d_tempdir.path }}/ghostty" + repo: "{{ ghostty.repo }}" + version: "{{ ghostty.vers }}" - name: Build ghostty - ansible.builtin.command: - chdir: "{{ d_ghostty_tmp.path }}/ghostty" - cmd: "zig build -D{{ pkgconfig_ghostty.optimize }}" + become: "{{ ext_become }}" register: c_ghostty_build - - - name: Install ghostty - ansible.file.copy: - src: "{{ d_ghostty_tmp.path }}/ghostty/zig-out/bin/ghostty" - dest: "{{ pkgconfig_ghostty.install_prefix }}/bin/ghostty" - owner: "{{ pkgconfig_ghostty.owner }}" - group: "{{ pkgconfig_ghostty.group }}" - mode: "0755" - remote_src: true - become: "{{ pkgconfig_ghostty.become }}" - become_user: "{% if pkgconfig_ghostty.become %}{{ pkgconfig_ghostty.owner }}{% else %}~{% endif %}" + ansible.builtin.command: + chdir: "{{ d_tempdir.path }}/ghostty" + cmd: "zig build -p {{ path.prefix }} -D{{ pkgconfig_ghostty.optimize }}" diff --git a/tasks/src/neovim.yml b/tasks/src/neovim.yml index 3dc44e9..20ac6cc 100644 --- a/tasks/src/neovim.yml +++ b/tasks/src/neovim.yml @@ -14,12 +14,10 @@ version: "{{ pkgconfig_neovim.version }}" - name: Build and install neovim + become: "{{ ext_become }}" ansible.builtin.make: - chdir: "{{ d_nvim_tmp.path }}/neovim" + chdir: "{{ d_tempdir.path }}/neovim" params: - CMAKE_BUILD_TYPE: "{{ pkgconfig_neovim.build_type }}" - CMAKE_INSTALL_PREFIX: "{{ pkgconfig_neovim.install_prefix }}" + CMAKE_BUILD_TYPE: "{{ neovim.build_type }}" + CMAKE_INSTALL_PREFIX: "{{ path.prefix }}" target: install - become: "{{ pkgconfig_neovim.dobecome }}" - become_user: "{% if pkgconfig_neovim.dobecome %}{{ pkgconfig_neovim.owner }}{% else %}~{% endif %}" - when: not pkgconfig_neovim.use_appimage diff --git a/vars/pkgs/broot.yml b/vars/pkgs/broot.yml index 40a9f2b..b196d23 100644 --- a/vars/pkgs/broot.yml +++ b/vars/pkgs/broot.yml @@ -9,3 +9,4 @@ broot: - libxcb-xfixes0-dev RedHat: - libxcb + Darwin: [] diff --git a/vars/pkgs/fd.yml b/vars/pkgs/fd.yml index 8e5c94d..a2a2380 100644 --- a/vars/pkgs/fd.yml +++ b/vars/pkgs/fd.yml @@ -2,7 +2,5 @@ fd: pkgs: Darwin: - fd - RedHat: - - fd-find - Debian: + Linux: - fd-find diff --git a/vars/pkgs/ghostty.yml b/vars/pkgs/ghostty.yml index 0a4492f..3f11d3f 100644 --- a/vars/pkgs/ghostty.yml +++ b/vars/pkgs/ghostty.yml @@ -8,6 +8,7 @@ ghostty: RedHat: - gtk4-devel - libadwaita-devel + Darwin: [] archmap: arm64: aarch64 x86_64: x86_64 diff --git a/vars/pkgs/libreoffice.yml b/vars/pkgs/libreoffice.yml index de536f6..4f21fb5 100644 --- a/vars/pkgs/libreoffice.yml +++ b/vars/pkgs/libreoffice.yml @@ -1,9 +1,16 @@ libreoffice: - method: flatpak + methods: + default: sys + Ubuntu: flatpak + Fedora: flatpak + MacOSX: cask flatpak: name: org.libreoffice.LibreOffice remote: flathub - Debian: - - libreoffice - RedHat: - - libreoffice + pkgs: + Debian: + - libreoffice + RedHat: + - libreoffice + Darwin: + - libreoffice diff --git a/vars/pkgs/neovim.yml b/vars/pkgs/neovim.yml index 14df1dc..a20e4ec 100644 --- a/vars/pkgs/neovim.yml +++ b/vars/pkgs/neovim.yml @@ -4,8 +4,8 @@ neovim: appimage: base_url: https://github.com/neovim/neovim/releases/download link_name: nvim - method: - default: appimage + methods: + default: src Fedora: sys Ubuntu: sys MacOSX: sys diff --git a/vars/pkgs/pgadmin.yml b/vars/pkgs/pgadmin.yml index 959f4a4..5e2069e 100644 --- a/vars/pkgs/pgadmin.yml +++ b/vars/pkgs/pgadmin.yml @@ -2,3 +2,11 @@ pgadmin: flatpak: name: org.pgadmin.pgadmin4 remote: flathub + methods: + default: flatpak + MacOSX: cask + Fedora: flatpak + Ubuntu: flatpak + pkgs: + Darwin: + - pgadmin4 diff --git a/vars/pkgs/terraform.yml b/vars/pkgs/terraform.yml index 29c2578..409abf8 100644 --- a/vars/pkgs/terraform.yml +++ b/vars/pkgs/terraform.yml @@ -1,3 +1,6 @@ terraform: - Linux: terraform - Darwin: hashicorp/tap/terraform + pkgs: + Linux: + - terraform + Darwin: + - hashicorp/tap/terraform diff --git a/vars/pkgs/terraformls.yml b/vars/pkgs/terraformls.yml index fbc8ed9..57999c4 100644 --- a/vars/pkgs/terraformls.yml +++ b/vars/pkgs/terraformls.yml @@ -1,3 +1,6 @@ terraformls: - Linux: terraform-ls - Darwin: hashicorp/tap/terraform-ls + pkgs: + Linux: + - terraform-ls + Darwin: + - hashicorp/tap/terraform-ls diff --git a/vars/pkgs/zls.yml b/vars/pkgs/zls.yml index 4734984..7fe592e 100644 --- a/vars/pkgs/zls.yml +++ b/vars/pkgs/zls.yml @@ -1,4 +1,5 @@ zls: + version: 0.13.0 base_url: https://builds.zigtools.org sysmap: Darwin: macos From a73ed77dacb8867a751809b2f6fb59fd2eba8791 Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Sat, 22 Feb 2025 16:09:47 -0700 Subject: [PATCH 28/38] fixing issues --- tasks/archive/go.yml | 7 +++---- tasks/archive/zig.yml | 28 ++++++++++++---------------- tasks/archive/zls.yml | 23 ++++++++++++++--------- tasks/cargo.yml | 6 +++--- tasks/config/air.yml | 8 -------- tasks/config/go.yml | 2 +- tasks/config/zig.yml | 7 ++++--- tasks/facts.yml | 2 +- tasks/go.yml | 10 +++++++--- tasks/linux.yml | 10 ++++++++++ tasks/main.yml | 9 --------- tasks/pkgs/air.yml | 2 +- tasks/pkgs/zig.yml | 2 +- tasks/repos/hashicorp.yml | 2 +- vars/pkgs/air.yml | 4 ---- vars/pkgs/go.yml | 8 ++++---- vars/pkgs/zig.yml | 1 + 17 files changed, 63 insertions(+), 68 deletions(-) delete mode 100644 tasks/config/air.yml delete mode 100644 vars/pkgs/air.yml diff --git a/tasks/archive/go.yml b/tasks/archive/go.yml index 94a1fbd..f7b53dc 100644 --- a/tasks/archive/go.yml +++ b/tasks/archive/go.yml @@ -13,11 +13,10 @@ - name: Install/update go when: - - do_go_install or + - (do_go_install is defined and do_go_install) or not stat_path_go.stat.exists block: - name: Download go archive - become: "{{ sys_pkg_become }}" register: get_url_go ansible.builtin.get_url: dest: "{{ d_tempdir.path }}/{{ go.archive }}" @@ -31,7 +30,7 @@ when: - ansible_system == 'Linux' ansible.builtin.unarchive: - dest: "{{ path.prefix }}" + dest: "{{ go.prefix }}" src: "{{ d_tempdir.path }}/{{ go.archive }}" remote_src: true @@ -40,4 +39,4 @@ when: - ansible_distribution == 'MacOSX' ansible.builtin.command: - cmd: "installer -pkg {{ d_tempdir.path }}/{{ go.archive }} -target /" + cmd: "installer -pkg {{ d_tempdir.path }}/{{ go.archive }} -target {{ go.prefix }}" diff --git a/tasks/archive/zig.yml b/tasks/archive/zig.yml index a15bcc0..0a6ac82 100644 --- a/tasks/archive/zig.yml +++ b/tasks/archive/zig.yml @@ -1,42 +1,38 @@ # vim: set filetype=yaml.ansible : --- -- name: Download zig archive - ansible.builtin.set_fact: - zig_path: "zig-{{ pkgconfig_zig.sysmap[ansible_system] }}-{{ pkgconfig_zig.archmap[ansible_architecture] }}-{{ pkgconfig_zig.version }}" - zig_pkg: "zig-{{ pkgconfig_zig.sysmap[ansible_system] }}-{{ pkgconfig_zig.archmap[ansible_architecture] }}-{{ pkgconfig_zig.version }}.tar.xz" - - name: Check if zig exists ansible.builtin.stat: - path: "{{ pkgconfig_zig.install_path }}/{{ zig_path }}/zig" + path: "{{ path.archive }}/zig/{{ zig.path }}/zig" register: r_zig_stat - name: Update/install zig when: - not r_zig_stat.stat.exists block: - - name: Create temp path - ansible.builtin.tempfile: - state: directory - prefix: zig_dl. - register: d_zig_dl_tmp - - name: Download zig archive ansible.builtin.get_url: - dest: "{{ d_zig_dl_tmp.path }}/{{ zig_pkg }}" - url: "{{ pkgconfig_zig.base_url }}/{{ pkgconfig_zig.version }}/{{ zig_pkg }}" + dest: "{{ d_tempdir.path }}/{{ zig.pkg }}" + url: "{{ zig.base_url }}/{{ zig.vers }}/{{ zig.pkg }}" decompress: false mode: '0644' + - name: Create zig archive dir + become: "{{ ext_become }}" + ansible.builtin.file: + state: directory + mode: '0755' + path: "{{ path.archive }}/zig" + - name: Extract zig package become: "{{ ext_become }}" ansible.builtin.unarchive: dest: "{{ path.archive }}/zig" - src: "{{ d_zig_dl_tmp.path }}/{{ zig_pkg }}" + src: "{{ d_tempdir.path }}/{{ zig.pkg }}" remote_src: true - name: Link zig binary become: "{{ ext_become }}" ansible.builtin.file: state: link - src: "{{ path.archive }}/{{ zig_path }}/zig" + src: "{{ path.archive }}/zig/{{ zig.path }}/zig" path: "{{ path.bin }}/zig" diff --git a/tasks/archive/zls.yml b/tasks/archive/zls.yml index 355d5f7..17e0189 100644 --- a/tasks/archive/zls.yml +++ b/tasks/archive/zls.yml @@ -1,32 +1,37 @@ # vim: set filetype=yaml.ansible : --- -- name: Download zls archive - ansible.builtin.set_fact: - - name: Check if zls exists ansible.builtin.stat: - path: "{{ path.archive }}/{{ zls_path }}/zls" + path: "{{ path.archive }}/zls/{{ zls.path }}/zls" register: r_zls_stat - name: Update/install zls block: - name: Download zls archive + register: get_url_zls ansible.builtin.get_url: - dest: "{{ d_tempfile.path }}/{{ zls_pkg }}" - url: "{{ zls.base_url }}/{{ zls_pkg }}" + dest: "{{ d_tempdir.path }}/{{ zls.pkg }}" + url: "{{ zls.base_url }}/{{ zls.pkg }}" decompress: false mode: '0644' + - name: Create zls archive dir + become: "{{ ext_become }}" + ansible.builtin.file: + state: directory + mode: '0755' + path: "{{ path.archive }}/zls/{{ zls.path }}" + - name: Extract zls package become: "{{ ext_become }}" ansible.builtin.unarchive: - dest: "{{ path.archive }}" - src: "{{ d_tempfile.path }}/{{ zls_pkg }}" + dest: "{{ path.archive }}/zls/{{ zls.path }}" + src: "{{ d_tempdir.path }}/{{ zls.pkg }}" remote_src: true - name: Link zls binary become: "{{ ext_become }}" ansible.builtin.file: state: link - src: "{{ path.archive }}/{{ zls_path }}/zls" + src: "{{ path.archive }}/zls/{{ zls.path }}/zls" path: "{{ path.bin }}/zls" diff --git a/tasks/cargo.yml b/tasks/cargo.yml index 7eb3a5c..dd788b8 100644 --- a/tasks/cargo.yml +++ b/tasks/cargo.yml @@ -3,7 +3,7 @@ - name: Install cargo pkg become: "{{ ext_become }}" community.general.cargo: - name: "{{ pkg.name }}" - version: "{{ pkg.vers }}" - path: "{{ paths.cargo }}" + name: "{{ pkg.name | default(pkg) }}" + version: "{{ pkg.vers | default(omit) }}" + path: "{{ paths.cargo | default(omit) }}" locked: "{{ pkg.locked | default(true) }}" diff --git a/tasks/config/air.yml b/tasks/config/air.yml deleted file mode 100644 index e5ee19e..0000000 --- a/tasks/config/air.yml +++ /dev/null @@ -1,8 +0,0 @@ -# vim: set filetype=yaml.ansible : ---- -- name: Set configuration for air - ansible.builtin.set_fact: - air: - ver: "{{ pkgconfig.air.version }}" - pkg: "{{ pkgconfig.air.mod_path }}@{{ pkgconfig.air.version }}" - bin: "{{ pkgconfig.air.bin }}" diff --git a/tasks/config/go.yml b/tasks/config/go.yml index cce458e..6be7b4e 100644 --- a/tasks/config/go.yml +++ b/tasks/config/go.yml @@ -16,7 +16,7 @@ arch: "{{ go.arch }}" archive: "go{{ go.vers }}.{{ go.sys }}-{{ go.arch }}.{{ pkgconfig.go.extmap[ansible_system] }}" ext: "{{ go.ext }}" - inst_path: "{{ path.prefix }}" + prefix: "{% if ansible_distribution == 'MacOSX' %}/{% else %}{{ path.prefix }}{% endif %}" sum: "{{ pkgconfig.go.sums[go.vers][ansible_system][go.arch] }}" sys: "{{ go.sys }}" base_url: "{{ pkgconfig.go.base_url }}" diff --git a/tasks/config/zig.yml b/tasks/config/zig.yml index ab09d5a..dcb875b 100644 --- a/tasks/config/zig.yml +++ b/tasks/config/zig.yml @@ -3,6 +3,7 @@ - name: Set zig configuration ansible.builtin.set_fact: zig: - version: 0.13.0 - install_prefix: "{{ path.prefix }}" - install_path: "{{ path.archive }}/zig" + vers: "{{ pkgconfig.zig.version }}" + path: "zig-{{ pkgconfig.zig.sysmap[ansible_system] }}-{{ pkgconfig.zig.archmap[ansible_architecture] }}-{{ pkgconfig.zig.version }}" + pkg: "zig-{{ pkgconfig.zig.sysmap[ansible_system] }}-{{ pkgconfig.zig.archmap[ansible_architecture] }}-{{ pkgconfig.zig.version }}.tar.xz" + base_url: "{{ pkgconfig.zig.base_url }}" diff --git a/tasks/facts.yml b/tasks/facts.yml index 5321479..f6a6d18 100644 --- a/tasks/facts.yml +++ b/tasks/facts.yml @@ -45,7 +45,7 @@ archive: "{{ path.archive | default(path.prefix ~ defaults.path.suffix.archive) }}" bin: "{{ path.bin | default(path.prefix ~ defaults.path.suffix.bin) }}" cargo: "{{ path.cargo | default(path.prefix ~ defaults.path.suffix.cargo) }}" - go: "{{ path.go | default(path.prefix ~ defaults.path.suffix.go) }}" + go: "{% if ansible_distribution == 'MacOSX' %}/usr/local/go{% else %}{{ path.go | default(path.prefix ~ defaults.path.suffix.go) }}{% endif %}" pipx: "{{ path.pipx | default(path.prefix ~ defaults.path.suffix.pipx) }}" - name: Set OS independant facts diff --git a/tasks/go.yml b/tasks/go.yml index 85cea83..ec173c2 100644 --- a/tasks/go.yml +++ b/tasks/go.yml @@ -1,12 +1,16 @@ --- +- debug: + var: path.go +- debug: + var: path.bin + - name: Install go packages become: "{{ ext_become }}" environment: - GOBIN: "{{ path.bin }}" + GOBIN: "{% if ansible_distribution == 'MacOSX' %}/usr/local/bin{% else %}{{ path.bin }}{% endif %}" PATH: "{{ path.go }}/bin:$PATH" ansible.builtin.command: - creates: "{{ path.bin }}/{{ pkg.bin }}" cmd: - go - install - - "{{ pkg.pkg }}" + - "{{ pkg }}" diff --git a/tasks/linux.yml b/tasks/linux.yml index fd6d5c6..cec1663 100644 --- a/tasks/linux.yml +++ b/tasks/linux.yml @@ -31,3 +31,13 @@ name: "{{ flatpak.name }}" remote: "{{ flatpak.remote | default('flathub') }}" state: present + +- name: Install pkg_appimage + when: + - pkg_appimage|length > 0 + loop: "{{ pkg_appimage }}" + loop_control: + loop_var: pkg + ansible.builtin.include_tasks: + file: appimage.yml + diff --git a/tasks/main.yml b/tasks/main.yml index b6e2809..1285033 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -72,15 +72,6 @@ ansible.builtin.include_tasks: file: "archive/{{ pkg }}.yml" -- name: Install pkg_appimage - when: - - pkg_appimage|length > 0 - loop: "{{ pkg_appimage }}" - loop_control: - loop_var: pkg - ansible.builtin.include_tasks: - file: appimage.yml - - name: Build and install source packages when: - pkg_src|length > 0 diff --git a/tasks/pkgs/air.yml b/tasks/pkgs/air.yml index 556db60..e9c0b87 100644 --- a/tasks/pkgs/air.yml +++ b/tasks/pkgs/air.yml @@ -4,4 +4,4 @@ notify: - Depend go ansible.builtin.set_fact: - pkg_go: "{{ pkg_go + [air] }}" + pkg_go: "{{ pkg_go + ['github.com/air-verse/air@latest'] }}" diff --git a/tasks/pkgs/zig.yml b/tasks/pkgs/zig.yml index dfdd026..4804ef5 100644 --- a/tasks/pkgs/zig.yml +++ b/tasks/pkgs/zig.yml @@ -2,4 +2,4 @@ --- - name: Append to pkgs ansible.builtin.set_fact: - pkg_src: "{{ pkg_src + ['zig'] }}" + pkg_archive: "{{ pkg_archive + ['zig'] }}" diff --git a/tasks/repos/hashicorp.yml b/tasks/repos/hashicorp.yml index e2e0167..a7e2bb1 100644 --- a/tasks/repos/hashicorp.yml +++ b/tasks/repos/hashicorp.yml @@ -61,4 +61,4 @@ when: - ansible_distribution == 'MacOSX' ansible.builtin.set_fact: - brewtaps: "{{ brewtaps + ['hashicorp/tap'] }}" + brewtap: "{{ brewtap + ['hashicorp/tap'] }}" diff --git a/vars/pkgs/air.yml b/vars/pkgs/air.yml deleted file mode 100644 index 9476287..0000000 --- a/vars/pkgs/air.yml +++ /dev/null @@ -1,4 +0,0 @@ -air: - version: latest - mod_path: github.com/air-verse/air - bin: air diff --git a/vars/pkgs/go.yml b/vars/pkgs/go.yml index f72ca9c..9a523ca 100644 --- a/vars/pkgs/go.yml +++ b/vars/pkgs/go.yml @@ -11,11 +11,11 @@ go: sums: 1.24.0: Darwin: - amd64: dee0ea64411a00b47ded586d5a8e30cfe3acf51564aa1bb24e039a6dca807a29 - arm64: b19eb6b7ae87f8371c3e7a84d129db67779a2883d2fffa6bb90412b0167df133 + amd64: sha256:dee0ea64411a00b47ded586d5a8e30cfe3acf51564aa1bb24e039a6dca807a29 + arm64: sha256:b19eb6b7ae87f8371c3e7a84d129db67779a2883d2fffa6bb90412b0167df133 Linux: - amd64: b19eb6b7ae87f8371c3e7a84d129db67779a2883d2fffa6bb90412b0167df133 - arm64: c3fa6d16ffa261091a5617145553c71d21435ce547e44cc6dfb7470865527cc7 + amd64: sha256:b19eb6b7ae87f8371c3e7a84d129db67779a2883d2fffa6bb90412b0167df133 + arm64: sha256:c3fa6d16ffa261091a5617145553c71d21435ce547e44cc6dfb7470865527cc7 1.23.6: Darwin: amd64: sha256:7fa387c228b4dd69b518a5d9425638fa5c0d86ec8943de373e3802aff2e5b12a diff --git a/vars/pkgs/zig.yml b/vars/pkgs/zig.yml index a74aba4..26b27e1 100644 --- a/vars/pkgs/zig.yml +++ b/vars/pkgs/zig.yml @@ -1,4 +1,5 @@ zig: + version: 0.13.0 base_url: https://ziglang.org/download sysmap: Darwin: macos From b25f6dc207324fc00ab490bc6a7eb4c005b8f632 Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Sat, 22 Feb 2025 16:24:44 -0700 Subject: [PATCH 29/38] fix go and pipx installs --- tasks/go.yml | 14 +++----------- tasks/pipx.yml | 5 ++++- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/tasks/go.yml b/tasks/go.yml index ec173c2..3c525ef 100644 --- a/tasks/go.yml +++ b/tasks/go.yml @@ -1,16 +1,8 @@ --- -- debug: - var: path.go -- debug: - var: path.bin - -- name: Install go packages +- name: Install go package {{ pkg }} become: "{{ ext_become }}" environment: - GOBIN: "{% if ansible_distribution == 'MacOSX' %}/usr/local/bin{% else %}{{ path.bin }}{% endif %}" + GOBIN: "{{ path.bin }}" PATH: "{{ path.go }}/bin:$PATH" ansible.builtin.command: - cmd: - - go - - install - - "{{ pkg }}" + cmd: go install {{ pkg }} diff --git a/tasks/pipx.yml b/tasks/pipx.yml index 8e67a18..38cc9e3 100644 --- a/tasks/pipx.yml +++ b/tasks/pipx.yml @@ -2,7 +2,10 @@ --- - name: Install pipx pkg become: "{{ ext_become }}" + environment: + PIPX_HOME: "{{ path.pipx }}" + PIPX_BIN_DIR: "{{ path.bin }}" community.general.pipx: executable: "{{ pipx_exec }}" - name: "{{ pipx_pkg }}" + name: "{{ pkg }}" state: latest From b83a79a13d9298ae178024be754ca462c0480566 Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Sat, 22 Feb 2025 16:26:41 -0700 Subject: [PATCH 30/38] add tags to each package install --- tasks/appimage.yml | 2 +- tasks/cargo.yml | 2 +- tasks/linux.yml | 1 - tasks/npm.yml | 2 +- tasks/pipx.yml | 2 +- tasks/system.yml | 0 6 files changed, 4 insertions(+), 5 deletions(-) delete mode 100644 tasks/system.yml diff --git a/tasks/appimage.yml b/tasks/appimage.yml index 57965bf..9a81d8d 100644 --- a/tasks/appimage.yml +++ b/tasks/appimage.yml @@ -1,6 +1,6 @@ # vim: set filetype=yaml.ansible : --- -- name: Install appimage +- name: Install appimage {{ pkg }} become: "{{ ext_become }}" block: - name: Ensure appimage path exists diff --git a/tasks/cargo.yml b/tasks/cargo.yml index dd788b8..508bf72 100644 --- a/tasks/cargo.yml +++ b/tasks/cargo.yml @@ -1,6 +1,6 @@ # vim: set filetype=yaml.ansible --- -- name: Install cargo pkg +- name: Install cargo {{ pkg }} become: "{{ ext_become }}" community.general.cargo: name: "{{ pkg.name | default(pkg) }}" diff --git a/tasks/linux.yml b/tasks/linux.yml index cec1663..e4cf042 100644 --- a/tasks/linux.yml +++ b/tasks/linux.yml @@ -40,4 +40,3 @@ loop_var: pkg ansible.builtin.include_tasks: file: appimage.yml - diff --git a/tasks/npm.yml b/tasks/npm.yml index f07d1ab..e0c3a0a 100644 --- a/tasks/npm.yml +++ b/tasks/npm.yml @@ -1,6 +1,6 @@ # vim: set filetype=yaml.ansible : --- -- name: Install npm pkg +- name: Install npm {{ pkg }} become: "{{ ext_become }}" community.general.npm: global: true diff --git a/tasks/pipx.yml b/tasks/pipx.yml index 38cc9e3..0f82031 100644 --- a/tasks/pipx.yml +++ b/tasks/pipx.yml @@ -1,6 +1,6 @@ # vim: set filetype=yaml.ansible : --- -- name: Install pipx pkg +- name: Install pipx {{ pkg }} become: "{{ ext_become }}" environment: PIPX_HOME: "{{ path.pipx }}" diff --git a/tasks/system.yml b/tasks/system.yml deleted file mode 100644 index e69de29..0000000 From 2472f527d19346f3f99036a2ffade0bf63b2653b Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Sun, 23 Feb 2025 01:32:45 -0700 Subject: [PATCH 31/38] fix remaining packages - testing container is starting to work on macos - still need to do testing for linux machines --- tasks/config/ghostty.yml | 7 +- tasks/config/nomad.yml | 4 + tasks/config/packer.yml | 4 + tasks/config/tailscale.yml | 5 + tasks/config/vault.yml | 4 + tasks/pkgs/air.yml | 1 + tasks/pkgs/alacritty.yml | 1 + tasks/pkgs/ansible-language-server.yml | 1 + tasks/pkgs/bashls.yml | 1 + tasks/pkgs/bitwarden.yml | 1 + tasks/pkgs/broot.yml | 1 + tasks/pkgs/buf.yml | 1 + tasks/pkgs/bufls.yml | 1 + tasks/pkgs/carapace.yml | 2 +- tasks/pkgs/cheat.yml | 1 + tasks/pkgs/checkmake.yml | 1 + tasks/pkgs/choose.yml | 1 + tasks/pkgs/cmakelang.yml | 1 + tasks/pkgs/commitlint-cli.yml | 1 + tasks/pkgs/commitlint-config-conventional.yml | 1 + tasks/pkgs/consul.yml | 2 + tasks/pkgs/cssls.yml | 1 + tasks/pkgs/curlie.yml | 1 + tasks/pkgs/dbeaver.yml | 1 + tasks/pkgs/dockerls.yml | 1 + tasks/pkgs/dotenv-linter.yml | 1 + tasks/pkgs/duf.yml | 1 + tasks/pkgs/dust.yml | 1 + tasks/pkgs/eslint.yml | 1 + tasks/pkgs/eza.yml | 1 + tasks/pkgs/ghostty.yml | 6 +- tasks/pkgs/glow.yml | 1 + tasks/pkgs/godot.yml | 1 + tasks/pkgs/gopls.yml | 1 + tasks/pkgs/gping.yml | 1 + tasks/pkgs/heroic.yml | 1 + tasks/pkgs/htmlls.yml | 1 + tasks/pkgs/httpie.yml | 1 + tasks/pkgs/intelephense.yml | 1 + tasks/pkgs/jinja-lsp.yml | 1 + tasks/pkgs/jsonls.yml | 1 + tasks/pkgs/lazygit.yml | 1 + tasks/pkgs/libreoffice.yml | 2 +- tasks/pkgs/markdownlint-cli.yml | 1 + tasks/pkgs/neovide.yml | 1 + tasks/pkgs/nextcloud.yml | 1 + tasks/pkgs/nginxls.yml | 1 + tasks/pkgs/nomad.yml | 16 ++- tasks/pkgs/packer.yml | 5 +- tasks/pkgs/pgadmin.yml | 1 + tasks/pkgs/pyright.yml | 1 + tasks/pkgs/quobix-vacuum.yml | 1 + tasks/pkgs/revive.yml | 1 + tasks/pkgs/sd.yml | 1 + tasks/pkgs/sqlfluff.yml | 1 + tasks/pkgs/sqlls.yml | 1 + tasks/pkgs/starship.yml | 1 + tasks/pkgs/tailscale.yml | 10 +- tasks/pkgs/tailwindcss-languageserver.yml | 1 + tasks/pkgs/templ.yml | 1 + tasks/pkgs/terraform.yml | 8 +- tasks/pkgs/terraformls.yml | 8 +- tasks/pkgs/vault.yml | 12 +- tasks/pkgs/yamlls.yml | 1 + tasks/pkgs/zls.yml | 1 + tests/Containerfile | 2 +- tests/cleanup.sh | 10 ++ tests/setup.sh | 23 ++++ tests/test.sh | 4 + tests/test.yml | 10 -- tests/test_not_local.yml | 112 ++++++++++++++++++ vars/pkgs/ghostty.yml | 8 +- vars/pkgs/go.yml | 2 +- vars/pkgs/nomad.yml | 7 +- vars/pkgs/packer.yml | 7 +- vars/pkgs/pgadmin.yml | 1 + vars/pkgs/vault.yml | 7 +- 77 files changed, 294 insertions(+), 44 deletions(-) create mode 100644 tasks/config/nomad.yml create mode 100644 tasks/config/packer.yml create mode 100644 tasks/config/tailscale.yml create mode 100644 tasks/config/vault.yml create mode 100755 tests/cleanup.sh create mode 100755 tests/setup.sh create mode 100755 tests/test.sh delete mode 100644 tests/test.yml create mode 100644 tests/test_not_local.yml diff --git a/tasks/config/ghostty.yml b/tasks/config/ghostty.yml index efd0350..6f4c4e1 100644 --- a/tasks/config/ghostty.yml +++ b/tasks/config/ghostty.yml @@ -3,22 +3,23 @@ - name: Set ghostty install method ansible.builtin.set_fact: ghostty: - method: "{{ pkgconfig.ghostty.method[ansible_distribution] | default(pkgconfig.ghostty.method.default) }}" + method: "{{ pkgconfig.ghostty.methods[ansible_distribution] | default(pkgconfig.ghostty.methods.default) }}" - name: Set ghostty config ansible.builtin.set_fact: ghostty: + method: "{{ ghostty.method }}" arch: "{{ pkgconfig.ghostty.archmap[ansible_architecture] }}" deps: "{{ pkgconfig.ghostty.build_deps[ansible_os_family] }}" vers: "{{ pkgconfig.ghostty.version }}" - pkg: "{{ pkgconfig.ghosty[ghostty.method] }}" + pkg: "{{ pkgconfig.ghostty[ghostty.method] }}" - name: Set ghostty config for appimage install when: - ghostty.method == 'appimage' ansible.builtin.set_fact: ghostty: - method: appimage + method: "{{ ghostty.method }}" file: "Ghostty-{{ ghostty.vers }}-{{ ghostty.arch }}.AppImage" link_name: "{{ pkgconfig.ghostty.appimage.link_name }}" url: "{{ pkgconfig.ghostty.appimage.base_url }}/v{{ ghostty.vers }}/Ghostty-{{ ghostty.vers }}-{{ ghostty.arch }}.AppImage" diff --git a/tasks/config/nomad.yml b/tasks/config/nomad.yml new file mode 100644 index 0000000..00f347d --- /dev/null +++ b/tasks/config/nomad.yml @@ -0,0 +1,4 @@ +- name: Set nomad config + ansible.builtin.set_fact: + nomad: + pkgs: "{{ pkgconfig.nomad.pkgs[ansible_system] }}" diff --git a/tasks/config/packer.yml b/tasks/config/packer.yml new file mode 100644 index 0000000..dba9f71 --- /dev/null +++ b/tasks/config/packer.yml @@ -0,0 +1,4 @@ +- name: Set packer config + ansible.builtin.set_fact: + packer: + pkgs: "{{ pkgconfig.packer.pkgs[ansible_system] }}" diff --git a/tasks/config/tailscale.yml b/tasks/config/tailscale.yml new file mode 100644 index 0000000..e8129ed --- /dev/null +++ b/tasks/config/tailscale.yml @@ -0,0 +1,5 @@ +- name: Set tailscale config + ansible.builtin.set_fact: + tailscale: + url_base: "{{ pkgconfig.tailscale.url_base }}" + release: "{{ pkgconfig.tailscale.release[ansible_distribution_release] | default({}) }}" diff --git a/tasks/config/vault.yml b/tasks/config/vault.yml new file mode 100644 index 0000000..e986501 --- /dev/null +++ b/tasks/config/vault.yml @@ -0,0 +1,4 @@ +- name: Set vault config + ansible.builtin.set_fact: + vault: + pkgs: "{{ pkgconfig.vault.pkgs[ansible_system] }}" diff --git a/tasks/pkgs/air.yml b/tasks/pkgs/air.yml index e9c0b87..9194eb7 100644 --- a/tasks/pkgs/air.yml +++ b/tasks/pkgs/air.yml @@ -3,5 +3,6 @@ - name: Add to pkg_go notify: - Depend go + changed_when: true ansible.builtin.set_fact: pkg_go: "{{ pkg_go + ['github.com/air-verse/air@latest'] }}" diff --git a/tasks/pkgs/alacritty.yml b/tasks/pkgs/alacritty.yml index cece2d4..dfce7fb 100644 --- a/tasks/pkgs/alacritty.yml +++ b/tasks/pkgs/alacritty.yml @@ -7,6 +7,7 @@ - name: Append to pkgs notify: - Depend cargo + changed_when: true ansible.builtin.set_fact: pkg_sys: "{{ pkg_sys + alacritty.deps }}" pkg_cargo: "{{ pkg_cargo + [alacritty] }}" diff --git a/tasks/pkgs/ansible-language-server.yml b/tasks/pkgs/ansible-language-server.yml index 31eaa7f..fd1724e 100644 --- a/tasks/pkgs/ansible-language-server.yml +++ b/tasks/pkgs/ansible-language-server.yml @@ -3,5 +3,6 @@ - name: Add to pkg_npm notify: - Depend node + changed_when: true ansible.builtin.set_fact: pkg_npm: "{{ pkg_npm + ['@ansible/ansible-language-server'] }}" diff --git a/tasks/pkgs/bashls.yml b/tasks/pkgs/bashls.yml index bc6d704..a583217 100644 --- a/tasks/pkgs/bashls.yml +++ b/tasks/pkgs/bashls.yml @@ -3,5 +3,6 @@ - name: Add to pkg_npm notify: - Depend node + changed_when: true ansible.builtin.set_fact: pkg_npm: "{{ pkg_npm + ['bash-language-server'] }}" diff --git a/tasks/pkgs/bitwarden.yml b/tasks/pkgs/bitwarden.yml index 8748d1b..c16482e 100644 --- a/tasks/pkgs/bitwarden.yml +++ b/tasks/pkgs/bitwarden.yml @@ -5,6 +5,7 @@ - bitwarden.method == 'flatpak' notify: - Depend flatpak + changed_when: true ansible.builtin.set_fact: pkg_flatpak: "{{ pkg_flatpak + [bitwarden.pkg] }}" diff --git a/tasks/pkgs/broot.yml b/tasks/pkgs/broot.yml index 5bb1666..030a254 100644 --- a/tasks/pkgs/broot.yml +++ b/tasks/pkgs/broot.yml @@ -5,6 +5,7 @@ - ansible_system == 'Linux' notify: - Depend cargo + changed_when: true ansible.builtin.set_fact: pkg_sys: "{{ pkg_sys + broot.deps }}" pkg_cargo: "{{ pkg_cargo + [broot] }}" diff --git a/tasks/pkgs/buf.yml b/tasks/pkgs/buf.yml index a71f972..523da55 100644 --- a/tasks/pkgs/buf.yml +++ b/tasks/pkgs/buf.yml @@ -3,5 +3,6 @@ - name: Add to pkg_go notify: - Depend go + changed_when: true ansible.builtin.set_fact: pkg_go: "{{ pkg_go + ['github.com/bufbuild/buf/cmd/buf@latest'] }}" diff --git a/tasks/pkgs/bufls.yml b/tasks/pkgs/bufls.yml index 071ae3b..5c3ad91 100644 --- a/tasks/pkgs/bufls.yml +++ b/tasks/pkgs/bufls.yml @@ -3,5 +3,6 @@ - name: Add to pkg_go notify: - Depend go + changed_when: true ansible.builtin.set_fact: pkg_go: "{{ pkg_go + ['github.com/bufbuild/buf-language-server/cmd/bufls@latest'] }}" diff --git a/tasks/pkgs/carapace.yml b/tasks/pkgs/carapace.yml index e951935..2d4d8a3 100644 --- a/tasks/pkgs/carapace.yml +++ b/tasks/pkgs/carapace.yml @@ -7,7 +7,7 @@ ansible.builtin.yum_repository: name: "{{ carapace.repo.name }}" description: "{{ carapace.repo.description }}" - baseurl: "{{ charapace.repo.baseurl }}" + baseurl: "{{ carapace.repo.baseurl }}" enabled: true gpgcheck: false state: present diff --git a/tasks/pkgs/cheat.yml b/tasks/pkgs/cheat.yml index 6d40a7d..7cfaaef 100644 --- a/tasks/pkgs/cheat.yml +++ b/tasks/pkgs/cheat.yml @@ -3,5 +3,6 @@ - name: Append to pkg_go notify: - Depend go + changed_when: true ansible.builtin.set_fact: pkg_go: "{{ pkg_go + ['github.com/cheat/cheat/cmd/cheat@latest'] }}" diff --git a/tasks/pkgs/checkmake.yml b/tasks/pkgs/checkmake.yml index afc1233..3d52128 100644 --- a/tasks/pkgs/checkmake.yml +++ b/tasks/pkgs/checkmake.yml @@ -3,5 +3,6 @@ - name: Add to pkg_go notify: - Depend go + changed_when: true ansible.builtin.set_fact: pkg_go: "{{ pkg_go + ['github.com/mrtazz/checkmake/cmd/checkmake@latest'] }}" diff --git a/tasks/pkgs/choose.yml b/tasks/pkgs/choose.yml index 267cbaa..55a9258 100644 --- a/tasks/pkgs/choose.yml +++ b/tasks/pkgs/choose.yml @@ -5,6 +5,7 @@ - ansible_system == 'Linux' notify: - Depend cargo + changed_when: true ansible.builtin.set_fact: pkg_cargo: "{{ pkg_cargo + [choose] }}" diff --git a/tasks/pkgs/cmakelang.yml b/tasks/pkgs/cmakelang.yml index eb13807..35696c2 100644 --- a/tasks/pkgs/cmakelang.yml +++ b/tasks/pkgs/cmakelang.yml @@ -3,5 +3,6 @@ - name: Add to pkg_pipx notify: - Depend pipx + changed_when: true ansible.builtin.set_fact: pkg_pipx: "{{ pkg_pipx + ['cmakelang'] }}" diff --git a/tasks/pkgs/commitlint-cli.yml b/tasks/pkgs/commitlint-cli.yml index 0431296..bd00686 100644 --- a/tasks/pkgs/commitlint-cli.yml +++ b/tasks/pkgs/commitlint-cli.yml @@ -3,5 +3,6 @@ - name: Add to pkg_npm notify: - Depend node + changed_when: true ansible.builtin.set_fact: pkg_npm: "{{ pkg_npm + ['@commitlint/cli'] }}" diff --git a/tasks/pkgs/commitlint-config-conventional.yml b/tasks/pkgs/commitlint-config-conventional.yml index 0e1f073..4b9a590 100644 --- a/tasks/pkgs/commitlint-config-conventional.yml +++ b/tasks/pkgs/commitlint-config-conventional.yml @@ -3,5 +3,6 @@ - name: Add to pkg_npm notify: - Depend node + changed_when: true ansible.builtin.set_fact: pkg_npm: "{{ pkg_npm + ['@commitlint/config-conventional'] }}" diff --git a/tasks/pkgs/consul.yml b/tasks/pkgs/consul.yml index 9560e95..6cfeb6f 100644 --- a/tasks/pkgs/consul.yml +++ b/tasks/pkgs/consul.yml @@ -5,6 +5,7 @@ - ansible_system == 'Linux' notify: - Depend hashicorp repo + changed_when: true ansible.builtin.set_fact: pkg_sys: "{{ pkg_sys + consul.pkgs }}" @@ -13,5 +14,6 @@ - ansible_system == 'Darwin' notify: - Depend hashicorp repo + changed_when: true ansible.builtin.set_fact: pkg_tap: "{{ pkg_tap + consul.pkgs }}" diff --git a/tasks/pkgs/cssls.yml b/tasks/pkgs/cssls.yml index d8ae9f6..b529871 100644 --- a/tasks/pkgs/cssls.yml +++ b/tasks/pkgs/cssls.yml @@ -3,5 +3,6 @@ - name: Add to pkg_npm notify: - Depend node + changed_when: true ansible.builtin.set_fact: pkg_npm: "{{ pkg_npm + ['vscode-langservers-extracted'] }}" diff --git a/tasks/pkgs/curlie.yml b/tasks/pkgs/curlie.yml index 2a0eeab..939d105 100644 --- a/tasks/pkgs/curlie.yml +++ b/tasks/pkgs/curlie.yml @@ -3,5 +3,6 @@ - name: Append to pkg_go notify: - Depend go + changed_when: true ansible.builtin.set_fact: pkg_go: "{{ pkg_go + ['github.com/rs/curlie@latest'] }}" diff --git a/tasks/pkgs/dbeaver.yml b/tasks/pkgs/dbeaver.yml index 65baefa..bbfdd19 100644 --- a/tasks/pkgs/dbeaver.yml +++ b/tasks/pkgs/dbeaver.yml @@ -5,6 +5,7 @@ - ansible_system == 'Linux' notify: - Depend flatpak + changed_when: true ansible.builtin.set_fact: pkg_flatpak: "{{ pkg_flatpak + ['io.dbeaver.DBeaverCommunity'] }}" diff --git a/tasks/pkgs/dockerls.yml b/tasks/pkgs/dockerls.yml index 683275b..b774028 100644 --- a/tasks/pkgs/dockerls.yml +++ b/tasks/pkgs/dockerls.yml @@ -3,5 +3,6 @@ - name: Add to pkg_npm notify: - Depend node + changed_when: true ansible.builtin.set_fact: pkg_npm: "{{ pkg_npm + ['dockerfile-language-server-nodejs'] }}" diff --git a/tasks/pkgs/dotenv-linter.yml b/tasks/pkgs/dotenv-linter.yml index 159d84f..c4f6ffc 100644 --- a/tasks/pkgs/dotenv-linter.yml +++ b/tasks/pkgs/dotenv-linter.yml @@ -3,5 +3,6 @@ - name: Add to pkg_cargo notify: - Depend cargo + changed_when: true ansible.builtin.set_fact: pkg_cargo: "{{ pkg_cargo + ['dotenv-linter'] }}" diff --git a/tasks/pkgs/duf.yml b/tasks/pkgs/duf.yml index e9bdc8f..3d553ea 100644 --- a/tasks/pkgs/duf.yml +++ b/tasks/pkgs/duf.yml @@ -3,5 +3,6 @@ - name: Append to pkg_go notify: - Depend go + changed_when: true ansible.builtin.set_fact: pkg_go: "{{ pkg_go + ['github.com/muesli/duf@latest'] }}" diff --git a/tasks/pkgs/dust.yml b/tasks/pkgs/dust.yml index 2ef3ca6..89b9842 100644 --- a/tasks/pkgs/dust.yml +++ b/tasks/pkgs/dust.yml @@ -5,6 +5,7 @@ - ansible_system == 'Linux' notify: - Depend cargo + changed_when: true ansible.builtin.set_fact: pkg_cargo: "{{ pkg_cargo + ['du-dust'] }}" diff --git a/tasks/pkgs/eslint.yml b/tasks/pkgs/eslint.yml index d8ae9f6..b529871 100644 --- a/tasks/pkgs/eslint.yml +++ b/tasks/pkgs/eslint.yml @@ -3,5 +3,6 @@ - name: Add to pkg_npm notify: - Depend node + changed_when: true ansible.builtin.set_fact: pkg_npm: "{{ pkg_npm + ['vscode-langservers-extracted'] }}" diff --git a/tasks/pkgs/eza.yml b/tasks/pkgs/eza.yml index a657330..f6bf6e1 100644 --- a/tasks/pkgs/eza.yml +++ b/tasks/pkgs/eza.yml @@ -3,5 +3,6 @@ - name: Add to pkg_cargo notify: - Depend cargo + changed_when: true ansible.builtin.set_fact: pkg_cargo: "{{ pkg_cargo + ['eza'] }}" diff --git a/tasks/pkgs/ghostty.yml b/tasks/pkgs/ghostty.yml index dc15649..0a3f690 100644 --- a/tasks/pkgs/ghostty.yml +++ b/tasks/pkgs/ghostty.yml @@ -4,10 +4,11 @@ when: - ghostty.method == 'src' - ansible_distribution != 'MacOSX' - notify: - - Depend zig block: - name: Build ghostty from source + notify: + - Depend zig + changed_when: true ansible.builtin.set_fact: pkg_sys: "{{ pkg_sys + ghostty.deps }}" pkg_src: "{{ pkg_src + ['ghostty'] }}" @@ -28,6 +29,7 @@ - ansible_distribution == 'Fedora' notify: - Depend terra repo + changed_when: true ansible.builtin.set_fact: pkg_sys: "{{ pkg_sys + ['ghostty'] }}" diff --git a/tasks/pkgs/glow.yml b/tasks/pkgs/glow.yml index e463817..0d0c3e5 100644 --- a/tasks/pkgs/glow.yml +++ b/tasks/pkgs/glow.yml @@ -3,5 +3,6 @@ - name: Add to pkg_go notify: - Depend go + changed_when: true ansible.builtin.set_fact: pkg_go: "{{ pkg_go + ['github.com/charmbracelet/glow@latest'] }}" diff --git a/tasks/pkgs/godot.yml b/tasks/pkgs/godot.yml index 0cd00fd..42e0718 100644 --- a/tasks/pkgs/godot.yml +++ b/tasks/pkgs/godot.yml @@ -5,6 +5,7 @@ - ansible_system == 'Linux' notify: - Depend flatpak + changed_when: true ansible.builtin.set_fact: pkg_flatpak: "{{ pkg_flatpak + ['org.godotengine.Godot'] }}" diff --git a/tasks/pkgs/gopls.yml b/tasks/pkgs/gopls.yml index ff162b1..34ef4d8 100644 --- a/tasks/pkgs/gopls.yml +++ b/tasks/pkgs/gopls.yml @@ -3,5 +3,6 @@ - name: Add to pkg_go notify: - Depend go + changed_when: true ansible.builtin.set_fact: pkg_go: "{{ pkg_go + ['golang.org/x/tools/gopls@latest'] }}" diff --git a/tasks/pkgs/gping.yml b/tasks/pkgs/gping.yml index 794f94d..9a26a35 100644 --- a/tasks/pkgs/gping.yml +++ b/tasks/pkgs/gping.yml @@ -11,5 +11,6 @@ - ansible_system == 'Linux' notify: - Depend cargo + changed_when: true ansible.builtin.set_fact: pkg_cargo: "{{ pkg_cargo + ['gping'] }}" diff --git a/tasks/pkgs/heroic.yml b/tasks/pkgs/heroic.yml index cbc233d..b8080a6 100644 --- a/tasks/pkgs/heroic.yml +++ b/tasks/pkgs/heroic.yml @@ -5,6 +5,7 @@ - ansible_system == 'Linux' notify: - Depend flatpak + changed_when: true ansible.builtin.set_fact: pkg_flatpak: "{{ pkg_flatpak + ['com.heroicgameslauncher.hgl'] }}" diff --git a/tasks/pkgs/htmlls.yml b/tasks/pkgs/htmlls.yml index d8ae9f6..b529871 100644 --- a/tasks/pkgs/htmlls.yml +++ b/tasks/pkgs/htmlls.yml @@ -3,5 +3,6 @@ - name: Add to pkg_npm notify: - Depend node + changed_when: true ansible.builtin.set_fact: pkg_npm: "{{ pkg_npm + ['vscode-langservers-extracted'] }}" diff --git a/tasks/pkgs/httpie.yml b/tasks/pkgs/httpie.yml index 1596e77..3e41402 100644 --- a/tasks/pkgs/httpie.yml +++ b/tasks/pkgs/httpie.yml @@ -5,6 +5,7 @@ - ansible_system == 'Linux' notify: - Depend flatpak + changed_when: true ansible.builtin.set_fact: pkg_flatpak: "{{ pkg_flatpak + ['io.httpie.Httpie'] }}" diff --git a/tasks/pkgs/intelephense.yml b/tasks/pkgs/intelephense.yml index eb1a043..cbfcc8d 100644 --- a/tasks/pkgs/intelephense.yml +++ b/tasks/pkgs/intelephense.yml @@ -3,5 +3,6 @@ - name: Add to pkg_npm notify: - Depend node + changed_when: true ansible.builtin.set_fact: pkg_npm: "{{ pkg_npm + ['intelephense'] }}" diff --git a/tasks/pkgs/jinja-lsp.yml b/tasks/pkgs/jinja-lsp.yml index 93d54b8..d983665 100644 --- a/tasks/pkgs/jinja-lsp.yml +++ b/tasks/pkgs/jinja-lsp.yml @@ -3,5 +3,6 @@ - name: Add to pkg_cargo notify: - Depend cargo + changed_when: true ansible.builtin.set_fact: pkg_cargo: "{{ pkg_cargo + ['jinja-lsp'] }}" diff --git a/tasks/pkgs/jsonls.yml b/tasks/pkgs/jsonls.yml index d8ae9f6..b529871 100644 --- a/tasks/pkgs/jsonls.yml +++ b/tasks/pkgs/jsonls.yml @@ -3,5 +3,6 @@ - name: Add to pkg_npm notify: - Depend node + changed_when: true ansible.builtin.set_fact: pkg_npm: "{{ pkg_npm + ['vscode-langservers-extracted'] }}" diff --git a/tasks/pkgs/lazygit.yml b/tasks/pkgs/lazygit.yml index 06b0b12..750e785 100644 --- a/tasks/pkgs/lazygit.yml +++ b/tasks/pkgs/lazygit.yml @@ -3,5 +3,6 @@ - name: Add to pkg_go notify: - Depend go + changed_when: true ansible.builtin.set_fact: pkg_go: "{{ pkg_go + ['github.com/jesseduffield/lazygit@latest'] }}" diff --git a/tasks/pkgs/libreoffice.yml b/tasks/pkgs/libreoffice.yml index 754c7e6..9cafca3 100644 --- a/tasks/pkgs/libreoffice.yml +++ b/tasks/pkgs/libreoffice.yml @@ -4,7 +4,7 @@ when: - libreoffice.method == 'flatpak' ansible.builtin.set_fact: - pkg_flatpak: "{{ pkg_flatpak + libreoffice.flatpak }}" + pkg_flatpak: "{{ pkg_flatpak + [libreoffice.flatpak] }}" - name: Append to pkg_sys when: diff --git a/tasks/pkgs/markdownlint-cli.yml b/tasks/pkgs/markdownlint-cli.yml index b31c30b..978e3a9 100644 --- a/tasks/pkgs/markdownlint-cli.yml +++ b/tasks/pkgs/markdownlint-cli.yml @@ -3,5 +3,6 @@ - name: Add to pkg_npm notify: - Depend node + changed_when: true ansible.builtin.set_fact: pkg_npm: "{{ pkg_npm + ['markdownlint-cli'] }}" diff --git a/tasks/pkgs/neovide.yml b/tasks/pkgs/neovide.yml index 771045e..ba42265 100644 --- a/tasks/pkgs/neovide.yml +++ b/tasks/pkgs/neovide.yml @@ -5,6 +5,7 @@ - ansible_system == 'Linux' notify: - Depend cargo + changed_when: true ansible.builtin.set_fact: pkg_sys: "{{ pkg_sys + neovide.deps }}" pkg_cargo: "{{ pkg_cargo + [neovide] }}" diff --git a/tasks/pkgs/nextcloud.yml b/tasks/pkgs/nextcloud.yml index 54c63e7..8b0a9de 100644 --- a/tasks/pkgs/nextcloud.yml +++ b/tasks/pkgs/nextcloud.yml @@ -6,6 +6,7 @@ - nextcloud.method == 'flatpak' notify: - Depend flatpak + changed_when: true ansible.builtin.set_fact: pkg_flatpak: "{{ pkg_flatpak + [nextcloud] }}" diff --git a/tasks/pkgs/nginxls.yml b/tasks/pkgs/nginxls.yml index b311db7..844322c 100644 --- a/tasks/pkgs/nginxls.yml +++ b/tasks/pkgs/nginxls.yml @@ -3,5 +3,6 @@ - name: Add to pkg_pipx notify: - Depend node + changed_when: true ansible.builtin.set_fact: pkg_pipx: "{{ pkg_pipx + ['nginx-language-server'] }}" diff --git a/tasks/pkgs/nomad.yml b/tasks/pkgs/nomad.yml index 9868b19..f353659 100644 --- a/tasks/pkgs/nomad.yml +++ b/tasks/pkgs/nomad.yml @@ -1,7 +1,19 @@ # vim: set filetype=yaml.ansible : --- -- name: Append to pkgs +- name: Append to pkg_tap + when: + - ansible_distribution == 'MacOSX' notify: - Depend hashicorp repo + changed_when: true ansible.builtin.set_fact: - pkg_tap: "{{ pkg_tap + [pkgconfig.nomad[ansible_system]] }}" + pkg_tap: "{{ pkg_tap + nomad.pkgs }}" + +- name: Append to pkg_sys + when: + - ansible_system == 'Linux' + notify: + - Depend hashicorp repo + changed_when: true + ansible.builtin.set_fact: + pkg_sys: "{{ pkg_sys + nomad.pkgs }}" diff --git a/tasks/pkgs/packer.yml b/tasks/pkgs/packer.yml index 7ab6642..7030445 100644 --- a/tasks/pkgs/packer.yml +++ b/tasks/pkgs/packer.yml @@ -4,12 +4,13 @@ when: - ansible_system == 'Darwin' ansible.builtin.set_fact: - pkg_tap: "{{ pkg_tap + [pkgconfig.packer[ansible_system]] }}" + pkg_tap: "{{ pkg_tap + packer.pkgs }}" - name: Append to pkg_sys when: - ansible_system == 'Linux' notify: - Depend hashicorp repo + changed_when: true ansible.builtin.set_fact: - pkg_sys: "{{ pkg_sys + ['packer'] }}" + pkg_sys: "{{ pkg_sys + packer.pkgs }}" diff --git a/tasks/pkgs/pgadmin.yml b/tasks/pkgs/pgadmin.yml index 6d219df..7df7ac8 100644 --- a/tasks/pkgs/pgadmin.yml +++ b/tasks/pkgs/pgadmin.yml @@ -5,6 +5,7 @@ - pgadmin.method == 'flatpak' notify: - Depend flatpak + changed_when: true ansible.builtin.set_fact: pkg_flatpak: "{{ pkg_flatpak + [pgadmin.flatpak] }}" diff --git a/tasks/pkgs/pyright.yml b/tasks/pkgs/pyright.yml index 591e5f9..4269cf5 100644 --- a/tasks/pkgs/pyright.yml +++ b/tasks/pkgs/pyright.yml @@ -3,5 +3,6 @@ - name: Add to pkg_pipx notify: - Depend pipx + changed_when: true ansible.builtin.set_fact: pkg_pipx: "{{ pkg_pipx + ['pyright'] }}" diff --git a/tasks/pkgs/quobix-vacuum.yml b/tasks/pkgs/quobix-vacuum.yml index 922898a..291b8a5 100644 --- a/tasks/pkgs/quobix-vacuum.yml +++ b/tasks/pkgs/quobix-vacuum.yml @@ -3,5 +3,6 @@ - name: Add to pkg_npm notify: - Depend node + changed_when: true ansible.builtin.set_fact: pkg_npm: "{{ pkg_npm + ['@quobix/vacuum'] }}" diff --git a/tasks/pkgs/revive.yml b/tasks/pkgs/revive.yml index 3a497cd..b5e228c 100644 --- a/tasks/pkgs/revive.yml +++ b/tasks/pkgs/revive.yml @@ -3,5 +3,6 @@ - name: Add to pkg_go notify: - Depend go + changed_when: true ansible.builtin.set_fact: pkg_go: "{{ pkg_go + ['github.com/mgechev/revive@latest'] }}" diff --git a/tasks/pkgs/sd.yml b/tasks/pkgs/sd.yml index 159c154..058a056 100644 --- a/tasks/pkgs/sd.yml +++ b/tasks/pkgs/sd.yml @@ -11,5 +11,6 @@ - ansible_system == 'Linux' notify: - Depend cargo + changed_when: true ansible.builtin.set_fact: pkg_cargo: "{{ pkg_cargo + ['sd'] }}" diff --git a/tasks/pkgs/sqlfluff.yml b/tasks/pkgs/sqlfluff.yml index 27bfcca..9199abf 100644 --- a/tasks/pkgs/sqlfluff.yml +++ b/tasks/pkgs/sqlfluff.yml @@ -3,5 +3,6 @@ - name: Add to pkg_pipx notify: - Depend pipx + changed_when: true ansible.builtin.set_fact: pkg_pipx: "{{ pkg_pipx + ['sqlfluff'] }}" diff --git a/tasks/pkgs/sqlls.yml b/tasks/pkgs/sqlls.yml index 205bab9..745823a 100644 --- a/tasks/pkgs/sqlls.yml +++ b/tasks/pkgs/sqlls.yml @@ -3,5 +3,6 @@ - name: Add to pkg_npm notify: - Depend node + changed_when: true ansible.builtin.set_fact: pkg_npm: "{{ pkg_npm + ['sql-language-server'] }}" diff --git a/tasks/pkgs/starship.yml b/tasks/pkgs/starship.yml index 24afd5d..1c8272a 100644 --- a/tasks/pkgs/starship.yml +++ b/tasks/pkgs/starship.yml @@ -3,5 +3,6 @@ - name: Add to pkg_cargo notify: - Depend cargo + changed_when: true ansible.builtin.set_fact: pkg_cargo: "{{ pkg_cargo + ['starship'] }}" diff --git a/tasks/pkgs/tailscale.yml b/tasks/pkgs/tailscale.yml index 1d44134..3a710d3 100644 --- a/tasks/pkgs/tailscale.yml +++ b/tasks/pkgs/tailscale.yml @@ -11,7 +11,7 @@ - name: Fedora >=41 ansible.builtin.command: creates: /etc/yum.repos.d/tailscale.repo - cmd: "dnf config-manager addrepo --from-repofile={{ pkgconfig.tailscale.url_base }}/fedora/tailscale.repo" + cmd: "dnf config-manager addrepo --from-repofile={{ tailscale.url_base }}/fedora/tailscale.repo" become: true when: - ansible_distribution == 'Fedora' @@ -20,7 +20,7 @@ - name: Fedora <41 ansible.builtin.command: creates: /etc/yum.repos.d/tailscale.repo - cmd: "dnf config-manager --add-repo {{ pkgconfig.tailscale.url_base }}/fedora/tailscale.repo" + cmd: "dnf config-manager --add-repo {{ tailscale.url_base }}/fedora/tailscale.repo" become: true when: - ansible_distribution == 'Fedora' @@ -29,7 +29,7 @@ - name: Rhel based distros ansible.builtin.command: creates: /etc/yum.repos.d/tailscale.repo - cmd: "dnf config-manager --add-repo {{ pkgconfig.tailscale.url_base }}/rhel/{{ ansible_os_major_version }}/tailscale.repo" + cmd: "dnf config-manager --add-repo {{ tailscale.url_base }}/rhel/{{ ansible_os_major_version }}/tailscale.repo" become: true when: - ansible_distribution != 'Fedora' @@ -43,14 +43,14 @@ - name: Get tailscal keyring become: "{{ sys_pkg_become }}" ansible.builtin.get_url: - url: "{{ pkgconfig.tailscale.url_base }}/debian/{{ pkgconfig.tailscale.release[ansible_os_release].gpg }}" + url: "{{ tailscale.url_base }}/debian/{{ tailscale.release.gpg }}" dest: /usr/share/keyrings/tailscale-archive-keyring.gpg mode: '0644' - name: Get tailscale repo list become: "{{ sys_pkg_become }}" ansible.builtin.get_url: - url: "{{ pkgconfig.tailscale.url_base }}/debian/{{ pkgconfig.tailscale.release[ansible_os_release].list }}" + url: "{{ tailscale.url_base }}/debian/{{ tailscale.release.list }}" dest: /etc/apt/sources.list.d/tailscale.list mode: '0644' diff --git a/tasks/pkgs/tailwindcss-languageserver.yml b/tasks/pkgs/tailwindcss-languageserver.yml index 4d78fff..04f47b6 100644 --- a/tasks/pkgs/tailwindcss-languageserver.yml +++ b/tasks/pkgs/tailwindcss-languageserver.yml @@ -3,5 +3,6 @@ - name: Add to pkg_npm notify: - Depend node + changed_when: true ansible.builtin.set_fact: pkg_npm: "{{ pkg_npm + ['@tailwindcss/language-server'] }}" diff --git a/tasks/pkgs/templ.yml b/tasks/pkgs/templ.yml index ef5f66d..23dd68f 100644 --- a/tasks/pkgs/templ.yml +++ b/tasks/pkgs/templ.yml @@ -3,5 +3,6 @@ - name: Add to pkg_go notify: - Depend go + changed_when: true ansible.builtin.set_fact: pkg_go: "{{ pkg_go + ['github.com/a-h/templ/cmd/templ@latest'] }}" diff --git a/tasks/pkgs/terraform.yml b/tasks/pkgs/terraform.yml index 3c3e297..946eb53 100644 --- a/tasks/pkgs/terraform.yml +++ b/tasks/pkgs/terraform.yml @@ -1,17 +1,21 @@ # vim: set filetype=yaml.ansible : --- - name: Append to pkgs - notify: - - Depend hashicorp repo block: - name: MacOSX specific when: - ansible_distribution == 'MacOSX' + notify: + - Depend hashicorp repo + changed_when: true ansible.builtin.set_fact: pkg_tap: "{{ pkg_tap + terraform.pkgs }}" - name: Linux specific when: - ansible_system == 'Linux' + notify: + - Depend hashicorp repo + changed_when: true ansible.builtin.set_fact: pkg_sys: "{{ pkg_sys + terraform.pkgs }}" diff --git a/tasks/pkgs/terraformls.yml b/tasks/pkgs/terraformls.yml index b5e3532..e804669 100644 --- a/tasks/pkgs/terraformls.yml +++ b/tasks/pkgs/terraformls.yml @@ -1,17 +1,21 @@ # vim: set filetype=yaml.ansible : --- - name: Append to pkgs - notify: - - Depend hashicorp repo block: - name: MacOS specific when: - ansible_system == 'Darwin' + notify: + - Depend hashicorp repo + changed_when: true ansible.builtin.set_fact: pkg_tap: "{{ pkg_tap + terraformls.pkgs }}" - name: Linux specific when: - ansible_system == 'Linux' + notify: + - Depend hashicorp repo + changed_when: true ansible.builtin.set_fact: pkg_sys: "{{ pkg_sys + terraformls.pkgs }}" diff --git a/tasks/pkgs/vault.yml b/tasks/pkgs/vault.yml index a42c509..82c63dd 100644 --- a/tasks/pkgs/vault.yml +++ b/tasks/pkgs/vault.yml @@ -1,17 +1,21 @@ # vim: set filetype=yaml.ansible : --- - name: Append to pkgs - notify: - - Depend hashicorp repo block: - name: MacOS specific when: - ansible_system == 'Darwin' + notify: + - Depend hashicorp repo + changed_when: true ansible.builtin.set_fact: - pkg_tap: "{{ pkg_tap + [pkgconfig.vault[ansible_system]] }}" + pkg_tap: "{{ pkg_tap + vault.pkgs }}" - name: Linux specific when: - ansible_system == 'Linux' + notify: + - Depend hashicorp repo + changed_when: true ansible.builtin.set_fact: - pkg_sys: "{{ pkg_sys + ['vault'] }}" + pkg_sys: "{{ pkg_sys + vault.pkgs }}" diff --git a/tasks/pkgs/yamlls.yml b/tasks/pkgs/yamlls.yml index e3d9210..a27b45f 100644 --- a/tasks/pkgs/yamlls.yml +++ b/tasks/pkgs/yamlls.yml @@ -3,5 +3,6 @@ - name: Add to pkg_npm notify: - Depend node + changed_when: true ansible.builtin.set_fact: pkg_npm: "{{ pkg_npm + ['yaml-language-server'] }}" diff --git a/tasks/pkgs/zls.yml b/tasks/pkgs/zls.yml index 74d0e21..e259621 100644 --- a/tasks/pkgs/zls.yml +++ b/tasks/pkgs/zls.yml @@ -3,5 +3,6 @@ - name: Append to pkgs notify: - Depend zig + changed_when: true ansible.builtin.set_fact: pkg_archive: "{{ pkg_archive + ['zls'] }}" diff --git a/tests/Containerfile b/tests/Containerfile index 2bad7a8..957c9b1 100644 --- a/tests/Containerfile +++ b/tests/Containerfile @@ -3,7 +3,7 @@ LABEL PROJECT "ansible_role_package" LABEL MAINTAINER "Matthew Stobbs " RUN useradd -d /home/ansible -m -G wheel ansible -RUN dnf install -y openssh-server python3-paramiko python3-libdnf5 +RUN dnf install -y openssh-server python3-paramiko python3-libdnf5 gnupg2 EXPOSE 22 USER ansible diff --git a/tests/cleanup.sh b/tests/cleanup.sh new file mode 100755 index 0000000..1669872 --- /dev/null +++ b/tests/cleanup.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env zsh + +IMAGE=packagetest +CONTAINER=packagetest +MACHINENAME=podman-machine-default + +ssh-keygen -R "[127.0.0.1]:2222" +podman stop $CONTAINER +podman rm $IMAGE +podman machine stop $MACHINENAME diff --git a/tests/setup.sh b/tests/setup.sh new file mode 100755 index 0000000..8c2572d --- /dev/null +++ b/tests/setup.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env zsh + +IMAGE=packagetest +CONTAINER=packagetest +MACHINENAME=podman-machine-default + +function machine_state { + echo $(podman machine inspect $MACHINENAME | jq -r '.[].State') +} + +echo "Starting $MACHINENAME" +podman machine start -q $MACHINENAME +while [ "$(machine_state)" != "running" ] +do + echo $(machine_state) + echo "Wating for $MACHINENAME to start" + sleep 1 +done + +echo "Machine $MACHINENAME running" + +echo "Building container images" +podman build --platform linux/amd64 -f Containerfile -t $IMAGE . diff --git a/tests/test.sh b/tests/test.sh new file mode 100755 index 0000000..f0dcb0a --- /dev/null +++ b/tests/test.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env zsh + +podman run --rm -it -d --platform linux/amd64 --name packagetest -p 2222:22 packagetest +ansible-playbook test_not_local.yml -i inventory.yml diff --git a/tests/test.yml b/tests/test.yml deleted file mode 100644 index 4cff583..0000000 --- a/tests/test.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -- hosts: localhost - remote_user: root - roles: - - role: ansible_role_package - vars: - use_local: false - packages: - - air - - ansible-language-server diff --git a/tests/test_not_local.yml b/tests/test_not_local.yml new file mode 100644 index 0000000..d9efe82 --- /dev/null +++ b/tests/test_not_local.yml @@ -0,0 +1,112 @@ +--- +- hosts: localhost + vars: + testpkgs: + - air + - alacritty + - ansible-language-server + - ansible-lint + - ansible + - bashls + - bat + - bitwarden + - blender + - broot + - btop + - buf + - bufls + - carapace + - cheat + - checkmake + - choose + - clangd + - cmake + - cmakelang + - commitlint-cli + - commitlint-config-conventional + - consul + - cssls + - curlie + - dbeaver + - direnv + - dockerls + - dotenv-linter + - duf + - dust + - editorconfig + - eslint + - eza + - fd + - firefox + - flatpak + - fzf + - ghostty + - git + - glow + - go + - godot + - gopls + - gping + - heroic + - htmlls + - htmx-lsp + - httpie + - hugo + - hyperfine + - intelephense + - jinja-lsp + - jq + - jsonls + - kitty + - lazygit + - libreoffice + - lua-language-server + - markdownlint-cli + - mcfly + - neovide + - neovim + - nerdfonts + - nextcloud + - nginxls + - nodejs + - nomad + - packer + - pandoc + - pgadmin + - pipx + - podman + - pyright + - python3 + - quobix-vacuum + - revive + - ripgrep + - rust + - sd + - sqlfluff + - sqlls + - starship + - stow + - tailscale + - tailwindcss-languageserver + - templ + - terraform + - terraformls + - thunderbird + - tidy + - tldr + - tmux + - vault + - xh + - yamlls + - zfs + - zig + - zls + - zoxide + - zsh + tasks: + - name: Test all packages with use_local=false + ansible.builtin.include_role: + name: ansible_role_package + vars: + use_local: false + packages: "{{ testpkgs }}" diff --git a/vars/pkgs/ghostty.yml b/vars/pkgs/ghostty.yml index 3f11d3f..682691c 100644 --- a/vars/pkgs/ghostty.yml +++ b/vars/pkgs/ghostty.yml @@ -15,7 +15,11 @@ ghostty: appimage: base_url: https://github.com/psadi/ghostty-appimage/releases/download/ link_name: ghostty - method: + cask: + - ghostty + sys: + - ghostty + methods: default: appimage Fedora: sys - MacOSX: brew + MacOSX: cask diff --git a/vars/pkgs/go.yml b/vars/pkgs/go.yml index 9a523ca..f3d10fe 100644 --- a/vars/pkgs/go.yml +++ b/vars/pkgs/go.yml @@ -14,7 +14,7 @@ go: amd64: sha256:dee0ea64411a00b47ded586d5a8e30cfe3acf51564aa1bb24e039a6dca807a29 arm64: sha256:b19eb6b7ae87f8371c3e7a84d129db67779a2883d2fffa6bb90412b0167df133 Linux: - amd64: sha256:b19eb6b7ae87f8371c3e7a84d129db67779a2883d2fffa6bb90412b0167df133 + amd64: sha256:dea9ca38a0b852a74e81c26134671af7c0fbe65d81b0dc1c5bfe22cf7d4c8858 arm64: sha256:c3fa6d16ffa261091a5617145553c71d21435ce547e44cc6dfb7470865527cc7 1.23.6: Darwin: diff --git a/vars/pkgs/nomad.yml b/vars/pkgs/nomad.yml index 872edee..42a38c3 100644 --- a/vars/pkgs/nomad.yml +++ b/vars/pkgs/nomad.yml @@ -1,3 +1,6 @@ nomad: - Linux: nomad - Darwin: hashicorp/tap/nomad + pkgs: + Linux: + - nomad + Darwin: + - hashicorp/tap/nomad diff --git a/vars/pkgs/packer.yml b/vars/pkgs/packer.yml index ee0d63e..49a6196 100644 --- a/vars/pkgs/packer.yml +++ b/vars/pkgs/packer.yml @@ -1,3 +1,6 @@ packer: - Linux: packer - Darwin: packer + pkgs: + Linux: + - packer + Darwin: + - packer diff --git a/vars/pkgs/pgadmin.yml b/vars/pkgs/pgadmin.yml index 5e2069e..5e3afe0 100644 --- a/vars/pkgs/pgadmin.yml +++ b/vars/pkgs/pgadmin.yml @@ -10,3 +10,4 @@ pgadmin: pkgs: Darwin: - pgadmin4 + Linux: [] diff --git a/vars/pkgs/vault.yml b/vars/pkgs/vault.yml index ca53cde..017a153 100644 --- a/vars/pkgs/vault.yml +++ b/vars/pkgs/vault.yml @@ -1,3 +1,6 @@ vault: - Linux: vault - Darwin: hashicorp/tap/vault + pkgs: + Linux: + - vault + Darwin: + - hashicorp/tap/vault From 3b22dbf6a914218ea25ad3aa559620e624ef7428 Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Sun, 23 Feb 2025 02:34:37 -0700 Subject: [PATCH 32/38] fixing more packages installs --- tasks/config/zfs.yml | 1 + tasks/pkgs/zfs.yml | 1 + tasks/repos/terra.yml | 1 + tests/test.sh | 1 + 4 files changed, 4 insertions(+) diff --git a/tasks/config/zfs.yml b/tasks/config/zfs.yml index 3de179f..0b124d0 100644 --- a/tasks/config/zfs.yml +++ b/tasks/config/zfs.yml @@ -11,6 +11,7 @@ repo_pkg: "{{ pkgconfig.zfs.repo_base }}/{{ rhname }}/zfs-release-{{ pkgconfig.zfs[rhname].release }}{{ rpm_dist.stdout }}.noarch.rpm" deps: "{{ pkgconfig.zfs.build_deps[ansible_os_family] }}" pkgs: "{{ pkgconfig.zfs.pkgs[ansible_os_family] }}" + skip_gpg_check: "{{ rhname == 'fedora' }}" release: "{{ ansible_distribution_release }}" gpg_key: "{{ pkgconfig.zfs.gpg_key }}" gpg_fp: "{{ pkgconfig.zfs.gpg_key_fingerprint }}" diff --git a/tasks/pkgs/zfs.yml b/tasks/pkgs/zfs.yml index 6d367e2..ad78de3 100644 --- a/tasks/pkgs/zfs.yml +++ b/tasks/pkgs/zfs.yml @@ -19,6 +19,7 @@ become: "{{ sys_pkg_become }}" ansible.builtin.dnf: name: "{{ zfs.repo_pkg }}" + disable_gpg_check: "{{ zfs.skip_gpg_check }}" state: present - name: Debian configuration diff --git a/tasks/repos/terra.yml b/tasks/repos/terra.yml index 4a23e02..cc36c3e 100644 --- a/tasks/repos/terra.yml +++ b/tasks/repos/terra.yml @@ -19,6 +19,7 @@ cmd: "dnf config-manager --add-repo {{ pkgconfig.terrarepo.repo }}" - name: Install terra release package + become: true ansible.builtin.dnf: name: terra-release state: present diff --git a/tests/test.sh b/tests/test.sh index f0dcb0a..be70e82 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -2,3 +2,4 @@ podman run --rm -it -d --platform linux/amd64 --name packagetest -p 2222:22 packagetest ansible-playbook test_not_local.yml -i inventory.yml +podman stop packagetest From 57b3b93a184f75f1fcdc93187922f9d85e70cc2f Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Sun, 23 Feb 2025 02:41:02 -0700 Subject: [PATCH 33/38] fixing hashicorp --- tasks/repos/hashicorp.yml | 10 +++++++--- vars/pkgs/hashicorp.yml | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tasks/repos/hashicorp.yml b/tasks/repos/hashicorp.yml index a7e2bb1..9f57bc6 100644 --- a/tasks/repos/hashicorp.yml +++ b/tasks/repos/hashicorp.yml @@ -1,5 +1,9 @@ # vim: set filetype=yaml.ansible : --- +- name: Load hashicorp repo config + ansible.builtin.include_tasks: + file: config/hashicorp.yml + - name: RedHat repository when: - ansible_os_family == 'RedHat' @@ -11,7 +15,7 @@ - ansible_distribution_major_version|int >= 41 ansible.builtin.command: creates: /etc/yum.repos.d/hashicorp.repo - cmd: "dnf config-manager addrepo --from-repofile={{ pkgconfig.hashicorp.Linux.Fedora.repo }}" + cmd: "dnf config-manager addrepo --from-repofile={{ hashicorp.repo }}" - name: Enable hashicorp repo for fedora <41 become: true @@ -20,7 +24,7 @@ - ansible_distribution_major_version|int < 41 ansible.builtin.command: creates: /etc/yum.repos.d/hashicorp.repo - cmd: "dnf config-manager --add-repo {{ pkgconfig.hashicorp.Linux.Fedora.repo }}" + cmd: "dnf config-manager --add-repo {{ hashicorp.repo }}" - name: Enable hashicorp repo for RHEL like distribution become: true @@ -28,7 +32,7 @@ - ansible_distribution != 'Fedora' ansible.builtin.command: creates: /etc/yum.repos.d/hashicorp.repo - cmd: "dnf config-manager --add-repo {{ pkgconfig.hashicorp.Linux.RedHat.repo }}" + cmd: "dnf config-manager --add-repo {{ hashicorp.repo }}" - name: Debian based repository when: diff --git a/vars/pkgs/hashicorp.yml b/vars/pkgs/hashicorp.yml index 725b706..8b7b8e4 100644 --- a/vars/pkgs/hashicorp.yml +++ b/vars/pkgs/hashicorp.yml @@ -2,7 +2,9 @@ hashicorp: Linux: ".el9": repo: https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo - fedora: + ".fc40": + repo: https://rpm.releases.hashicorp.com/fedora/hashicorp.repo + ".fc41": repo: https://rpm.releases.hashicorp.com/fedora/hashicorp.repo debian: repo: "deb [arch={{ ansible_architecture }} signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com {{ ansible_distribution_release }} main" From 6397899d885425575b3900408aebd1242387f35e Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Sun, 23 Feb 2025 03:11:12 -0700 Subject: [PATCH 34/38] add more testing containers --- tasks/config/hashicorp.yml | 6 ++-- tasks/config/zfs.yml | 7 ++++- tasks/repos/hashicorp.yml | 29 ++++--------------- tests/Containerfile.debian | 18 ++++++++++++ tests/Containerfile.el9 | 17 +++++++++++ tests/{Containerfile => Containerfile.fedora} | 0 tests/Containerfile.ubuntu | 18 ++++++++++++ tests/setup.sh | 5 +++- tests/test.sh | 9 ++++++ vars/pkgs/zfs.yml | 2 ++ 10 files changed, 82 insertions(+), 29 deletions(-) create mode 100644 tests/Containerfile.debian create mode 100644 tests/Containerfile.el9 rename tests/{Containerfile => Containerfile.fedora} (100%) create mode 100644 tests/Containerfile.ubuntu diff --git a/tasks/config/hashicorp.yml b/tasks/config/hashicorp.yml index fb4bf55..0b39e4e 100644 --- a/tasks/config/hashicorp.yml +++ b/tasks/config/hashicorp.yml @@ -1,13 +1,13 @@ - name: Set OS name for RedHat family when: - - ansible_os_famly == 'RedHat' + - ansible_os_family == 'RedHat' ansible.builtin.set_fact: hashicorp: - repo: "{{ pkgconfig.hashicorp.Linux[rpm_dist.stdout] }}" + repo: "{{ pkgconfig.hashicorp.Linux[rpm_dist.stdout].repo }}" - name: Set repo for debian when: - ansible_os_family == 'Debian' ansible.builtin.set_Fact: hashicorp: - repo: "{{ pkgconfig.hashicorp.Linux.Debian }}" + repo: "{{ pkgconfig.hashicorp.Linux.Debian.repo }}" diff --git a/tasks/config/zfs.yml b/tasks/config/zfs.yml index 0b124d0..88925b3 100644 --- a/tasks/config/zfs.yml +++ b/tasks/config/zfs.yml @@ -5,11 +5,16 @@ ansible.builtin.set_fact: rhname: "{%if ansible_distribution == 'Fedora' %}fedora{% else %}epel{% endif %}" +- name: Set deps for distros + ansible.builtin.set_fact: + zfs: + deps: "{% if ansible_distribution == 'Fedora' %}{{ pkgconfig.zfs.build_deps.Fedora }}{% else %}{{ pkgconfig.zfs.build_deps[ansible_os_family] }}{% endif %}" + - name: Set ZFS config ansible.builtin.set_fact: zfs: repo_pkg: "{{ pkgconfig.zfs.repo_base }}/{{ rhname }}/zfs-release-{{ pkgconfig.zfs[rhname].release }}{{ rpm_dist.stdout }}.noarch.rpm" - deps: "{{ pkgconfig.zfs.build_deps[ansible_os_family] }}" + deps: "{{ zfs.deps }}" pkgs: "{{ pkgconfig.zfs.pkgs[ansible_os_family] }}" skip_gpg_check: "{{ rhname == 'fedora' }}" release: "{{ ansible_distribution_release }}" diff --git a/tasks/repos/hashicorp.yml b/tasks/repos/hashicorp.yml index 9f57bc6..9962b96 100644 --- a/tasks/repos/hashicorp.yml +++ b/tasks/repos/hashicorp.yml @@ -8,31 +8,12 @@ when: - ansible_os_family == 'RedHat' block: - - name: Enable hashicorp repo for fedora >=41 + - name: Enable hashicorp repo become: true - when: - - ansible_distribution == 'Fedora' - - ansible_distribution_major_version|int >= 41 - ansible.builtin.command: - creates: /etc/yum.repos.d/hashicorp.repo - cmd: "dnf config-manager addrepo --from-repofile={{ hashicorp.repo }}" - - - name: Enable hashicorp repo for fedora <41 - become: true - when: - - ansible_distribution == 'Fedora' - - ansible_distribution_major_version|int < 41 - ansible.builtin.command: - creates: /etc/yum.repos.d/hashicorp.repo - cmd: "dnf config-manager --add-repo {{ hashicorp.repo }}" - - - name: Enable hashicorp repo for RHEL like distribution - become: true - when: - - ansible_distribution != 'Fedora' - ansible.builtin.command: - creates: /etc/yum.repos.d/hashicorp.repo - cmd: "dnf config-manager --add-repo {{ hashicorp.repo }}" + ansible.builtin.get_url: + url: "{{ hashicorp.repo }}" + dest: /etc/yum.repos.d/hashicorp.repo + mode: '0644' - name: Debian based repository when: diff --git a/tests/Containerfile.debian b/tests/Containerfile.debian new file mode 100644 index 0000000..67ca74f --- /dev/null +++ b/tests/Containerfile.debian @@ -0,0 +1,18 @@ +FROM debian:bookworm +LABEL PROJECT "ansible_role_package" +LABEL MAINTAINER "Matthew Stobbs " + +RUN useradd -d /home/ansible -m -G wheel ansible +RUN apt update && \ + apt install -y openssh-server python3-paramiko gnupg2 +EXPOSE 22 + +USER ansible +WORKDIR /home/ansible +RUN mkdir /home/ansible/.ssh +COPY ./pubkey /home/ansible/.ssh/authorized_keys + +USER root +RUN echo "ansible ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/sudoers +RUN ssh-keygen -A +ENTRYPOINT /usr/sbin/sshd -D diff --git a/tests/Containerfile.el9 b/tests/Containerfile.el9 new file mode 100644 index 0000000..15f4d96 --- /dev/null +++ b/tests/Containerfile.el9 @@ -0,0 +1,17 @@ +FROM almalinux:9 +LABEL PROJECT "ansible_role_package" +LABEL MAINTAINER "Matthew Stobbs " + +RUN useradd -d /home/ansible -m -G wheel ansible +RUN dnf install -y openssh-server python3-paramiko python3-libdnf gnupg2 +EXPOSE 22 + +USER ansible +WORKDIR /home/ansible +RUN mkdir /home/ansible/.ssh +COPY ./pubkey /home/ansible/.ssh/authorized_keys + +USER root +RUN echo "ansible ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/sudoers +RUN ssh-keygen -A +ENTRYPOINT /usr/sbin/sshd -D diff --git a/tests/Containerfile b/tests/Containerfile.fedora similarity index 100% rename from tests/Containerfile rename to tests/Containerfile.fedora diff --git a/tests/Containerfile.ubuntu b/tests/Containerfile.ubuntu new file mode 100644 index 0000000..334297c --- /dev/null +++ b/tests/Containerfile.ubuntu @@ -0,0 +1,18 @@ +FROM ubuntu:24.04 +LABEL PROJECT "ansible_role_package" +LABEL MAINTAINER "Matthew Stobbs " + +RUN useradd -d /home/ansible -m -G wheel ansible +RUN apt update && \ + apt install -y openssh-server python3-paramiko gnupg2 +EXPOSE 22 + +USER ansible +WORKDIR /home/ansible +RUN mkdir /home/ansible/.ssh +COPY ./pubkey /home/ansible/.ssh/authorized_keys + +USER root +RUN echo "ansible ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/sudoers +RUN ssh-keygen -A +ENTRYPOINT /usr/sbin/sshd -D diff --git a/tests/setup.sh b/tests/setup.sh index 8c2572d..ea8418e 100755 --- a/tests/setup.sh +++ b/tests/setup.sh @@ -20,4 +20,7 @@ done echo "Machine $MACHINENAME running" echo "Building container images" -podman build --platform linux/amd64 -f Containerfile -t $IMAGE . +podman build --platform linux/amd64 -f Containerfile.el9 -t ${IMAGE}_el9 . +podman build --platform linux/amd64 -f Containerfile.fedora -t ${IMAGE)_fedora . +podman build --platform linux/amd64 -f Containerfile.debian -t ${IMAGE}_debian . +podman build --platform linux/amd64 -f Containerfile.ubuntu -t ${IMAGE}_ubuntu . diff --git a/tests/test.sh b/tests/test.sh index be70e82..d669072 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -3,3 +3,12 @@ podman run --rm -it -d --platform linux/amd64 --name packagetest -p 2222:22 packagetest ansible-playbook test_not_local.yml -i inventory.yml podman stop packagetest +podman run --rm -it -d --platform linux/amd64 --name packagetest -p 2222:22 packagetest +ansible-playbook test_not_local.yml -i inventory.yml +podman stop packagetest +podman run --rm -it -d --platform linux/amd64 --name packagetest -p 2222:22 packagetest +ansible-playbook test_not_local.yml -i inventory.yml +podman stop packagetest +podman run --rm -it -d --platform linux/amd64 --name packagetest -p 2222:22 packagetest +ansible-playbook test_not_local.yml -i inventory.yml +podman stop packagetest diff --git a/vars/pkgs/zfs.yml b/vars/pkgs/zfs.yml index ff2138d..d350fe5 100644 --- a/vars/pkgs/zfs.yml +++ b/vars/pkgs/zfs.yml @@ -13,6 +13,8 @@ zfs: - zfs-dkms - zfsutils-linux build_deps: + Fedora: + - kernel-devel RedHat: - kernel-devel - epel-release From a4398fa72e2838ea9f0d8d5527a089df27f2634a Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Tue, 25 Feb 2025 09:30:08 -0700 Subject: [PATCH 35/38] fix typo --- tasks/config/hashicorp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/config/hashicorp.yml b/tasks/config/hashicorp.yml index 0b39e4e..95905cf 100644 --- a/tasks/config/hashicorp.yml +++ b/tasks/config/hashicorp.yml @@ -8,6 +8,6 @@ - name: Set repo for debian when: - ansible_os_family == 'Debian' - ansible.builtin.set_Fact: + ansible.builtin.set_fact: hashicorp: repo: "{{ pkgconfig.hashicorp.Linux.Debian.repo }}" From 4ae443fe26c30dbb67ebc4ec37c82651abd7480e Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Tue, 25 Feb 2025 09:48:07 -0700 Subject: [PATCH 36/38] fix broken flatpak --- tasks/config/bitwarden.yml | 2 +- tasks/config/httpie.yml | 10 ++++++++++ tasks/linux.yml | 24 ++++++++++++++++-------- tasks/pkgs/bitwarden.yml | 2 +- tasks/pkgs/httpie.yml | 4 ++-- vars/pkgs/bitwarden.yml | 6 ++---- vars/pkgs/httpie.yml | 8 ++++++++ 7 files changed, 40 insertions(+), 16 deletions(-) create mode 100644 tasks/config/httpie.yml create mode 100644 vars/pkgs/httpie.yml diff --git a/tasks/config/bitwarden.yml b/tasks/config/bitwarden.yml index e348fec..a1f82c2 100644 --- a/tasks/config/bitwarden.yml +++ b/tasks/config/bitwarden.yml @@ -3,7 +3,7 @@ - name: Set bitwarden install method ansible.builtin.set_fact: bitwarden: - method: "{{ pkgconfig.bitwarden.method[ansible_distribution] | default('appimage') }}" + method: "{{ pkgconfig.bitwarden.method[ansible_distribution] | default('flatpak') }}" - name: Set bitwarden config ansible.builtin.set_fact: diff --git a/tasks/config/httpie.yml b/tasks/config/httpie.yml new file mode 100644 index 0000000..13228b9 --- /dev/null +++ b/tasks/config/httpie.yml @@ -0,0 +1,10 @@ +- name: Set method for httpie + ansible.builtin.set_fact: + httpie: + method: "{{ pkgconfig.httpie.method[ansible_distribution] | default(pkgconfig.httpie.method.default) }}" + +- name: Set config for httpie + ansible.builtin.set_fact: + httpie: + method: "{{ httpie.method }}" + pkg: "{{ pkgconfig.httpie.[httpie.method] }}" diff --git a/tasks/linux.yml b/tasks/linux.yml index e4cf042..55143bd 100644 --- a/tasks/linux.yml +++ b/tasks/linux.yml @@ -23,14 +23,22 @@ when: - pkg_flatpak|length > 0 become: "{{ ext_become }}" - loop: "{{ pkg_flatpak | unique }}" - loop_control: - loop_var: flatpak - community.general.flatpak: - method: "{{ flatpak_method }}" - name: "{{ flatpak.name }}" - remote: "{{ flatpak.remote | default('flathub') }}" - state: present + block: + - name: Debug flatpak + loop: "{{ pkg_flatpak | unique }}" + loop_control: + loop_var: flatpak + ansible.builtin.debug: + var: flatpak + - name: Install flatpak + loop: "{{ pkg_flatpak | unique }}" + loop_control: + loop_var: flatpak + community.general.flatpak: + method: "{{ flatpak_method }}" + name: "{{ flatpak.name }}" + remote: "{{ flatpak.remote | default('flathub') }}" + state: present - name: Install pkg_appimage when: diff --git a/tasks/pkgs/bitwarden.yml b/tasks/pkgs/bitwarden.yml index c16482e..fb810e5 100644 --- a/tasks/pkgs/bitwarden.yml +++ b/tasks/pkgs/bitwarden.yml @@ -19,4 +19,4 @@ when: - bitwarden.method == 'brew' ansible.builtin.set_fact: - pkg_cask: "{{ pkg_cask + [bitwarden.pkg.name] }}" + pkg_cask: "{{ pkg_cask + [bitwarden] }}" diff --git a/tasks/pkgs/httpie.yml b/tasks/pkgs/httpie.yml index 3e41402..d457a84 100644 --- a/tasks/pkgs/httpie.yml +++ b/tasks/pkgs/httpie.yml @@ -7,10 +7,10 @@ - Depend flatpak changed_when: true ansible.builtin.set_fact: - pkg_flatpak: "{{ pkg_flatpak + ['io.httpie.Httpie'] }}" + pkg_flatpak: "{{ pkg_flatpak + [httpie.pkg] }}" - name: Append to pkg_cask when: - ansible_os_family == 'Darwin' ansible.builtin.set_fact: - pkg_cask: "{{ pkg_cask + ['httpie'] }}" + pkg_cask: "{{ pkg_cask + [httpie.pkg] }}" diff --git a/vars/pkgs/bitwarden.yml b/vars/pkgs/bitwarden.yml index 0dc8ba5..3b7ff4b 100644 --- a/vars/pkgs/bitwarden.yml +++ b/vars/pkgs/bitwarden.yml @@ -6,10 +6,8 @@ bitwarden: link_name: bitwarden name: bitwarden.appimage url: https://vault.bitwarden.com/download/?app=desktop&platform=linux&variant=appimage - snap: - name: bitwarden - brew: - name: bitwarden + snap: bitwarden + brew: bitwarden method: Fedora: flatpak Ubuntu: snap diff --git a/vars/pkgs/httpie.yml b/vars/pkgs/httpie.yml new file mode 100644 index 0000000..5478f96 --- /dev/null +++ b/vars/pkgs/httpie.yml @@ -0,0 +1,8 @@ +httpie: + flatpak: + name: io.httpie.Httpie + remote: flathub + brew: httpie + method: + default: flatpak + MacOSX: brew From b2887bf5c2c2bc54b85a6e54d920ceba096970de Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Tue, 25 Feb 2025 09:49:14 -0700 Subject: [PATCH 37/38] fix typo --- tasks/config/httpie.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/config/httpie.yml b/tasks/config/httpie.yml index 13228b9..7188a49 100644 --- a/tasks/config/httpie.yml +++ b/tasks/config/httpie.yml @@ -7,4 +7,4 @@ ansible.builtin.set_fact: httpie: method: "{{ httpie.method }}" - pkg: "{{ pkgconfig.httpie.[httpie.method] }}" + pkg: "{{ pkgconfig.httpie[httpie.method] }}" From e1f01836effc42732fbfc6a93f3add5b00aced2b Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Tue, 25 Feb 2025 18:00:37 -0700 Subject: [PATCH 38/38] only run tests for x86_64 fedora for now Signed-off-by: Matthew Stobbs --- tests/setup.sh | 8 ++++---- tests/test.sh | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/setup.sh b/tests/setup.sh index ea8418e..c3f330a 100755 --- a/tests/setup.sh +++ b/tests/setup.sh @@ -20,7 +20,7 @@ done echo "Machine $MACHINENAME running" echo "Building container images" -podman build --platform linux/amd64 -f Containerfile.el9 -t ${IMAGE}_el9 . -podman build --platform linux/amd64 -f Containerfile.fedora -t ${IMAGE)_fedora . -podman build --platform linux/amd64 -f Containerfile.debian -t ${IMAGE}_debian . -podman build --platform linux/amd64 -f Containerfile.ubuntu -t ${IMAGE}_ubuntu . +#podman build --platform linux/amd64 -f Containerfile.el9 -t ${IMAGE}_el9 . +podman build --platform linux/amd64 -f Containerfile.fedora -t ${IMAGE}_fedora . +#podman build --platform linux/amd64 -f Containerfile.debian -t ${IMAGE}_debian . +#podman build --platform linux/amd64 -f Containerfile.ubuntu -t ${IMAGE}_ubuntu . diff --git a/tests/test.sh b/tests/test.sh index d669072..9f8877f 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -1,14 +1,14 @@ #!/usr/bin/env zsh -podman run --rm -it -d --platform linux/amd64 --name packagetest -p 2222:22 packagetest -ansible-playbook test_not_local.yml -i inventory.yml -podman stop packagetest -podman run --rm -it -d --platform linux/amd64 --name packagetest -p 2222:22 packagetest -ansible-playbook test_not_local.yml -i inventory.yml -podman stop packagetest -podman run --rm -it -d --platform linux/amd64 --name packagetest -p 2222:22 packagetest -ansible-playbook test_not_local.yml -i inventory.yml -podman stop packagetest -podman run --rm -it -d --platform linux/amd64 --name packagetest -p 2222:22 packagetest +podman run --rm -it -d --platform linux/amd64 --name packagetest_fedora -p 2222:22 packagetest ansible-playbook test_not_local.yml -i inventory.yml podman stop packagetest +# podman run --rm -it -d --platform linux/amd64 --name packagetest -p 2222:22 packagetest +# ansible-playbook test_not_local.yml -i inventory.yml +# podman stop packagetest +# podman run --rm -it -d --platform linux/amd64 --name packagetest -p 2222:22 packagetest +# ansible-playbook test_not_local.yml -i inventory.yml +# podman stop packagetest +# podman run --rm -it -d --platform linux/amd64 --name packagetest -p 2222:22 packagetest +# ansible-playbook test_not_local.yml -i inventory.yml +# podman stop packagetest