reorganizing configuration

- static package configuration in `vars/pkgs`
  - loaded into the variable `pkgconfig` as part of `tasks/main.yml`
This commit is contained in:
Matthew Stobbs
2025-02-12 12:52:55 -07:00
parent 9250145116
commit a3df5215b8
23 changed files with 259 additions and 226 deletions

View File

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