Try dynamic logic for archived/compressed/flat static binaries
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Danny Bessems 2022-06-25 18:44:43 +02:00
parent 9739c51100
commit f39b4bbb62
3 changed files with 44 additions and 8 deletions

View File

@ -12,7 +12,33 @@
owner: root owner: root
group: root group: root
mode: 0755 mode: 0755
loop: "{{ dependencies.static_binaries }}" loop: "{{ dependencies.static_binaries | selectattr('archive', 'undefined') }}"
- block:
- name: Initialize tempfolder
ansible.builtin.tempfile:
state: directory
register: archives
- name: Create destination sub folder
ansible.builtin.file:
path: "{{ archives.path }}/{{ item.binary }}"
state: directory
loop: "{{ dependencies.static_binaries | selectattr('archive', 'equalto', 'compressed') }}"
- name: Download, extract & install archived static binaries
ansible.builtin.unarchive:
src: "{{ item.url }}"
dest: "{{ archives.path }}/{{ item.binary }}"
remote_src: yes
extra_opts: "{{ item.extra_opts | default(omit) }}"
loop: "{{ dependencies.static_binaries | selectattr('archive', 'equalto', 'compressed') }}"
- name: Cleanup tempfolder
ansible.builtin.file:
path: "{{ archives.path }}"
state: absent
when: archives.path is defined
- name: Install ansible-galaxy collections - name: Install ansible-galaxy collections
ansible.builtin.shell: ansible.builtin.shell:
@ -21,15 +47,21 @@
- name: Install distro packages - name: Install distro packages
ansible.builtin.apt: ansible.builtin.apt:
name: "{{ item }}" pkg: "{{ dependencies.packages }}"
state: latest
update_cache: yes update_cache: yes
install_recommends: no install_recommends: no
loop: "{{ dependencies.packages }}"
- name: Update all packages - name: Upgrade all packages
ansible.builtin.apt: ansible.builtin.apt:
name: '*' name: '*'
state: latest state: latest
update_cache: yes
- name: Cleanup apt cache
ansible.builtin.apt:
autoremove: yes
purge: yes
- block: - block:

View File

@ -1,13 +1,13 @@
- name: Install additional packages - name: Install additional packages
ansible.builtin.apt: ansible.builtin.apt:
name: "{{ item }}" pkg: "{{ packages }}"
state: latest state: latest
update_cache: yes update_cache: yes
loop: "{{ packages }}" install_recommends: no
- name: Upgrade all packages - name: Upgrade all packages
ansible.builtin.apt: ansible.builtin.apt:
name: "*" name: '*'
state: latest state: latest
update_cache: yes update_cache: yes

View File

@ -25,7 +25,11 @@ dependencies:
- kubernetes.core - kubernetes.core
static_binaries: static_binaries:
- filename: yq - binary: helm
url: https://get.helm.sh/helm-v3.9.0-linux-amd64.tar.gz
archive: compressed
extra_opts: --strip-components=1
- binary: yq
url: http://github.com/mikefarah/yq/releases/download/v4.25.2/yq_linux_amd64 url: http://github.com/mikefarah/yq/releases/download/v4.25.2/yq_linux_amd64
packages: packages: