PyratLabs / ansible-role-k3s

Ansible role for installing k3s as either a standalone server or HA cluster.
BSD 3-Clause "New" or "Revised" License
623 stars 136 forks source link

Custom k3s_binary_url #211

Open bconn98 opened 1 year ago

bconn98 commented 1 year ago

Summary

Allow for overriding of k3s_binary_url for use in FOSS controlled environments. My employer requires that we pull FOSS components from a company controlled nexus mirror and this does not appear to be supported by the role currently.

Issue Type

User Story

As an ansible user, I want to override the k3s_binary_url variable so that I can pull from sources other than GitHub.

dbrennand commented 1 year ago

Hi @bconn98

If your control node has connectivity to the Nexus mirror, you could have a pre_tasks section in your playbook to download the k3s binary to the {{ playbook_dir }}/files directory, and then invoke the role with k3s_airgap: true.

@xanmanning @onedr0p what are you thoughts on this? If something was implemented for this, could the usage be something like:

k3s_airgap: true
k3s_binary_url: https://nexus.company.com/path/to/k3s
k3s_checksum_url: https://nexus.company.com/path/to/checksum.txt

And modify the ensure_uploads.yml playbook to run some get_url tasks when the above two variables are defined with k3s_airgap?

onedr0p commented 1 year ago

We're open to PRs on that implementation.

stale[bot] commented 8 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

xanmanning commented 8 months ago

We're open to PRs on that implementation.

agree, happy to take a look if you have a solution in mind to implement

dbrennand commented 8 months ago

Implemented logic for this (untested) in https://github.com/dbrennand/ansible-role-k3s/commit/56db9e894eeeee5182b350150e10a85e3a5179c0.

Usage:

k3s_airgap: true
k3s_binary_url: https://nexus.company.com/path/to/k3s
k3s_hash_url: https://nexus.company.com/path/to/checksum.txt
onedr0p commented 7 months ago

That implementation seems fine to me.