Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install K9s on the seed #569

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions playbooks/provision_cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
- include_role:
name: stackhpc.azimuth_ops.k3s

- include_role:
name: stackhpc.azimuth_ops.k9s

- name: Get installed Kubernetes version
command: k3s kubectl version --output json
changed_when: false
Expand Down
19 changes: 19 additions & 0 deletions roles/k9s/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---

# The K9s repo
k9s_repo: https://github.com/derailed/k9s
# The K9s version to download
k9s_version: v0.32.5
# The OS variant and architecture to use
# See https://github.com/derailed/k9s/releases for the available options
k9s_os: "{{ ansible_system }}"
k9s_architecture: "{{ 'amd64' if ansible_architecture == 'x86_64' else ansible_architecture }}"
# The name of the K9s archive
k9s_archive_name: "k9s_{{ k9s_os }}_{{ k9s_architecture }}.tar.gz"
# The URL of the K9s archive to download
k9s_archive_url: "{{ k9s_repo }}/releases/download/{{ k9s_version }}/{{ k9s_archive_name }}"

# The directory into which the K9s archive should be unpacked
k9s_unpack_directory: "/opt/k9s/{{ k9s_version }}"
# The directory into which the K9s binary should be placed
k9s_bin_directory: /usr/local/bin
29 changes: 29 additions & 0 deletions roles/k9s/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---

- name: Ensure unpack directory exists
file:
path: "{{ k9s_unpack_directory }}"
state: directory

- name: Download and extract K9s archive
unarchive:
remote_src: yes
src: "{{ k9s_archive_url }}"
dest: "{{ k9s_unpack_directory }}"

- name: Ensure binary directory exists
file:
path: "{{ k9s_bin_directory }}"
state: directory

- name: Copy executable to binary directory
copy:
remote_src: yes
src: "{{ (k9s_unpack_directory, 'k9s') | path_join }}"
dest: "{{ k9s_bin_directory }}"
mode: u=rwx,g=rw,o=rx

- name: Ensure K9s shell completions are in .bashrc
lineinfile:
path: "{{ ansible_env.HOME }}/.bashrc"
line: source <(k9s completion bash)
Loading