diff --git a/README.md b/README.md index 448e7a5..76110c8 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,17 @@ Available variables are listed below (located in `defaults/main.yml`): ```yaml infracost_app: infracost infracost_version: 0.10.37 -infracost_os: linux -infracost_arch: amd64 -infracost_dl_url: https://github.com/{{ infracost_app }}/{{ infracost_app }}/releases/download/v{{ infracost_version }}/{{ infracost_app }}-{{ infracost_os }}-{{ infracost_arch }}.tar.gz +infracost_os: "{{ ansible_system | lower }}" +infracost_architecture_map: + amd64: amd64 + arm: arm64 + x86_64: amd64 + armv6l: armv6 + armv7l: armv7 + aarch64: arm64 + 32-bit: "386" + 64-bit: amd64 +infracost_dl_url: https://github.com/{{ infracost_app }}/{{ infracost_app }}/releases/download/v{{ infracost_version }}/{{ infracost_app }}-{{ infracost_os }}-{{ infracost_architecture_map[ansible_architecture] }}.tar.gz infracost_bin_path: /usr/local/bin infracost_file_owner: root infracost_file_group: root @@ -32,8 +40,8 @@ Variable | Description ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- infracost_app | Defines the app to install i.e. **infracost** infracost_version | Defined to dynamically fetch the desired version to install. Defaults to: **0.10.37** -infracost_os | Defines os type. Defaults to: **linux** -infracost_arch | Defines os architecture. Defaults to: **amd64** +infracost_os | Defines os type. +infracost_architecture_map | Defines os architecture. infracost_dl_url | Defines URL to download the infracost binary from. infracost_bin_path | Defined to dynamically set the appropriate path to store infracost binary into. Defaults to (as generally available on any user's PATH): **/usr/local/bin** infracost_file_owner | Owner for the binary file of infracost. diff --git a/defaults/main.yml b/defaults/main.yml index b5c5c04..41e91b5 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -3,9 +3,17 @@ infracost_app: infracost infracost_version: 0.10.37 -infracost_os: linux -infracost_arch: amd64 -infracost_dl_url: https://github.com/{{ infracost_app }}/{{ infracost_app }}/releases/download/v{{ infracost_version }}/{{ infracost_app }}-{{ infracost_os }}-{{ infracost_arch }}.tar.gz +infracost_os: "{{ ansible_system | lower }}" +infracost_architecture_map: + amd64: amd64 + arm: arm64 + x86_64: amd64 + armv6l: armv6 + armv7l: armv7 + aarch64: arm64 + 32-bit: "386" + 64-bit: amd64 +infracost_dl_url: https://github.com/{{ infracost_app }}/{{ infracost_app }}/releases/download/v{{ infracost_version }}/{{ infracost_app }}-{{ infracost_os }}-{{ infracost_architecture_map[ansible_architecture] }}.tar.gz infracost_bin_path: /usr/local/bin infracost_file_owner: root infracost_file_group: root diff --git a/tasks/install_debian.yml b/tasks/install_debian.yml index 7955962..51ab7e2 100644 --- a/tasks/install_debian.yml +++ b/tasks/install_debian.yml @@ -7,7 +7,7 @@ dest: "{{ infracost_bin_path }}" extra_opts: - --transform - - s/{{ infracost_app }}\-{{ infracost_os }}\-{{ infracost_arch }}/{{ infracost_app }}/ + - s/{{ infracost_app }}\-{{ infracost_os }}\-{{ infracost_architecture_map[ansible_architecture] }}/{{ infracost_app }}/ remote_src: yes owner: "{{ infracost_file_owner }}" group: "{{ infracost_file_group }}" diff --git a/tasks/install_el.yml b/tasks/install_el.yml index 7fd763b..498ee12 100644 --- a/tasks/install_el.yml +++ b/tasks/install_el.yml @@ -7,7 +7,7 @@ dest: "{{ infracost_bin_path }}" extra_opts: - --transform - - s/{{ infracost_app }}\-{{ infracost_os }}\-{{ infracost_arch }}/{{ infracost_app }}/ + - s/{{ infracost_app }}\-{{ infracost_os }}\-{{ infracost_architecture_map[ansible_architecture] }}/{{ infracost_app }}/ remote_src: yes owner: "{{ infracost_file_owner }}" group: "{{ infracost_file_group }}"