start developing module for go_install
not going to be used for a long time Making pkg tasks truly single file
This commit is contained in:
141
library/go_install.py
Normal file
141
library/go_install.py
Normal file
@@ -0,0 +1,141 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# Copyright: (c) 2026, Matthew Stobbs <matthew@sprouting.cloud>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
DOCUMENTATION = r'''
|
||||
---
|
||||
module: go_install
|
||||
|
||||
short_description: Manage the installation and removal of go packages
|
||||
description: Manage the installation and removal of go packages using `go install`
|
||||
|
||||
options:
|
||||
name:
|
||||
description:
|
||||
- Name of the go package without the module part.
|
||||
- This is the name of the executable that is installed in `bin`.
|
||||
required: true
|
||||
type: str
|
||||
module:
|
||||
description:
|
||||
- The full module name (example.org/path/to/module)
|
||||
- Only required if state != 'absent'
|
||||
required: false
|
||||
type: str
|
||||
version:
|
||||
description:
|
||||
- The version of the module to install.
|
||||
- Do not set this to '/v2' if you are using a '/v2' module, normally just latest.
|
||||
- Defaults to 'latest'
|
||||
required: false
|
||||
type: str
|
||||
state:
|
||||
description:
|
||||
- One of either 'present', 'latest' or 'absent'.
|
||||
- Defaults to 'present'
|
||||
require: false
|
||||
type: str
|
||||
author:
|
||||
- Matthew Stobbs <matthew@sprouting.cloud>
|
||||
'''
|
||||
|
||||
EXAMPLES = r'''
|
||||
# Install the 'air' package at the latest version
|
||||
- name: Install package 'air'
|
||||
go_install:
|
||||
name: air
|
||||
module: github.com/air-verse/air
|
||||
state: latest
|
||||
|
||||
# Remove the 'air' package
|
||||
- name: Install package 'air'
|
||||
go_install:
|
||||
name: air
|
||||
state: absent
|
||||
|
||||
# Install the 'pgx' package of /v5
|
||||
- name: Install package 'pgx'
|
||||
go_install:
|
||||
name: pgx
|
||||
module: github.com/jackc/pgx/v5
|
||||
|
||||
# Install the 'templ' package at a specific version
|
||||
- name: Install package 'templ' at version 0.3.906
|
||||
go_install:
|
||||
name: templ
|
||||
module: github.com/a-h/templ/cmd/templ
|
||||
version: v0.3.906
|
||||
'''
|
||||
|
||||
RETURN = r'''
|
||||
# After installing air
|
||||
result: "installed github.com/air-verse/air@latest to /usr/local/bin/air"
|
||||
|
||||
# After removing air
|
||||
result: "removed /usr/local/bin/air"
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
def run_module():
|
||||
# define available arguments/parameters a user can pass to the module
|
||||
module_args = dict(
|
||||
name=dict(type='str', required=True),
|
||||
module=dict(type='str', required=False, default="")
|
||||
version=dict(type='str', required=False, default="latest")
|
||||
state=dict(type='str', required=False, default="present")
|
||||
)
|
||||
|
||||
# seed the result dict in the object
|
||||
# we primarily care about changed and state
|
||||
# changed is if this module effectively modified the target
|
||||
# state will include any data that you want your module to pass back
|
||||
# for consumption, for example, in a subsequent task
|
||||
result = dict(
|
||||
changed=False,
|
||||
result=''
|
||||
)
|
||||
|
||||
# the AnsibleModule object will be our abstraction working with Ansible
|
||||
# this includes instantiation, a couple of common attr would be the
|
||||
# args/params passed to the execution, as well as if the module
|
||||
# supports check mode
|
||||
module = AnsibleModule(
|
||||
argument_spec=module_args,
|
||||
supports_check_mode=True
|
||||
)
|
||||
|
||||
# if the user is working with this module in only check mode we do not
|
||||
# want to make any changes to the environment, just return the current
|
||||
# state with no modifications
|
||||
if module.check_mode:
|
||||
module.exit_json(**result)
|
||||
|
||||
# manipulate or modify the state as needed (this is going to be the
|
||||
# part where your module will do what it needs to do)
|
||||
result['result'] = module.params['name']
|
||||
|
||||
# use whatever logic you need to determine whether or not this module
|
||||
# made any modifications to your target
|
||||
if module.params['new']:
|
||||
result['changed'] = True
|
||||
|
||||
# during the execution of the module, if there is an exception or a
|
||||
# conditional state that effectively causes a failure, run
|
||||
# AnsibleModule.fail_json() to pass in the message and the result
|
||||
if module.params['name'] == 'fail me':
|
||||
module.fail_json(msg='You requested this to fail', **result)
|
||||
|
||||
# in the event of a successful module execution, you will want to
|
||||
# simple AnsibleModule.exit_json(), passing the key/value results
|
||||
module.exit_json(**result)
|
||||
|
||||
|
||||
def main():
|
||||
run_module()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -1,10 +0,0 @@
|
||||
---
|
||||
# Purpose: bring the instance to the desired state by running the role under test.
|
||||
# Molecule calls this playbook with `molecule converge`.
|
||||
- name: Converge
|
||||
hosts: all
|
||||
gather_facts: true # Disable if your role does not rely on facts
|
||||
tasks:
|
||||
- name: Apply role under test
|
||||
ansible.builtin.include_role:
|
||||
name: yournamespace.yourcollection.yourrole
|
||||
@@ -1,35 +0,0 @@
|
||||
---
|
||||
- name: Create
|
||||
hosts: localhost
|
||||
connection: local
|
||||
gather_facts: false
|
||||
# no_log: "{{ molecule_no_log }}"
|
||||
tasks:
|
||||
# TODO: Developer must implement and populate 'server' variable
|
||||
|
||||
- name: Create instance config
|
||||
when: server.changed | default(false) | bool # noqa no-handler
|
||||
block:
|
||||
- name: Populate instance config dict # noqa jinja
|
||||
ansible.builtin.set_fact:
|
||||
instance_conf_dict: {}
|
||||
# instance': "{{ }}",
|
||||
# address': "{{ }}",
|
||||
# user': "{{ }}",
|
||||
# port': "{{ }}",
|
||||
# 'identity_file': "{{ }}", }
|
||||
with_items: "{{ server.results }}"
|
||||
register: instance_config_dict
|
||||
|
||||
- name: Convert instance config dict to a list
|
||||
ansible.builtin.set_fact:
|
||||
instance_conf: "{{ instance_config_dict.results | map(attribute='ansible_facts.instance_conf_dict') | list }}"
|
||||
|
||||
- name: Dump instance config
|
||||
ansible.builtin.copy:
|
||||
content: |
|
||||
# Molecule managed
|
||||
|
||||
{{ instance_conf | to_json | from_json | to_yaml }}
|
||||
dest: "{{ molecule_instance_config }}"
|
||||
mode: "0600"
|
||||
@@ -1,24 +0,0 @@
|
||||
---
|
||||
- name: Destroy
|
||||
hosts: localhost
|
||||
connection: local
|
||||
gather_facts: false
|
||||
# no_log: "{{ molecule_no_log }}"
|
||||
tasks:
|
||||
# Developer must implement.
|
||||
|
||||
# Mandatory configuration for Molecule to function.
|
||||
|
||||
- name: Populate instance config
|
||||
ansible.builtin.set_fact:
|
||||
instance_conf: {}
|
||||
|
||||
- name: Dump instance config
|
||||
ansible.builtin.copy:
|
||||
content: |
|
||||
# Molecule managed
|
||||
|
||||
{{ instance_conf | to_json | from_json | to_yaml }}
|
||||
dest: "{{ molecule_instance_config }}"
|
||||
mode: "0600"
|
||||
when: server.changed | default(false) | bool # noqa no-handler
|
||||
@@ -1,10 +0,0 @@
|
||||
---
|
||||
all:
|
||||
children:
|
||||
builders:
|
||||
hosts:
|
||||
fedora-test:
|
||||
ansible_host: fedora-test
|
||||
container_image: registry.fedoraproject.org/fedora:latest
|
||||
container_command: /sbin/init
|
||||
container_privileged: true
|
||||
@@ -1,47 +0,0 @@
|
||||
---
|
||||
# Dependency management (download roles/collections)
|
||||
dependency:
|
||||
name: galaxy
|
||||
options:
|
||||
requirements-file: ../requirements.yml
|
||||
|
||||
|
||||
ansible:
|
||||
cfg:
|
||||
defaults:
|
||||
host_key_checking: false
|
||||
verbosity: 1
|
||||
|
||||
executor:
|
||||
backend: ansible-playbook
|
||||
args:
|
||||
ansible_playbook:
|
||||
- --diff
|
||||
- --force-handlers
|
||||
- --inventory=/path/to/inventory.yml
|
||||
ansible_navigator:
|
||||
- --mode stdout
|
||||
- --pull-policy missing
|
||||
- --execution-environment-image ghcr.io/ansible/community-ansible-dev-tools:latest
|
||||
|
||||
playbooks:
|
||||
create: create.yml
|
||||
converge: converge.yml
|
||||
destroy: destroy.yml
|
||||
cleanup: cleanup.yml
|
||||
prepare: prepare.yml
|
||||
side_effect: side_effect.yml
|
||||
verify: verify.yml
|
||||
|
||||
scenario:
|
||||
name: fedora
|
||||
test_sequence:
|
||||
- dependency
|
||||
- syntax
|
||||
- create
|
||||
- prepare
|
||||
- converge
|
||||
- idempotence
|
||||
- verify
|
||||
- cleanup
|
||||
- destroy
|
||||
@@ -1,10 +0,0 @@
|
||||
---
|
||||
# Purpose: assert that the instance really ended up in the expected state.
|
||||
# Molecule calls this playbook with `molecule verify`.
|
||||
- name: Verify
|
||||
hosts: instance
|
||||
gather_facts: false # Quicker, if you do not need facts
|
||||
tasks:
|
||||
- name: Assert something
|
||||
ansible.builtin.assert:
|
||||
that: true
|
||||
@@ -1,4 +0,0 @@
|
||||
---
|
||||
collections:
|
||||
- name: containers.podman
|
||||
version: ">=1.10.0"
|
||||
@@ -1,11 +1,17 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
#
|
||||
## Helper: pipx.yml
|
||||
## Description: modular approach to installing pip applications
|
||||
## Variables:
|
||||
## name: the name of the pip package to install
|
||||
---
|
||||
- name: Install pipx {{ pkg }}
|
||||
become: "{{ ext_become }}"
|
||||
- name: Install pipx {{ pkg.name }}
|
||||
become: "{{ install_become }}"
|
||||
become_user: "{{ install_become_user }}"
|
||||
environment:
|
||||
PIPX_HOME: "{{ path.pipx }}"
|
||||
PIPX_BIN_DIR: "{{ path.bin }}"
|
||||
PIPX_HOME: "{{ path_pipx }}"
|
||||
PIPX_BIN_DIR: "{{ path_bin }}"
|
||||
community.general.pipx:
|
||||
executable: "{{ pipx_exec }}"
|
||||
name: "{{ pkg }}"
|
||||
name: "{{ pkg.name }}"
|
||||
state: latest
|
||||
|
||||
@@ -1,12 +1,24 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
# Package: air
|
||||
# Description: application auto reload for go
|
||||
# Version: latest
|
||||
# Methods:
|
||||
# - source (go install)
|
||||
# Helpers: go_install
|
||||
#
|
||||
## Package: air
|
||||
## Description: application auto reload for go
|
||||
## Version: latest
|
||||
## Methods:
|
||||
## - source (go install)
|
||||
## Helpers: go_install
|
||||
---
|
||||
# {{{ Configure air
|
||||
- name: Set air default facts # {{{
|
||||
ansible.builtin.set_fact:
|
||||
air:
|
||||
install_methods:
|
||||
- source
|
||||
install_files:
|
||||
- to: bin/air
|
||||
install_url: github.com/air-verse/air
|
||||
pkg_deps:
|
||||
- go
|
||||
air_version: "{{ air_version | default('latest')}}"
|
||||
# }}}
|
||||
- name: Start air configuration
|
||||
when:
|
||||
- "'air' not in __configured"
|
||||
@@ -24,14 +36,9 @@
|
||||
- name: Set air install package
|
||||
ansible.builtin.set_fact:
|
||||
air_go_pkg:
|
||||
url: "{{ air_install_url }}@{{ air_version }}"
|
||||
url: "{{ air.install_url }}@{{ air_version }}"
|
||||
bin: "{{ path_bin }}/air"
|
||||
# }}}
|
||||
# {{{ air build and install steps
|
||||
- name: Append air to pkg_go
|
||||
when:
|
||||
- air_install_method == 'source'
|
||||
block:
|
||||
|
||||
- name: Clean existing air install
|
||||
when:
|
||||
- clean_install
|
||||
@@ -47,7 +54,7 @@
|
||||
- name: Add air to install list
|
||||
ansible.builtin.set_fact:
|
||||
pkg_go: "{{ pkg_go + [air_go_pkg] }}"
|
||||
# }}}
|
||||
|
||||
- name: Finalize air configuration
|
||||
ansible.builtin.set_fact:
|
||||
__configured: "{{ __configured | combine( { 'air': air_install_method } ) }}"
|
||||
|
||||
@@ -1,13 +1,79 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
# Package: alacritty
|
||||
# Description: GPU accelerated terminal emulator written in rust
|
||||
# Version: v0.16.1
|
||||
# Methods:
|
||||
# - system
|
||||
# - source (cargo build)
|
||||
# Helpers:
|
||||
# - cargo_build
|
||||
#
|
||||
## Package: alacritty
|
||||
## Description: GPU accelerated terminal emulator written in rust
|
||||
## Version: v0.16.1
|
||||
## Methods:
|
||||
## - system
|
||||
## - source (cargo build)
|
||||
## Helpers:
|
||||
## - cargo_build
|
||||
---
|
||||
- name: Set alacritty default facts # {{{
|
||||
ansible.builtin.set_fact:
|
||||
alacritty_version: "{{ alacritty_version | default('v0.16.1') }}"
|
||||
alacritty_build_flags: "{{ alacritty_build_flags | default( ['--release'] ) }}"
|
||||
alacritty:
|
||||
install_methods:
|
||||
- source
|
||||
- system
|
||||
git_repo: https://github.com/alacritty/alacritty
|
||||
install_files:
|
||||
- from: target/release/alacritty
|
||||
to: bin/alacritty
|
||||
mode: '0755'
|
||||
- from: extra/logo/alacritty-term.svg
|
||||
to: share/pixmaps/Alacritty.svg
|
||||
mode: '0644'
|
||||
- from: extra/linux/Alacritty.desktop
|
||||
to: share/applications/Alacritty.desktop
|
||||
mode: '0644'
|
||||
pkg_deps:
|
||||
- git
|
||||
- cargo
|
||||
- cmake
|
||||
build_deps:
|
||||
RedHat:
|
||||
- fontconfig-devel
|
||||
- freetype-devel
|
||||
- g++
|
||||
- libxcb-devel
|
||||
- libxkbcommon-devel
|
||||
- desktop-file-utils
|
||||
Debian:
|
||||
- g++
|
||||
- pkg-config
|
||||
- libfontconfig1-dev
|
||||
- libxcb-xfixes0-dev
|
||||
- libxkbcommon-dev
|
||||
- python3
|
||||
- libfreetype6-dev
|
||||
- desktop-file-utils
|
||||
Alpine:
|
||||
- pkgconf
|
||||
- freetype-dev
|
||||
- fontconfig-dev
|
||||
- python3
|
||||
- libxcb-dev
|
||||
- g++
|
||||
- libxkbcommon-dev
|
||||
- desktop-file-utils
|
||||
Archlinux:
|
||||
- freetype2
|
||||
- fontconfig
|
||||
- pkg-config
|
||||
- make
|
||||
- libxcb
|
||||
- libxkbcommon
|
||||
- python
|
||||
- desktop-file-utils
|
||||
FreeBSD:
|
||||
- freetype2
|
||||
- fontconfig
|
||||
- pkgconf
|
||||
- python3
|
||||
- desktop-file-utils
|
||||
# }}}
|
||||
- name: Start alacritty configuration
|
||||
when:
|
||||
- "'alacritty' not in __configured"
|
||||
@@ -25,12 +91,12 @@
|
||||
- name: Set alacritty build facts
|
||||
ansible.builtin.set_fact:
|
||||
alacritty_src_install:
|
||||
build_deps: "{{ alacritty.build_deps[os_family] }}"
|
||||
build_flags: "{{ alacritty_cargo_build_flags }}"
|
||||
source_dir: "{{ alacritty.install_files.source_dir }}"
|
||||
repo: "{{ alacritty_git_repo }}"
|
||||
build_flags: "{{ alacritty_build_flags }}"
|
||||
source_dir: "{{ d_cache.path }}/alacritty"
|
||||
repo: "{{ alacritty.git_repo }}"
|
||||
version: "{{ alacritty_version }}"
|
||||
files: "{{ alacritty.install_files.files }}"
|
||||
files: "{{ alacritty.install_files }}"
|
||||
alacritty_build_deps: "{{ alacritty.build_deps[os_family] }}"
|
||||
|
||||
- name: Set alacritty install extra build deps
|
||||
when:
|
||||
@@ -41,13 +107,13 @@
|
||||
when:
|
||||
- ansible_distribution_major_version == 7
|
||||
ansible.builtin.set_fact:
|
||||
alacritty_build_deps: "{{ build_deps + ['xcb-util-devel', '@Development Tools'] }}"
|
||||
alacritty_build_deps: "{{ alacritty_build_deps + ['xcb-util-devel', '@Development Tools'] }}"
|
||||
|
||||
- name: Add extra dependencies for EL8
|
||||
when:
|
||||
- ansible_distribution_major_version == 8
|
||||
ansible.builtin.set_fact:
|
||||
alacritty_build_deps: "{{ build_deps + ['@Development Tools'] }}"
|
||||
alacritty_build_deps: "{{ alacritty_build_deps + ['@Development Tools'] }}"
|
||||
|
||||
- name: Configure pkg dependencies
|
||||
loop: "{{ alacritty.pkg_deps }}"
|
||||
@@ -59,14 +125,14 @@
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ pkg_sys + alacritty_build_deps }}"
|
||||
pkg_cargo_build: "{{ pkg_cargo_build + [alacritty_src_install] }}"
|
||||
# }}}
|
||||
|
||||
- name: Configure alacritty system install
|
||||
when:
|
||||
- alacritty_install_method == 'system'
|
||||
block:
|
||||
- name: Queue alacritty for installation
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ pkg_sys + [alacritty_pkgname] }}"
|
||||
pkg_sys: "{{ pkg_sys + [ alacritty.pkgname[os_family] ] }}"
|
||||
|
||||
- name: Complete alacritty configuration
|
||||
ansible.builtin.set_fact:
|
||||
|
||||
@@ -1,5 +1,24 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
#
|
||||
## Package: ansible
|
||||
## Description: simple infrastructure as code tool
|
||||
## Version: latest
|
||||
## Methods:
|
||||
## - system
|
||||
## - source (pipx)
|
||||
---
|
||||
- name: Set ansible default facts # {{{
|
||||
ansible.builtin.set_fact:
|
||||
ansible:
|
||||
install_methods:
|
||||
- system
|
||||
pkgname:
|
||||
RedHat: ansible
|
||||
Debian: ansible
|
||||
Alpine: ansible
|
||||
Archlinux: ansible
|
||||
pip: ansible
|
||||
# }}}
|
||||
- name: Configure ansible
|
||||
when:
|
||||
- "'ansible' not in __configured"
|
||||
@@ -8,19 +27,19 @@
|
||||
when:
|
||||
- ansible_install_method is undefined
|
||||
ansible.builtin.set_fact:
|
||||
ansible_install_method: "{{ install_method if install_method in ansible_install_methods else ansible_install_methods[0] }}"
|
||||
ansible_install_method: "{{ install_method if install_method in ansible.install_methods else ansible.install_methods[0] }}"
|
||||
|
||||
- name: Append ansible to system package manager install list
|
||||
when:
|
||||
- ansible_install_method == 'system'
|
||||
- ansible_install_method == "system"
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ pkg_sys + [ansible_pkgname[ansible_os_family]] }}"
|
||||
pkg_sys: "{{ pkg_sys + [ ansible_pkgname[os_family] ] }}"
|
||||
|
||||
- name: Append ansible to pipx install list
|
||||
when:
|
||||
- ansible_install_method == 'source'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_pipx: "{{ pkg_pipx + [ansible_pip_pkgname] }}"
|
||||
pkg_pipx: "{{ pkg_pipx + [ { 'name': ansible_pkgname['pip'] } ] }}"
|
||||
|
||||
- name: Complete ansible configuration
|
||||
ansible.builtin.set_fact:
|
||||
|
||||
@@ -1,5 +1,27 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
#
|
||||
## Package: ansible_lint
|
||||
## Description: Linter for ansible yaml
|
||||
## Version: latest
|
||||
## Methods:
|
||||
## - source (pipx)
|
||||
## Helpers: pipx
|
||||
---
|
||||
- name: Set ansible_lint default facts # {{{
|
||||
ansible.builtin.set_fact:
|
||||
ansible_lint_version: "{{ ansible_lint_version | default('latest') }}"
|
||||
ansible_lint:
|
||||
install_methods:
|
||||
- source
|
||||
- system
|
||||
pkgname:
|
||||
RedHat: ansible-lint
|
||||
Debian: ansible-lint
|
||||
Archlinux: ansible-lint
|
||||
Alpine: ansible-lint
|
||||
FreeBSD: py311-ansible-lint
|
||||
pip: ansible_lint
|
||||
# }}}
|
||||
- name: Configure ansible_lint
|
||||
when:
|
||||
- "'ansible_lint' not in __configured"
|
||||
@@ -10,17 +32,13 @@
|
||||
ansible.builtin.set_fact:
|
||||
ansible_lint_install_method: "{{ install_method if install_method in ansible_lint_install_methods else ansible_lint_methods[0] }}"
|
||||
|
||||
- name: Set pipx pkgnname
|
||||
- name: Configure pipx source install
|
||||
when:
|
||||
- ansible_lint_install_method == 'source'
|
||||
ansible.builtin.set_fact:
|
||||
ansible_lint_pkgname: "{{ ansible_lint_pkgname['pipx'] }}{{ '==' ~ ansible_lint_version if ansible_lint_version != 'latest' }}"
|
||||
|
||||
- name: Add ansible_lint to pipx install list
|
||||
when:
|
||||
- ansible_lint_install_method == 'source'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_pipx: "{{ pkg_pipx + [ansible_lint_pkgname] }}"
|
||||
- ansible_lint_install_method == "source"
|
||||
block:
|
||||
- name: Add ansible_lint to pipx install list
|
||||
ansible.builtin.set_fact:
|
||||
pkg_pipx: "{{ pkg_pipx + [ansible_lint.pkgname['pip']] }}"
|
||||
|
||||
- name: Append ansible-lint to system install list
|
||||
when:
|
||||
|
||||
@@ -1,5 +1,26 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
#
|
||||
## Package: ansible_ls
|
||||
## Description: language server for ansible yaml
|
||||
## Version: latest
|
||||
## Methods:
|
||||
## - source (npm)
|
||||
## - system
|
||||
## Helpers: npm
|
||||
---
|
||||
- name: Set ansible_ls default facts # {{{
|
||||
ansible.builtin.set_fact:
|
||||
ansible_ls:
|
||||
install_methods:
|
||||
- source
|
||||
- system
|
||||
npm_pkg:
|
||||
name: '@ansible/ansible-language-server'
|
||||
global: true
|
||||
version: latest
|
||||
pkg_deps:
|
||||
- nodejs
|
||||
# }}}
|
||||
- name: Configure ansible_ls
|
||||
when:
|
||||
- "'ansible_ls' not in __configured"
|
||||
@@ -15,14 +36,21 @@
|
||||
- ansible_ls_install_method == 'source'
|
||||
block:
|
||||
- name: Load required installation dependencies
|
||||
loop: "{{ ansible_ls_pkg_deps }}"
|
||||
loop: "{{ ansible_ls.pkg_deps }}"
|
||||
loop_control:
|
||||
loop_var: dep
|
||||
ansible.builtin.include_tasks: "pkgs/{{ dep }}.yml"
|
||||
|
||||
- name: Set ansible_ls npm_pkg config
|
||||
ansible.builtin.set_fact:
|
||||
ansible_ls_npm_pkg:
|
||||
name: "{{ ansible_ls.npm_pkg.name }}"
|
||||
global: "{{ ansible_ls.npm_pkg.global }}"
|
||||
version: "{{ ansible_ls_version | default(ansible_ls.npm_pkg.version) }}"
|
||||
|
||||
- name: Append ansible ls to pkg_npm
|
||||
ansible.builtin.set_fact:
|
||||
pkg_npm: "{{ pkg_npm + [ansible_ls.npm_pkg] }}"
|
||||
pkg_npm: "{{ pkg_npm + [ansible_ls_npm_pkg] }}"
|
||||
|
||||
- name: Set ansible_ls_configured
|
||||
ansible.builtin.set_fact:
|
||||
|
||||
@@ -1,6 +1,23 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
#
|
||||
## Package: bashls
|
||||
## Description: language server for bash (sh compatible)
|
||||
## Version: latest
|
||||
## Methods:
|
||||
## - source (npm)
|
||||
## Helpers: npm
|
||||
---
|
||||
- name: Add bashls
|
||||
- name: Set bashls default facts # {{{
|
||||
ansible.builtin.set_fact:
|
||||
bashls:
|
||||
install_methods:
|
||||
- source
|
||||
npm_pkg:
|
||||
name: bash-language-server
|
||||
global: true
|
||||
version: latest
|
||||
# }}}
|
||||
- name: Configure bashls
|
||||
when:
|
||||
- "'bashls' not in __configured"
|
||||
block:
|
||||
@@ -14,9 +31,16 @@
|
||||
when:
|
||||
- bashls_install_method == 'source'
|
||||
block:
|
||||
- name: Set bashls npm_pkg config
|
||||
ansible.builtin.set_fact:
|
||||
bashls_npm_pkg:
|
||||
name: "{{ bashls.npm_pkg.name }}"
|
||||
global: "{{ bashls.npm_pkg.global }}"
|
||||
version: "{{ bashls_version | default(bashls.npm_pkg.version) }}"
|
||||
|
||||
- name: Append bashls to pkg_npm
|
||||
ansible.builtin.set_fact:
|
||||
pkg_npm: "{{ pkg_npm + [bashls.npm_pkg] }}"
|
||||
pkg_npm: "{{ pkg_npm + [bashls_npm_pkg] }}"
|
||||
|
||||
- name: Set bashls_configured
|
||||
ansible.builtin.set_fact:
|
||||
|
||||
@@ -1,5 +1,43 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
#
|
||||
## Package: bat
|
||||
## Description: cat replacement with style
|
||||
## Version: latest
|
||||
## Methods:
|
||||
## - system
|
||||
---
|
||||
- name: Append bat to pkg_sys
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ pkg_sys + ['bat'] }}"
|
||||
- name: Start bat configuration
|
||||
when:
|
||||
- "'bat' not in __configured"
|
||||
block:
|
||||
- name: Set bat install method
|
||||
when:
|
||||
- bat_install_method is undefined
|
||||
ansible.builtin.set_fact:
|
||||
bat_install_method: "{{ install_method if install_method in bat.install_methods else bat.install_methods[0] }}"
|
||||
|
||||
- name: Configure bat source install
|
||||
when:
|
||||
- bat_install_method == "source"
|
||||
block:
|
||||
- name: Set bat cargo configuration
|
||||
ansible.builtin.set_fact:
|
||||
bat_cargo_install:
|
||||
name: bat
|
||||
locked: true
|
||||
|
||||
- name: Queue bat for cargo install
|
||||
ansible.builtin.set_fact:
|
||||
pkg_carg: "{{ pkg_cargo + [bat_cargo_install] }}"
|
||||
|
||||
- name: Configure bat system install
|
||||
when:
|
||||
- bat_install_method == "system"
|
||||
block:
|
||||
- name: Append bat to pkg_sys
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ pkg_sys + [ bat.pkgname[os_family] ] }}"
|
||||
|
||||
- name: Finalize bat configuration
|
||||
ansible.builtin.set_fact:
|
||||
__configured: "{{ __configured | combine( { 'bat': bat_install_method } ) }}"
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
---
|
||||
- name: Add bitwarden
|
||||
when:
|
||||
- bitwarden_configured is undefined
|
||||
block:
|
||||
- name: Load bitwarden config
|
||||
ansible.builtin.include_tasks:
|
||||
file: config/bitwarden.yml
|
||||
|
||||
- name: Append bitwarden to pkg_flatpak
|
||||
when:
|
||||
- bitwarden.method == 'flatpak'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_flatpak: "{{ pkg_flatpak + [bitwarden.pkg] }}"
|
||||
|
||||
- name: Append bitwarden to pkg_appimage
|
||||
when:
|
||||
- bitwarden.method == 'appimage'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_appimage: "{{ pkg_appimage + [bitwarden.pkg] }}"
|
||||
|
||||
- name: Append bitwarden to pkg_cask
|
||||
when:
|
||||
- bitwarden.method == 'cask'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_cask: "{{ pkg_cask + [bitwarden.pkg] }}"
|
||||
|
||||
- name: Set bitwarden_configured
|
||||
ansible.builtin.set_fact:
|
||||
bitwarden_configured: true
|
||||
@@ -1,9 +0,0 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
---
|
||||
- name: Load cockpit configuration
|
||||
ansible.builtin.include_tasks:
|
||||
file: config/cockpit.yml
|
||||
|
||||
- name: Append cockpit to pkg_sys
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ pkg_sys + cockpit.pkgs }}"
|
||||
@@ -1,23 +0,0 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
---
|
||||
- name: Load firefox config
|
||||
ansible.builtin.include_tasks:
|
||||
file: config/firefox.yml
|
||||
|
||||
- name: Append firefox to pkg_sys
|
||||
when:
|
||||
- firefox.method == 'sys'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ pkg_sys + ['firefox'] }}"
|
||||
|
||||
- name: Install firefox as flatpak
|
||||
when:
|
||||
- firefox.method == 'flatpak'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_flatpak: "{{ pkg_sys + ['org.mozilla.firefox'] }}"
|
||||
|
||||
- name: Append firefox to pkg_cask
|
||||
when:
|
||||
- ansible_system == 'Darwin'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_cask: "{{ pkg_cask + ['firefox'] }}"
|
||||
@@ -1,7 +0,0 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
---
|
||||
- name: Add goroot to /etc/profile.d
|
||||
when:
|
||||
- ansible_os_family == 'RedHat'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_src: "{{ pkg_src + ['go_profile_path'] }}"
|
||||
@@ -1,21 +0,0 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
---
|
||||
- name: Add godot
|
||||
when:
|
||||
- godot_configured is undefined
|
||||
block:
|
||||
- name: Append godot to pkg_flatpak
|
||||
when:
|
||||
- ansible_system == 'Linux'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_flatpak: "{{ pkg_flatpak + ['org.godotengine.Godot'] }}"
|
||||
|
||||
- name: Append godot to pkg_cask
|
||||
when:
|
||||
- ansible_system == 'Darwin'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_cask: "{{ pkg_cask + ['godot'] }}"
|
||||
|
||||
- name: Set godot_configured
|
||||
ansible.builtin.set_fact:
|
||||
godot_configured: true
|
||||
@@ -1,23 +0,0 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
---
|
||||
- name: Load libreoffice config
|
||||
ansible.builtin.include_tasks:
|
||||
file: config/libreoffice.yml
|
||||
|
||||
- name: Append libreoffice to pkg_flatpak
|
||||
when:
|
||||
- libreoffice.method == 'flatpak'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_flatpak: "{{ pkg_flatpak + [libreoffice.flatpak] }}"
|
||||
|
||||
- name: Append libreoffice to pkg_sys
|
||||
when:
|
||||
- libreoffice.method == 'sys'
|
||||
ansible.builtin.set_fact:
|
||||
sys_pkg: "{{ sys_pkg + libreoffice.pkgs }}"
|
||||
|
||||
- name: Append libreoffice to caskpkgs
|
||||
when:
|
||||
- libreoffice.method == 'cask'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_cask: "{{ pkg_cask + libreoffice.pkgs }}"
|
||||
@@ -1,29 +0,0 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
---
|
||||
- name: Add neovide
|
||||
block:
|
||||
- name: Load neovide config
|
||||
ansible.builtin.include_tasks:
|
||||
file: config/neovide.yml
|
||||
|
||||
- name: Linux based neovide install
|
||||
when:
|
||||
- ansible_system == 'Linux'
|
||||
block:
|
||||
- name: Append neovide build_deps to pkg_sys
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ pkg_sys + neovide.build_deps }}"
|
||||
|
||||
- name: Append neovide to pkg_cargo
|
||||
ansible.builtin.set_fact:
|
||||
pkg_cargo: "{{ pkg_cargo + [neovide] }}"
|
||||
|
||||
- name: Append neovide to pkg_cask
|
||||
when:
|
||||
- ansible_system == 'Darwin'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_cask: "{{ pkg_cask + ['neovide'] }}"
|
||||
|
||||
- name: Set neovide_configured
|
||||
ansible.builtin.set_fact:
|
||||
neovide_configured: true
|
||||
@@ -1,31 +0,0 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
---
|
||||
- name: Add nextcloud_client
|
||||
block:
|
||||
- name: Load nextcloud-client config
|
||||
ansible.builtin.include_tasks:
|
||||
file: config/nextcloud.yml
|
||||
|
||||
- name: Append nextcloud-client to pkg_Flatpak
|
||||
when:
|
||||
- ansible_system == 'Linux'
|
||||
- nextcloud.method == 'flatpak'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_flatpak: "{{ pkg_flatpak + [nextcloud] }}"
|
||||
|
||||
- name: Append nextcloud-client to pkg_sys
|
||||
when:
|
||||
- ansible_system == 'Linux'
|
||||
- nextcloud.method == 'sys'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ pkg_sys + ['nextcloud'] }}"
|
||||
|
||||
- name: Append nextcloud-client to pkg_cask
|
||||
when:
|
||||
- ansible_os_family == 'Darwin'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_cask: "{{ pkg_cask + ['nextcloud'] }}"
|
||||
|
||||
- name: Set nextcloud_client_configured
|
||||
ansible.builtin.set_fact:
|
||||
nextcloud_client_configured: true
|
||||
@@ -1,5 +0,0 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
---
|
||||
- name: Append targetcli to pkg_sys
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ pkg_sys + targetcli.pkgs }}"
|
||||
@@ -1,17 +0,0 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
---
|
||||
- name: Append thunderbird to pkg_sys
|
||||
when:
|
||||
- ansible_system == 'Linux'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ pkg_sys + ['thunderbird'] }}"
|
||||
|
||||
- name: Append thunderbird to pkg_cask
|
||||
when:
|
||||
- ansible_system == 'Darwin'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_cask: "{{ pkg_cask + ['thunderbird'] }}"
|
||||
|
||||
- name: Set thunderbird_configured
|
||||
ansible.builtin.set_fact:
|
||||
thunderbird_configured: true
|
||||
@@ -45,52 +45,6 @@ __add_to_path: [] # list of paths that should be in PATH
|
||||
__var_to_env: {} # dict of variables to add to your env
|
||||
|
||||
# Per package variables
|
||||
# {{{ air
|
||||
air_version: latest
|
||||
air_install_url: github.com/air-verse/air
|
||||
# }}}
|
||||
# {{{ alacritty
|
||||
alacritty_version: v0.16.1
|
||||
alacritty_git_repo: https://github.com/alacritty/alacritty
|
||||
alacritty_pkgname: alacritty
|
||||
alacritty_cargo_build_flags:
|
||||
- --release
|
||||
# }}}
|
||||
# {{{ ansible
|
||||
ansible_install_methods:
|
||||
- system
|
||||
- source
|
||||
ansible_pkgname:
|
||||
RedHat: ansible
|
||||
Debian: ansible
|
||||
Alpine: ansible
|
||||
Archlinux: ansible
|
||||
ansible_pip_pkgname: ansible
|
||||
# }}}
|
||||
# {{{ ansible_lint
|
||||
ansible_lint_version: latest
|
||||
ansible_lint_install_methods:
|
||||
- system
|
||||
- source
|
||||
ansible_lint_pkgname:
|
||||
RedHat: ansible-lint
|
||||
Debian: ansible-lint
|
||||
Archlinux: ansible-lint
|
||||
Alpine: ansible-lint
|
||||
FreeBSD: py311-ansible-lint
|
||||
pipx: ansible_lint
|
||||
# }}}
|
||||
# {{{ ansible_ls
|
||||
ansible_ls_version: latest
|
||||
ansible_npm_pkg:
|
||||
name: '@ansible/ansible-language-server'
|
||||
global: true
|
||||
# }}}
|
||||
# {{{ bashls
|
||||
bashls_install_methods:
|
||||
- source
|
||||
bashls_npm_pkgname: bash-language-server
|
||||
# }}}
|
||||
# cargo {{{
|
||||
cargo_pkgname: cargo
|
||||
# }}}
|
||||
|
||||
109
vars/pkglist.yml
109
vars/pkglist.yml
@@ -5,114 +5,29 @@
|
||||
## Restrictions for package install methods.
|
||||
## The first item is the default method. If only
|
||||
## one method exists, all others are ignored.
|
||||
air: # {{{
|
||||
bat: # {{{
|
||||
install_methods:
|
||||
- source
|
||||
install_files:
|
||||
- to: bin/air
|
||||
pkg_deps:
|
||||
- go
|
||||
# }}}
|
||||
alacritty: # {{{
|
||||
install_methods:
|
||||
- source
|
||||
- system
|
||||
install_files:
|
||||
source_dir: alacritty
|
||||
files:
|
||||
- from: target/release/alacritty
|
||||
to: bin/alacritty
|
||||
mode: '0755'
|
||||
- from: extra/logo/alacritty-term.svg
|
||||
to: share/pixmaps/Alacritty.svg
|
||||
mode: '0644'
|
||||
- from: extra/linux/Alacritty.desktop
|
||||
to: share/applications/Alacritty.desktop
|
||||
mode: '0644'
|
||||
pkg_deps:
|
||||
- git
|
||||
- cargo
|
||||
build_deps:
|
||||
RedHat:
|
||||
- cmake
|
||||
- fontconfig-devel
|
||||
- freetype-devel
|
||||
- g++
|
||||
- libxcb-devel
|
||||
- libxkbcommon-devel
|
||||
- desktop-file-utils
|
||||
Debian:
|
||||
- cmake
|
||||
- g++
|
||||
- pkg-config
|
||||
- libfontconfig1-dev
|
||||
- libxcb-xfixes0-dev
|
||||
- libxkbcommon-dev
|
||||
- python3
|
||||
- libfreetype6-dev
|
||||
- desktop-file-utils
|
||||
Alpine:
|
||||
- cmake
|
||||
- pkgconf
|
||||
- freetype-dev
|
||||
- fontconfig-dev
|
||||
- python3
|
||||
- libxcb-dev
|
||||
- g++
|
||||
- libxkbcommon-dev
|
||||
- desktop-file-utils
|
||||
Archlinux:
|
||||
- cmake
|
||||
- freetype2
|
||||
- fontconfig
|
||||
- pkg-config
|
||||
- make
|
||||
- libxcb
|
||||
- libxkbcommon
|
||||
- python
|
||||
- desktop-file-utils
|
||||
FreeBSD:
|
||||
- cmake
|
||||
- freetype2
|
||||
- fontconfig
|
||||
- pkgconf
|
||||
- python3
|
||||
- desktop-file-utils
|
||||
pkgname:
|
||||
RedHat: bat
|
||||
Debian: bat
|
||||
Archlinux: bat
|
||||
Alpine: bat
|
||||
Darwin: bat
|
||||
FreeBSD: bat
|
||||
# }}}
|
||||
ansible_lint: # {{{
|
||||
cargo: # {{{
|
||||
install_methods:
|
||||
- pipx
|
||||
- system
|
||||
# }}}
|
||||
ansible:
|
||||
cmake: # {{{
|
||||
install_methods:
|
||||
- system
|
||||
ansible_ls:
|
||||
install_methods:
|
||||
- source
|
||||
- system
|
||||
npm_pkg:
|
||||
name: '@ansible/ansible-language-server'
|
||||
global: true
|
||||
pkg_deps:
|
||||
- nodejs
|
||||
# {{{ bashls
|
||||
bashls:
|
||||
install_methods:
|
||||
- source
|
||||
npm_pkg:
|
||||
name: bash-language-server
|
||||
global: true
|
||||
# }}}
|
||||
cargo:
|
||||
install_methods:
|
||||
- system
|
||||
cmake:
|
||||
install_methods:
|
||||
- system
|
||||
direnv:
|
||||
direnv: # {{{
|
||||
install_methods:
|
||||
- system
|
||||
# }}}
|
||||
eza:
|
||||
install_methods:
|
||||
- source
|
||||
|
||||
Reference in New Issue
Block a user