Files
ansible_role_package/tasks/pkgs/buf.yml
2026-04-13 14:50:45 -06:00

50 lines
1.3 KiB
YAML

# vim: set filetype=yaml.ansible :
#
## Package: buf
## Description: A CLI tool for working with protocols buffers
## Version: latest
## Methods: source
## Helpers: go_install
---
- name: Set default buf values # {{{
ansible.builtin.set_fact:
buf:
methods:
- source
build_deps:
- go
version: latest
go_pkg: github.com/bufbuild/buf/cmd/buf
# }}}
- name: Configure bug install
when:
- "'buf' not in __configured"
block:
- name: Set buf install method
when:
- buf_imethod is undefined
ansible.builtin.set_fact:
buf_imethod: "{{ imethod if imethod in buf.methods else buf.methods[0] }}"
- name: Configure buf source install
when:
- buf_imethod == 'source'
block:
- name: Configure buf go install
ansible.builtin.set_fact:
buf_go_install:
bin: buf
url: "{{ buf.go_pkg }}@{{ buf.version }}"
- name: Append buf to pkg_go
ansible.builtin.set_fact:
pkg_go: "{{ pkg_go + [buf_go_install] }}"
- name: Finalise buf source install
ansible.builtin.set_fact:
buf_install: "{{ buf_imethod }}={{ buf_go_install }}"
- name: Finalise buf configuration
ansible.builtin.set_fact:
__configured: "{{ __configured | combine( { 'buf': buf_install } ) }}"