Skip to content

Commit

Permalink
Merge pull request #33 from darkwizard242/feature/multi-arch-support
Browse files Browse the repository at this point in the history
Supporting multiple Architectures | Remove support for Ubuntu 18.04 and EL platforms
  • Loading branch information
darkwizard242 authored Jun 29, 2024
2 parents c16f2e4 + a708056 commit b3b06ee
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
strategy:
max-parallel: 10
matrix:
IMAGE: [ubuntu-24.04, ubuntu-22.04, ubuntu-20.04, ubuntu-18.04, rockylinux-8, centos-7, debian-bullseye, debian-buster]
IMAGE: [ubuntu-24.04, ubuntu-22.04, ubuntu-20.04, debian-bullseye, debian-buster]

steps:

Expand Down
36 changes: 22 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,16 @@ Available variables are listed below (located in `defaults/main.yml`):
```yaml
packer_app: packer
packer_version: 1.11.0
packer_os: linux
packer_arch: amd64
packer_os: "{{ ansible_system | lower }}"
packer_architecture_map:
amd64: amd64
arm: arm64
x86_64: amd64
armv6l: armv6
armv7l: armv7
aarch64: arm64
32-bit: "386"
64-bit: amd64
packer_dl_url: https://releases.hashicorp.com
packer_dl_loc: /tmp
packer_bin_path: /usr/local/bin
Expand All @@ -29,18 +37,18 @@ packer_file_mode: '0755'
### Variables table:
Variable | Description
----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------
packer_app | Defines the app to install i.e. **packer**
packer_version | Defined to dynamically fetch the desired version to install. Defaults to: **1.11.0**
packer_os | Defines os type. Used for obtaining the correct type of binaries based on OS type. Defaults to: **linux**
packer_arch | Defines os architecture. Used to set the correct type of binaries based on OS System Architecture. Defaults to: **amd64**
packer_dl_url | Defines URL to download the packer binary from.
packer_dl_loc | Defined to dynamically set where to place the binary archive for `packer` temporarily. Defaults to: **/tmp**
packer_bin_path | Defined to dynamically set the appropriate path to store packer binary into. Defaults to (as generally available on any user's PATH): **/usr/local/bin**
packer_file_owner | Owner for the binary file of packer.
packer_file_group | Group for the binary file of packer.
packer_file_mode | Mode for the binary file of packer.
Variable | Description
----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------
packer_app | Defines the app to install i.e. **packer**
packer_version | Defined to dynamically fetch the desired version to install. Defaults to: **1.11.0**
packer_os | Defines os type. Used for obtaining the correct type of binaries based on OS type.
packer_architecture_map | Defines os architecture. Used to set the correct type of binaries based on OS System Architecture.
packer_dl_url | Defines URL to download the packer binary from.
packer_dl_loc | Defined to dynamically set where to place the binary archive for `packer` temporarily. Defaults to: **/tmp**
packer_bin_path | Defined to dynamically set the appropriate path to store packer binary into. Defaults to (as generally available on any user's PATH): **/usr/local/bin**
packer_file_owner | Owner for the binary file of packer.
packer_file_group | Group for the binary file of packer.
packer_file_mode | Mode for the binary file of packer.

## Dependencies

Expand Down
12 changes: 10 additions & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@

packer_app: packer
packer_version: 1.11.0
packer_os: linux
packer_arch: amd64
packer_os: "{{ ansible_system | lower }}"
packer_architecture_map:
amd64: amd64
arm: arm64
x86_64: amd64
armv6l: armv6
armv7l: armv7
aarch64: arm64
32-bit: "386"
64-bit: amd64
packer_dl_url: https://releases.hashicorp.com
packer_dl_loc: /tmp
packer_bin_path: /usr/local/bin
Expand Down
5 changes: 0 additions & 5 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,10 @@ galaxy_info:
- noble
- jammy
- focal
- bionic
- name: Debian
versions:
- bullseye
- buster
- name: EL
versions:
- 8
- 7

galaxy_tags:
- packer
Expand Down
6 changes: 3 additions & 3 deletions tasks/install_debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

- name: Debian/Ubuntu Family | Downloading archive for {{ packer_app }} {{ packer_version }} temporarily to {{ packer_dl_loc }}
ansible.builtin.get_url:
url: "{{ packer_dl_url }}/{{ packer_app }}/{{ packer_version }}/{{ packer_app }}_{{ packer_version }}_{{ packer_os }}_{{ packer_arch }}.zip"
url: "{{ packer_dl_url }}/{{ packer_app }}/{{ packer_version }}/{{ packer_app }}_{{ packer_version }}_{{ packer_os }}_{{ packer_architecture_map[ansible_architecture] }}.zip"
dest: "{{ packer_dl_loc }}"

- name: Debian/Ubuntu Family | Install unzip if it is currently not in installed state
Expand All @@ -15,7 +15,7 @@

- name: Debian/Ubuntu Family | Unarchive {{ packer_app }} {{ packer_version }}
ansible.builtin.unarchive:
src: "{{ packer_dl_loc }}/{{ packer_app }}_{{ packer_version }}_{{ packer_os }}_{{ packer_arch }}.zip"
src: "{{ packer_dl_loc }}/{{ packer_app }}_{{ packer_version }}_{{ packer_os }}_{{ packer_architecture_map[ansible_architecture] }}.zip"
dest: "{{ packer_bin_path }}"
owner: "{{ packer_file_owner }}"
group: "{{ packer_file_group }}"
Expand All @@ -24,5 +24,5 @@

- name: Debian/Ubuntu Family | Remove {{ packer_app }} archive file
ansible.builtin.file:
path: "{{ packer_dl_loc }}/{{ packer_app }}_{{ packer_version }}_{{ packer_os }}_{{ packer_arch }}.zip"
path: "{{ packer_dl_loc }}/{{ packer_app }}_{{ packer_version }}_{{ packer_os }}_{{ packer_architecture_map[ansible_architecture] }}.zip"
state: absent
6 changes: 3 additions & 3 deletions tasks/install_el.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

- name: EL Family | Downloading archive for {{ packer_app }} {{ packer_version }} temporarily to {{ packer_dl_loc }}
ansible.builtin.get_url:
url: "{{ packer_dl_url }}/{{ packer_app }}/{{ packer_version }}/{{ packer_app }}_{{ packer_version }}_{{ packer_os }}_{{ packer_arch }}.zip"
url: "{{ packer_dl_url }}/{{ packer_app }}/{{ packer_version }}/{{ packer_app }}_{{ packer_version }}_{{ packer_os }}_{{ packer_architecture_map[ansible_architecture] }}.zip"
dest: "{{ packer_dl_loc }}"


Expand All @@ -15,7 +15,7 @@

- name: EL Family | Unarchive {{ packer_app }} {{ packer_version }}
ansible.builtin.unarchive:
src: "{{ packer_dl_loc }}/{{ packer_app }}_{{ packer_version }}_{{ packer_os }}_{{ packer_arch }}.zip"
src: "{{ packer_dl_loc }}/{{ packer_app }}_{{ packer_version }}_{{ packer_os }}_{{ packer_architecture_map[ansible_architecture] }}.zip"
dest: "{{ packer_bin_path }}"
owner: "{{ packer_file_owner }}"
group: "{{ packer_file_group }}"
Expand All @@ -24,5 +24,5 @@

- name: EL Family | Remove {{ packer_app }} archive
ansible.builtin.file:
path: "{{ packer_dl_loc }}/{{ packer_app }}_{{ packer_version }}_{{ packer_os }}_{{ packer_arch }}.zip"
path: "{{ packer_dl_loc }}/{{ packer_app }}_{{ packer_version }}_{{ packer_os }}_{{ packer_architecture_map[ansible_architecture] }}.zip"
state: absent

0 comments on commit b3b06ee

Please sign in to comment.