clean up, refactor, documentation

- reducing amount of splitting in configs
- documenting configuration
This commit is contained in:
Matthew Stobbs
2025-01-24 23:23:24 -07:00
parent f8585192d5
commit 2f3690aded
34 changed files with 425 additions and 307 deletions

View File

@@ -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

View File

@@ -3,4 +3,3 @@
- name: append to pkgs
set_fact:
syspkgs: "{{ syspkgs + [ 'ansible' ] }}"

View File

@@ -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] }}"

View File

@@ -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'

View File

@@ -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 }}"

View File

@@ -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' ] }}"

View File

@@ -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

View File

@@ -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] }}"

View File

@@ -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

View File

@@ -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'] }}"

View File

@@ -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

View File

@@ -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

View File

@@ -1,5 +1,4 @@
---
- name: append to pkgs
set_fact:
syspkgs: "{{ syspkgs + [ 'tmux' ] }}"