From 2f3690adedcc1347467f102f5632bffbbc8136d8 Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Fri, 24 Jan 2025 23:23:24 -0700 Subject: [PATCH] clean up, refactor, documentation - reducing amount of splitting in configs - documenting configuration --- CONFIG.md | 50 ++++++ README.md | 54 ++++-- {tasks/build/files => files}/neovide/icon.png | Bin files/neovide/neovide.desktop | 8 + tasks/build/files/neovide/neovide.desktop | 8 - tasks/build/go.yml | 16 +- tasks/build/neovide.yml | 14 +- tasks/build/neovim.yml | 85 ++++++---- tasks/pkgs/alacritty.yml | 6 +- tasks/pkgs/ansible.yml | 1 - tasks/pkgs/carapace.yml | 4 +- tasks/pkgs/consul.yml | 14 +- tasks/pkgs/git.yml | 10 +- tasks/pkgs/go.yml | 6 + tasks/pkgs/hashicorp_repo.yml | 10 +- tasks/pkgs/kitty.yml | 4 +- tasks/pkgs/neovide.yml | 9 +- tasks/pkgs/neovim.yml | 32 +--- tasks/pkgs/nerdfonts.yml | 4 +- tasks/pkgs/rust.yml | 4 +- tasks/pkgs/tmux.yml | 1 - tasks/set_vars.yml | 127 -------------- vars/alacritty.yml | 9 +- vars/carapace.yml | 8 +- vars/consul.yml | 5 - vars/git.yml | 7 +- vars/go.yml | 18 +- vars/hashicorp_repo.yml | 6 +- vars/kitty.yml | 7 +- vars/main.yml | 14 +- vars/neovide.yml | 14 +- vars/neovim.yml | 14 +- vars/nerdfonts.yml | 155 ++++++++++++++++-- vars/rust.yml | 8 +- 34 files changed, 425 insertions(+), 307 deletions(-) create mode 100644 CONFIG.md rename {tasks/build/files => files}/neovide/icon.png (100%) create mode 100644 files/neovide/neovide.desktop delete mode 100644 tasks/build/files/neovide/neovide.desktop delete mode 100644 tasks/set_vars.yml delete mode 100644 vars/consul.yml diff --git a/CONFIG.md b/CONFIG.md new file mode 100644 index 0000000..bb9f208 --- /dev/null +++ b/CONFIG.md @@ -0,0 +1,50 @@ +Package Configuration +===================== + +The following are individual packages that have configuration +and the default configuration values. + +Change the configuration by passing the variable when calling +the role. + +Packages +-------- + +```yaml +pkgconfig: + alacritty: + version: 0.15.0 + carapace: + version: 1.1.1 + git: + pkgs: #this example is for linux, homebrew names are used when on MacOS + - git + - git-delta + - git-email + - git-lfs + go: + version: 1.23.5 + install_path: /usr/local + neovide: + version: 0.14.0 + install_prefix: /usr/local + neovim: + use_syspkg: true #if false, will install the appimage + use_appimage: true #if false, will build from source + #used for appimage and source installs only + version: v0.10.3 + install_prefix: /usr/local #binaries will be placed in /bin + install_dir: /opt/nvim #where to put appimages + become: true #set to false if installing in the default user prefix + owner: root #who owns the installed packages. Determines become_user + group: root + build_type: Release #CMAKE build type + nerdfonts: + system_install: false #if true, install fonts system wide + install: #list of nerdfonts to install. Maps to brew names on macos + - CascadiaCode + - FiraCode + - HaskLig + rust: + rustup_managed: false #rustup isn't implemented yet +``` diff --git a/README.md b/README.md index 225dd44..e4bf622 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,70 @@ Role Name ========= -A brief description of the role goes here. +Manage package installation for a number of packages +that sometimes need special handling. Some are built from +source, some are appimages, some are special sources like +`cargo`, `npm`, `go`, etc. + +When defining a workstation role, I had a lot of packages that needed +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: + +- 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 Requirements ------------ -Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. Role Variables -------------- -A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. +- 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 ------------ -A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. Example Playbook ---------------- -Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: - - - hosts: servers - roles: - - { role: username.rolename, x: 42 } License ------- -BSD +MIT Author Information ------------------ -An optional section for the role authors to include contact information, or a website (HTML is not allowed). +- Matthew Stobbs diff --git a/tasks/build/files/neovide/icon.png b/files/neovide/icon.png similarity index 100% rename from tasks/build/files/neovide/icon.png rename to files/neovide/icon.png diff --git a/files/neovide/neovide.desktop b/files/neovide/neovide.desktop new file mode 100644 index 0000000..61be3c5 --- /dev/null +++ b/files/neovide/neovide.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Exec={{ pkgconfig.neovide.install_prefix }}/bin/neovide +Name=Neovide +Icon={{ pkgconfig.neovide.install_prefix }}/share/icons/neovide.png diff --git a/tasks/build/files/neovide/neovide.desktop b/tasks/build/files/neovide/neovide.desktop deleted file mode 100644 index 86f95a2..0000000 --- a/tasks/build/files/neovide/neovide.desktop +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Exec={{ _neovide.install_prefix }}/bin/neovide -Name=Neovide -Icon={{ _neovide.install_prefix }}/share/icons/neovide.png diff --git a/tasks/build/go.yml b/tasks/build/go.yml index 7d2dd56..2bd91ed 100644 --- a/tasks/build/go.yml +++ b/tasks/build/go.yml @@ -1,8 +1,4 @@ --- -- ansible.builtin.include_vars: - file: go.yml - name: _go - - name: check go version ansible.builtin.command: cmd: "go version" @@ -10,15 +6,15 @@ ignore_errors: true - name: install/update go - when: "'{{ _go.version }}' not in r_go_version.stdout" + when: "'{{ pkgconfig.go.version }}' not in r_go_version.stdout" block: - name: set go arch ansible.builtin.set_fact: - arch: "{{ _go.archmap[ansible_architecture] }}" + arch: "{{ pkgconfig.go.archmap[ansible_architecture] }}" - name: set go archive filename ansible.builtin.set_fact: - go_archive: "go{{ _go.version }}.{{ ansible_system | lower }}-{{ arch }}.{{ _go.extmap[ansible_system] }}" + go_archive: "go{{ pkgconfig.go.version }}.{{ ansible_system | lower }}-{{ arch }}.{{ pkgconfig.go.extmap[ansible_system] }}" tags: - dev - go @@ -35,7 +31,7 @@ ansible.builtin.get_url: dest: "{{ d_go_dl_tmp.path }}/{{ go_archive }}" url: "https://go.dev/dl/{{ go_archive }}" - checksum: "{{ _go[_go.version][ansible_system][arch] }}" + checksum: "{{ pkgconfig.go[pkgconfig.go.version][ansible_system][arch] }}" decompress: false tags: - dev @@ -44,12 +40,12 @@ - name: ensure go install dir exists become: true ansible.builtin.file: - path: "{{ _go.install_path }}" + path: "{{ pkgconfig.go.install_path }}" state: directory - name: extract go package ansible.builtin.unarchive: - dest: "{{ _go.install_path }}" + dest: "{{ pkgconfig.go.install_path }}" src: "{{ d_go_dl_tmp.path }}/{{ go_archive }}" remote_src: true when: ansible_system == 'Linux' diff --git a/tasks/build/neovide.yml b/tasks/build/neovide.yml index 9f128a5..2bbc9c8 100644 --- a/tasks/build/neovide.yml +++ b/tasks/build/neovide.yml @@ -1,8 +1,4 @@ --- -- ansible.builtin.include_vars: - file: neovide.yml - name: _neovide - - name: build and install neovide become: true ansible.builtin.command: @@ -10,20 +6,20 @@ - cargo - install - --root - - "{% if ansible_os_family != 'Linux' %}.{% else %}{{ _neovide.install_prefix }}" + - "{% if ansible_os_family != 'Linux' %}.{% else %}{{ pkgconfig.neovide.install_prefix }}" - --git - - https://github.com/neovide/neovide.git + - "{{ pkgconfig.neovide.git_repo }}" - --tag - - "{{ _neovide.version }}" + - "{{ pkgconfig.neovide.version }}" - name: Copy neovide icon become: true ansible.builtin.copy: src: neovide/icon.png - dest: "{{ _neovide.install_prefix }}/share/icons/neovide.png" + dest: "{{ pkgconfig.neovide.install_prefix }}/share/icons/neovide.png" - name: Copy neovide.desktop become: true ansible.builtin.templatefile: src: neovide/neovide.desktop - dest: "{{ _neovide.install_prefix }}/share/applications/neovide.desktop" + dest: "{{ pkgconfig.neovide.install_prefix }}/share/applications/neovide.desktop" diff --git a/tasks/build/neovim.yml b/tasks/build/neovim.yml index b147b9e..7a26346 100644 --- a/tasks/build/neovim.yml +++ b/tasks/build/neovim.yml @@ -1,36 +1,55 @@ -- ansible.builtin.include_vars: - file: neovim.yml - name: _neovim - -- 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: "{{ _neovim.git_repo }}" - version: "v{{ _neovim.version }}" - -- name: build neovim - ansible.builtin.command: - chdir: "{{ d_nvim_tmp.path }}/neovim" - cmd: - - make - - "CMAKE_BUILD_Type={{ _neovim.build_type }}" - - "CMAKE_INSTALL_PREFIX={{ _neovim.install_prefix }}" +--- +- 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.become }}" + become_user: "{% if pkgconfig.neovim.become %}{{ pkgconfig.neovim.owner }}{% else %}~{% endif %}" + when: not pkgconfig.neovim.use_appimage - name: install neovim appimage - become: true - ansible.builtin.get_url: - url: https://github.com/neovim/neovim/releases/download/v{{ _neovim.version }}/nvim.appimage - dest: /usr/local/bin/nvim - checksum: sha256:6a021e9465fe3d3375e28c3e94c1c2c4f7d1a5a67e4a78cf52d18d77b1471390 - tags: - - RedHat - - linux - - package + 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.become }}" + become_user: "{% if pkgconfig.neovim.become %}{{ pkgconfig.neovim.owner }}{% else %}~{% endif %}" diff --git a/tasks/pkgs/alacritty.yml b/tasks/pkgs/alacritty.yml index fdc0813..4539c8f 100644 --- a/tasks/pkgs/alacritty.yml +++ b/tasks/pkgs/alacritty.yml @@ -2,20 +2,22 @@ - 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 when: ansible_system == 'Linux' block: - name: install rust and cargo ansible.builtin.include_tasks: - file: "pkgs/{{ ansible_os_family }}/rust.yml" + file: "pkgs/rust.yml" tags: - rust - dependency - name: append to pkgs set_fact: - syspkgs: "{{ syspkgs + _alacritty[ansible_distribution].build_deps }}" + syspkgs: "{{ syspkgs + pkgconfig.alacritty.build_deps[ansible_distribution] }}" srcpkgs: "{{ srcpkgs + [ 'alacritty' ] }}" tags: - syspkgs diff --git a/tasks/pkgs/ansible.yml b/tasks/pkgs/ansible.yml index 16a28b6..f5ab41b 100644 --- a/tasks/pkgs/ansible.yml +++ b/tasks/pkgs/ansible.yml @@ -3,4 +3,3 @@ - name: append to pkgs set_fact: syspkgs: "{{ syspkgs + [ 'ansible' ] }}" - diff --git a/tasks/pkgs/carapace.yml b/tasks/pkgs/carapace.yml index 18f9d22..7dffb2b 100644 --- a/tasks/pkgs/carapace.yml +++ b/tasks/pkgs/carapace.yml @@ -2,6 +2,8 @@ - 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 ansible.builtin.yum_repository: @@ -24,4 +26,4 @@ - name: add carapace to syspkgs ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + _carapace[ansible_system].pkgs }}" + syspkgs: "{{ syspkgs + pkgconfig.carapace.pkgs[ansible_system] }}" diff --git a/tasks/pkgs/consul.yml b/tasks/pkgs/consul.yml index 9ab84dc..8c66369 100644 --- a/tasks/pkgs/consul.yml +++ b/tasks/pkgs/consul.yml @@ -1,12 +1,14 @@ +# load hashicorp configuration --- -- ansible.builtin.include_vars: - file: hashicorp_repo.yml - name: _hashicorp - - name: ensure hashicorp repo is active ansible.builtin.include_tasks: file: "pkgs/hashicorp_repo.yml" -- name: append to pkgs +- name: append to syspkgs set_fact: - tappkgs: "{{ tappkgs + [ _hashicorp.consul[ansible_os_family] ] }}" + syspkgs: "{{ syspkgs + [ pkgconfig.hashicorp.consul[ansible_system] ] }}" + when: ansible_system == 'Linux' + +- set_fact: + tappkgs: "{{ tappkgs + [ pkgconfig.hashicorp.consul[ansible_system] ] }}" + when: ansible_system == 'Darwin' diff --git a/tasks/pkgs/git.yml b/tasks/pkgs/git.yml index 777d3b6..1c27c13 100644 --- a/tasks/pkgs/git.yml +++ b/tasks/pkgs/git.yml @@ -2,12 +2,12 @@ - ansible.builtin.include_vars: file: git.yml name: _git +- ansible.builtin.set_fact: + pkgconfig.git: "{{ _git | ansible.builtin.combine(pkgconfig.git) }}" +- ansible.builtin.set_fact: + pkgconfig.git.pkgs: "{{ pkgconfig.git.pkgs[ansible_system] }}" - name: append to pkgs set_fact: - syspkgs: "{{ syspkgs + _git[ansible_system].pkgs }}" - tags: - - RedHat - - linux - - package + syspkgs: "{{ syspkgs + pkgconfig.git.pkgs }}" diff --git a/tasks/pkgs/go.yml b/tasks/pkgs/go.yml index cb25672..d6e1039 100644 --- a/tasks/pkgs/go.yml +++ b/tasks/pkgs/go.yml @@ -1,4 +1,10 @@ --- +- 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 set_fact: srcpkgs: "{{ srcpkgs + [ 'go' ] }}" diff --git a/tasks/pkgs/hashicorp_repo.yml b/tasks/pkgs/hashicorp_repo.yml index cd42505..460a013 100644 --- a/tasks/pkgs/hashicorp_repo.yml +++ b/tasks/pkgs/hashicorp_repo.yml @@ -2,6 +2,8 @@ - ansible.builtin.include_vars: file: hashicorp_repo.yml name: _hashicorp +- ansible.builtin.set_fact: + pkgconfig.hashicorp: "{{ _hashicorp | ansible.builtin.combine(pkgonfig.hashicorp) }}" - name: RedHat repository when: ansible_os_family == 'RedHat' @@ -13,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={{ _hashicorp.Linux.Fedora.repo }}" + cmd: "dnf config-manager addrepo --from-repofile={{ pkgconfig.hashicorp.Linux.Fedora.repo }}" - name: enable hashicorp repo for fedora <41 become: true @@ -22,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 {{ _hashicorp.Linux.Fedora.repo }}" + cmd: "dnf config-manager --add-repo {{ pkgconfig.hashicorp.Linux.Fedora.repo }}" - name: enable hashicorp repo for RHEL like distribution become: true @@ -30,7 +32,7 @@ - ansible_distribution != 'Fedora' ansible.builtin.command: creates: /etc/yum.repos.d/hashicorp.repo - cmd: "dnf config-manager --add-repo {{ _hashicorp.Linux.RedHat.repo }}" + cmd: "dnf config-manager --add-repo {{ pkgconfig.hashicorp.Linux.RedHat.repo }}" - name: Debian based repository when: ansible_os_family == 'Debian' @@ -57,7 +59,7 @@ - name: enable hasicorp repo for debian ansible.builtin.apt_repository: - repo: "{{ _hashicorp.Linux.Debian.repo }}" + repo: "{{ pkgconfig.hashicorp.Linux.Debian.repo }}" state: present update_cache: false diff --git a/tasks/pkgs/kitty.yml b/tasks/pkgs/kitty.yml index d70a05b..0c08118 100644 --- a/tasks/pkgs/kitty.yml +++ b/tasks/pkgs/kitty.yml @@ -2,7 +2,9 @@ - ansible.builtin.include_vars: file: kitty.yml name: _kitty +- ansible.builtin.set_fact: + pkgconfig.kitty: "{{ _kitty | ansible.builtin.combine(pkgconfig.kitty) }}" - name: add to syspkgs ansible.builtin.set_fact: - syspkgs: "{{ syspkgs + _kitty[ansible_system].pkgs }}" + syspkgs: "{{ syspkgs + pkgconfig.kitty.pkgs[ansible_system] }}" diff --git a/tasks/pkgs/neovide.yml b/tasks/pkgs/neovide.yml index aa8669b..2ebd912 100644 --- a/tasks/pkgs/neovide.yml +++ b/tasks/pkgs/neovide.yml @@ -2,11 +2,18 @@ - 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/{{ pkgdep }}.yml" + loop: "{{ pkgconfig.neovide.local_deps }}" + loop_control: + loop_var: pkgdep - name: append to pkgs when: ansible_system == 'Linux' set_fact: - syspkgs: "{{ syspkgs + _neovide[ansible_os_family].pkgdeps }}" + syspkgs: "{{ syspkgs + pkgconfig.neovide.pkgdeps[ansible_os_family] }}" srcpkgs: "{{ srcpkgs + [ 'neovide' ] }}" - name: append neovide to caskpkgs diff --git a/tasks/pkgs/neovim.yml b/tasks/pkgs/neovim.yml index a4eff0f..d6de44a 100644 --- a/tasks/pkgs/neovim.yml +++ b/tasks/pkgs/neovim.yml @@ -2,33 +2,15 @@ - ansible.builtin.include_vars: file: neovim.yml name: _neovim +- ansible.builtin.set_fact: + pkgconfig.neovim: "{{ _neovim | ansible.builtin.combine(pkgconfig.neovim) }}" -- name: linux installation - when: ansible_system == 'Linux' - block: - - name: ensure install dir exists - ansible.builtin.file: - state: directory - path: "{{ _neovim.install_dir }}" - - - name: install neovim appimage - ansible.builtin.get_url: - backup: true - url: "{{ _neovim[ansible_system].appimage.dl }}" - dest: "{{ _neovim.install_dir }}/nvim.appimage" - mode: "0755" - owner: root - group: root - checksum: "{{ _neovim[ansible_system].appimage.checksum }}" - - - name: link neovim to prefix bin - ansible.builtin.file: - state: link - src: "{{ _neovim.install_dir }}/nvim.appimage }}" - path: "{{ _neovim.install_prefix }}/bin/nvim }}" +- name: append neovim to srcpkgs + when: not pkgconfig.neovim.use_syspkg + set_fact: + srcpkgs: "{{ srcpkgs + ['neovim'] }}" - name: append neovim to syspkgs - when: ansible_system == 'Darwin' + when: pkgconfig.neovim.use_syspkg set_fact: syspkgs: "{{ syspkgs + ['neovim'] }}" - diff --git a/tasks/pkgs/nerdfonts.yml b/tasks/pkgs/nerdfonts.yml index 0174b24..f40dbf8 100644 --- a/tasks/pkgs/nerdfonts.yml +++ b/tasks/pkgs/nerdfonts.yml @@ -2,6 +2,8 @@ - ansible.builtin.include_vars: file: nerdfonts.yml name: _nerdfonts +- ansible.builtin.set_fact: + pkgconfig.nerdfonts: "{{ _nerdfonts | ansible.builtin.combine(pkgconfig.nerdfons) }}" - name: append to srcpkgs when: ansible_system == 'Linux' @@ -12,6 +14,6 @@ when: ansible_system == 'Darwin' set_fact: caskpkgs: "{{ caskpkgs + [ 'font-' + font.brew + '-nerd-font' ] }}" - loop: "{{ _nerdfonts.fonts }}" + loop: "{{ pkgconfig.nerdfonts.fonts }}" loop_control: loop_var: font diff --git a/tasks/pkgs/rust.yml b/tasks/pkgs/rust.yml index 5262d2b..176e411 100644 --- a/tasks/pkgs/rust.yml +++ b/tasks/pkgs/rust.yml @@ -2,9 +2,11 @@ - 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 set_fact: - syspkgs: "{{ syspkgs + _rust[ansible_system].pkgs }}" + syspkgs: "{{ syspkgs + _rust.pkgs[ansible_system] }}" tags: - packages diff --git a/tasks/pkgs/tmux.yml b/tasks/pkgs/tmux.yml index f093a48..486ceb9 100644 --- a/tasks/pkgs/tmux.yml +++ b/tasks/pkgs/tmux.yml @@ -1,5 +1,4 @@ --- - - name: append to pkgs set_fact: syspkgs: "{{ syspkgs + [ 'tmux' ] }}" diff --git a/tasks/set_vars.yml b/tasks/set_vars.yml deleted file mode 100644 index 423c95e..0000000 --- a/tasks/set_vars.yml +++ /dev/null @@ -1,127 +0,0 @@ -# load namespaced variables and merge with passed in values ---- -- ansible.builtin.include_vars: - file: alacritty.yml - name: _alacritty -- ansible.builtin.set_fact: - pkgconfig.alacritty: "{{ _alacritty | ansible.builtin.combine(pkgconfig.alacritty) }}" - -- ansible.builtin.include_vars: - file: carapace.yml - name: _carapace -- ansible.builtin.set_fact: - pkgconfig.carapace: "{{ _carapace | ansible.builtin.combine(pkgconfig.carapace) }}" - -- ansible.builtin.include_vars: - file: consul.yml - name: _consul -- ansible.builtin.set_fact: - pkgconfig.consul: "{{ _consul | ansible.builtin.combine(pkgconfig.consul) }}" - -- ansible.builtin.include_vars: - file: git.yml - name: _git -- ansible.builtin.set_fact: - pkgconfig.git: "{{ _git | ansible.builtin.combine(pkgconfig.git) }}" - -- ansible.builtin.include_vars: - file: go.yml - name: _go -- ansible.builtin.set_fact: - pkgconfig.go: "{{ _go | ansible.builtin.combine(pkgconfig.go) }}" - -- ansible.builtin.include_vars: - file: hashicorp_repo.yml - name: _hashicorp_repo -- ansible.builtin.set_fact: - pkgconfig.hashicorp_repo: "{{ _hashicorp_repo | ansible.builtin.combine(pkgconfig.hashicorp_repo) }}" - -- ansible.builtin.include_vars: - file: kitty.yml - name: _kitty -- ansible.builtin.set_fact: - pkgconfig.kitty: "{{ _kitty | ansible.builtin.combine(pkgconfig.kitty) }}" - -- ansible.builtin.include_vars: - file: neovide.yml - name: _neovide -- ansible.builtin.set_fact: - pkgconfig.neovide: "{{ _neovide | ansible.builtin.combine(pkgconfig.neovide) }}" - -- ansible.builtin.include_vars: - file: neovim.yml - name: _neovim -- ansible.builtin.set_fact: - pkgconfig.neovim: "{{ _neovim | ansible.builtin.combine(pkgconfig.neovim) }}" - -- ansible.builtin.include_vars: - file: nerdfonts.yml - name: _nerdfonts -- ansible.builtin.set_fact: - pkgconfig.nerdfonts: "{{ _nerdfonts | ansible.builtin.combine(pkgconfig.nerdfonts) }}" - -- ansible.builtin.include_vars: - file: nodejs.yml - name: _nodejs -- ansible.builtin.set_fact: - pkgconfig.nodejs: "{{ _nodejs | ansible.builtin.combine(pkgconfig.nodejs) }}" - -- ansible.builtin.include_vars: - file: nomad.yml - name: _nomad -- ansible.builtin.set_fact: - pkgconfig.nomad: "{{ _nomad | ansible.builtin.combine(pkgconfig.nomad) }}" - -- ansible.builtin.include_vars: - file: nushell.yml - name: _nushell -- ansible.builtin.set_fact: - pkgconfig.nushell: "{{ _nushell | ansible.builtin.combine(pkgconfig.nushell) }}" - -- ansible.builtin.include_vars: - file: packer.yml - name: _packer -- ansible.builtin.set_fact: - pkgconfig.packer: "{{ _packer | ansible.builtin.combine(pkgconfig.packer) }}" - -- ansible.builtin.include_vars: - file: python3.yml - name: _python3 -- ansible.builtin.set_fact: - pkgconfig.python3: "{{ _python3 | ansible.builtin.combine(pkgconfig.python3) }}" - -- ansible.builtin.include_vars: - file: rust.yml - name: _rust -- ansible.builtin.set_fact: - pkgconfig.rust: "{{ _rust | ansible.builtin.combine(pkgconfig.rust) }}" - -- ansible.builtin.include_vars: - file: terraform.yml - name: _terraform -- ansible.builtin.set_fact: - pkgconfig.terraform: "{{ _terraform | ansible.builtin.combine(pkgconfig.terraform) }}" - -- ansible.builtin.include_vars: - file: terrarepo.yml - name: _terrarepo -- ansible.builtin.set_fact: - pkgconfig.terrarepo: "{{ _terrarepo | ansible.builtin.combine(pkgconfig.terrarepo) }}" - -- ansible.builtin.include_vars: - file: tidy.yml - name: _tidy -- ansible.builtin.set_fact: - pkgconfig.tidy: "{{ _tidy | ansible.builtin.combine(pkgconfig.tidy) }}" - -- ansible.builtin.include_vars: - file: zfs.yml - name: _zfs -- ansible.builtin.set_fact: - pkgconfig.zfs: "{{ _zfs | ansible.builtin.combine(pkgconfig.zfs) }}" - -- ansible.builtin.include_vars: - file: zig.yml - name: _zig -- ansible.builtin.set_fact: - pkgconfig.zig: "{{ _zig | ansible.builtin.combine(pkgconfig.zig) }}" diff --git a/vars/alacritty.yml b/vars/alacritty.yml index 62a1c11..38548fe 100644 --- a/vars/alacritty.yml +++ b/vars/alacritty.yml @@ -1,15 +1,16 @@ --- version: 0.15.0 -RedHat: - build_deps: + +# variables that aren't really configuration +build_deps: + RedHat: - cmake - freetype-devel - fontconfig-devel - libxcb-devel - libxkbcommon-devel - g++ -Debian: - build_deps: + Debian: - cmake - pkg-config - libfreetype6-dev diff --git a/vars/carapace.yml b/vars/carapace.yml index 1583721..3505a43 100644 --- a/vars/carapace.yml +++ b/vars/carapace.yml @@ -1,8 +1,8 @@ --- version: 1.1.1 -Linux: - pkgs: + +pkgs: + Linux: - carapace-bin -Darwin: - pkgs: + Darwin: - carapace diff --git a/vars/consul.yml b/vars/consul.yml deleted file mode 100644 index b32ade9..0000000 --- a/vars/consul.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -Linux: - pkg: consul -Darwin: - pkg: hashicorp/tap/consul diff --git a/vars/git.yml b/vars/git.yml index 0cd0fa5..a5cedb8 100644 --- a/vars/git.yml +++ b/vars/git.yml @@ -1,11 +1,10 @@ -Darwin: - pkgs: +pkgs: + Darwin: - git - git-delta - git-extras - git-lfs -Linux: - pkgs: + Linux: - git - git-delta - git-email diff --git a/vars/go.yml b/vars/go.yml index 7f6a136..e8a6d4e 100644 --- a/vars/go.yml +++ b/vars/go.yml @@ -1,13 +1,8 @@ --- version: 1.23.5 install_path: /usr/local -archmap: - arm64: arm64 - aarch64: arm64 - x86_64: amd64 -extmap: - Darwin: pkg - Linux: tar.gz + +# checksums by version and ansible_system 1.23.5: Darwin: arm64: sha256:f819ed94939e08a5016b9a607ec84ebbde6cb3fe59750c59d97aa300c3fd02df @@ -15,3 +10,12 @@ extmap: Linux: amd64: sha256:cbcad4a6482107c7c7926df1608106c189417163428200ce357695cc7e01d091 arm64: sha256:47c84d332123883653b70da2db7dd57d2a865921ba4724efcdf56b5da7021db0 + +# maps used in variables +archmap: + arm64: arm64 + aarch64: arm64 + x86_64: amd64 +extmap: + Darwin: pkg + Linux: tar.gz diff --git a/vars/hashicorp_repo.yml b/vars/hashicorp_repo.yml index 4561127..e5b5a82 100644 --- a/vars/hashicorp_repo.yml +++ b/vars/hashicorp_repo.yml @@ -1,10 +1,10 @@ --- Linux: - RedHat: + RedHat: &redhat repo: https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo - Fedora: + Fedora: &fedora repo: https://rpm.releases.hashicorp.com/fedora/hashicorp.repo - Debian: + 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" consul: Linux: consul diff --git a/vars/kitty.yml b/vars/kitty.yml index 2ef3fc0..4a04118 100644 --- a/vars/kitty.yml +++ b/vars/kitty.yml @@ -1,7 +1,6 @@ -Darwin: - pkgs: +pkgs: + Darwin: - kitty -Linux: - pkgs: + Linux: - kitty - kitty-shell-integration diff --git a/vars/main.yml b/vars/main.yml index 5023e48..5bc8129 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,8 +1,13 @@ # variables used in ansible_role_package --- -assume_missing_is_syspkg: false +assume_missing_is_syspkg: true full_upgrade: false install_state: present +default_confg: + install_prefix: /usr/local + become: true + owner: root + group: root # install lists brewtaps: [] @@ -16,14 +21,17 @@ srcpkgs: [] syspkgs: [] tappkgs: [] -# namespaced package variables +# pkgconfig, loaded from .yml files in vars +# and combined. Configuration can be changed +# when running the role by specifying +# pkgconfig. as a dict pkgconfig: alacritty: {} carapace: {} consul: {} git: {} go: {} - hashicorp_repo: {} + hashicorp: {} kitty: {} neovide: {} neovim: {} diff --git a/vars/neovide.yml b/vars/neovide.yml index 2099205..3c7ebff 100644 --- a/vars/neovide.yml +++ b/vars/neovide.yml @@ -1,9 +1,13 @@ --- version: 0.14.0 install_prefix: /usr/local -RedHat: - pkgdeps: - - cargo + +#required variables +git_repo: https://github.com/neovide/neovide.git +local_deps: + - rust +pkgdeps: + RedHat: - fontconfig-devel - freetype-devel - libX11-xcb @@ -12,9 +16,7 @@ RedHat: - libstdc++-devel - "@Development Tools" - "@Development Libraries" -Debian: - pkgdeps: - - cargo + Debian: - fontconfig-devel - freetype-devel - libX11-xcb diff --git a/vars/neovim.yml b/vars/neovim.yml index ecee415..68a0b00 100644 --- a/vars/neovim.yml +++ b/vars/neovim.yml @@ -1,8 +1,12 @@ --- -version: latest +version: v0.10.3 install_prefix: /usr/local install_dir: /opt/nvim -Linux: - appimage: - dl: https://github.com/neovim/neovim/releases/latest/download/nvim.appimage - checksum: https://github.com/neovim/neovim/releases/download/latest/nvim.appimage.sha256sum +use_appimage: true +use_syspkg: true +build_type: Release +become: true +git_repo: https://github.com/neovim/neovim +appimage_url_pfx: https://github.com/neovim/neovim/releases/download +owner: root +group: root diff --git a/vars/nerdfonts.yml b/vars/nerdfonts.yml index 86f98af..fc0b731 100644 --- a/vars/nerdfonts.yml +++ b/vars/nerdfonts.yml @@ -1,15 +1,148 @@ --- +install: + - CascadiaCode + - FiraCode + - Hasklig + - Lilex + - Monoid + - NerdFontsSymbolsOnly +system_install: false + +#mapping of fonts fonts: - - name: CascadiaCode - brew: caskaydia-cove - - name: FiraCode - brew: fira-code - - name: Hasklig + 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: hasklug - - name: Lilex - brew: lilex - - name: Monoid - brew: monoid - - name: NerdFontsSymbolsOnly + 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: symbols-only -nerdfonts_system_install: false + 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 diff --git a/vars/rust.yml b/vars/rust.yml index 8a4ffbe..84de65a 100644 --- a/vars/rust.yml +++ b/vars/rust.yml @@ -1,7 +1,7 @@ -Darwin: - pkgs: +rustup_managed: false +pkgs: + Darwin: - rust -Linux: - pkgs: + Linux: - rustc - cargo