From d95ddc2d4d7ca4c5c7dd4c491db3a7f69ff541b8 Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Sat, 5 Apr 2025 12:27:53 -0600 Subject: [PATCH] fix packer package definition --- tasks/config/packer.yml | 18 +++++++++++++++++- tasks/pkgs/packer.yml | 7 +++---- vars/pkgs/packer.yml | 3 +++ 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/tasks/config/packer.yml b/tasks/config/packer.yml index 54d5763..9c54a91 100644 --- a/tasks/config/packer.yml +++ b/tasks/config/packer.yml @@ -3,7 +3,23 @@ - name: Set packer config ansible.builtin.set_fact: packer: + method: "{{ pkgconfig.packer.method[ansible_system] | default(pkgconfig.packer.method.default) }}" + +- name: Set packer config for system install + when: + - packer.method == 'sys' or + packer.method == 'tap' + ansible.builtin.set_fact: + packer: + method: "{{ packer.method }}" pkgs: "{{ pkgconfig.packer.pkgs[ansible_system] }}" + +- name: Set packer config for archive install + when: + - packer.method == 'archive' + ansible.builtin.set_fact: + packer: + method: "{{ packer.method }}" archive: file: "packer_{{ pkgconfig.packer.version }}_linux_amd64.zip" - url: "{{ pkgconfig.packer.baseurl }}/packer/{{ pkgconfig.packer.version }}" + url: "{{ pkgconfig.packer.archive.baseurl }}/packer/{{ pkgconfig.packer.version }}" diff --git a/tasks/pkgs/packer.yml b/tasks/pkgs/packer.yml index 92509da..5ad0552 100644 --- a/tasks/pkgs/packer.yml +++ b/tasks/pkgs/packer.yml @@ -10,14 +10,13 @@ - name: Append packer to pkg_tap when: - - ansible_system == 'Darwin' + - packer.method == 'tap' ansible.builtin.set_fact: pkg_tap: "{{ pkg_tap + packer.pkgs }}" - name: Append packer to pkg_sys when: - - ansible_system == 'Linux' - - ansible_os_family != 'Alpine' + - packer.method == 'sys' notify: - Depend hashicorp repo changed_when: true @@ -26,7 +25,7 @@ - name: Append packer to pkg_archive when: - - ansible_os_family == 'Alpine' + - packer.method == 'archive' ansible.builtin.set_fact: pkg_archive: "{{ pkg_archive + ['packer'] }}" diff --git a/vars/pkgs/packer.yml b/vars/pkgs/packer.yml index 7b8ee9b..30a4882 100644 --- a/vars/pkgs/packer.yml +++ b/vars/pkgs/packer.yml @@ -9,3 +9,6 @@ packer: version: 1.12.0 archive: baseurl: https://releases.hashicorp.com + method: + default: archive + Darwin: tap