diff --git a/.zuul.yaml b/.zuul.yaml index 79e2a250..f9704c0e 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -153,6 +153,15 @@ - '^roles\/ipimtool\/.*$' - '^molecule\/delegated\/tests\/ipmitool.*$' +- job: + name: ansible-collection-commons-molecule-k9s + parent: abstract-ansible-collection-commons-molecule + vars: + ansible_role: k9s + files: + - '^roles\/k9s\/.*$' + - '^molecule\/delegated\/tests\/k9s.*$' + - job: name: ansible-collection-commons-molecule-kernel_modules parent: abstract-ansible-collection-commons-molecule @@ -394,6 +403,7 @@ - ansible-collection-commons-molecule-hostname - ansible-collection-commons-molecule-hosts - ansible-collection-commons-molecule-ipmitool + - ansible-collection-commons-molecule-k9s - ansible-collection-commons-molecule-kernel_modules - ansible-collection-commons-molecule-known_hosts - ansible-collection-commons-molecule-kompose @@ -436,6 +446,7 @@ - ansible-collection-commons-molecule-hostname - ansible-collection-commons-molecule-hosts - ansible-collection-commons-molecule-ipmitool + - ansible-collection-commons-molecule-k9s - ansible-collection-commons-molecule-kernel_modules - ansible-collection-commons-molecule-known_hosts - ansible-collection-commons-molecule-kompose diff --git a/molecule/delegated/prepare/k9s.yml b/molecule/delegated/prepare/k9s.yml new file mode 100644 index 00000000..ed97d539 --- /dev/null +++ b/molecule/delegated/prepare/k9s.yml @@ -0,0 +1 @@ +--- diff --git a/molecule/delegated/tests/k9s.py b/molecule/delegated/tests/k9s.py new file mode 100644 index 00000000..b5f75ede --- /dev/null +++ b/molecule/delegated/tests/k9s.py @@ -0,0 +1,3 @@ +def test_runc_package(host): + package = host.package("k9s") + assert package.is_installed diff --git a/molecule/delegated/vars/k9s.yml b/molecule/delegated/vars/k9s.yml new file mode 100644 index 00000000..ed97d539 --- /dev/null +++ b/molecule/delegated/vars/k9s.yml @@ -0,0 +1 @@ +--- diff --git a/molecule/delegated/verify/k9s.yml b/molecule/delegated/verify/k9s.yml new file mode 100644 index 00000000..ed97d539 --- /dev/null +++ b/molecule/delegated/verify/k9s.yml @@ -0,0 +1 @@ +--- diff --git a/roles/k9s/README.md b/roles/k9s/README.md new file mode 100644 index 00000000..e69de29b diff --git a/roles/k9s/defaults/main.yml b/roles/k9s/defaults/main.yml new file mode 100644 index 00000000..cf04292d --- /dev/null +++ b/roles/k9s/defaults/main.yml @@ -0,0 +1,3 @@ +--- +k9s_version: v0.32.4 +k9s_base_url: https://github.com/derailed/k9s/releases/download diff --git a/roles/k9s/meta/main.yml b/roles/k9s/meta/main.yml new file mode 100644 index 00000000..0e004cd0 --- /dev/null +++ b/roles/k9s/meta/main.yml @@ -0,0 +1,22 @@ +--- +galaxy_info: + author: Christian Berendt + description: Role osism.commons.k9s + company: OSISM GmbH + license: Apache License 2.0 + min_ansible_version: 2.16.0 + platforms: + - name: Ubuntu + versions: + - jammy + - noble + - name: Debian + versions: + - bookworm + - name: EL + versions: + - "9" + galaxy_tags: + - osism + - system +dependencies: [] diff --git a/roles/k9s/tasks/install-Debian-family.yml b/roles/k9s/tasks/install-Debian-family.yml new file mode 100644 index 00000000..a5f7590d --- /dev/null +++ b/roles/k9s/tasks/install-Debian-family.yml @@ -0,0 +1,6 @@ +--- +- name: Install k9s packages + become: true + ansible.builtin.apt: + deb: "{{ k9s_base_url }}/{{ k9s_version }}/{{ k9s_package_file }}" + state: present diff --git a/roles/k9s/tasks/install-RedHat-family.yml b/roles/k9s/tasks/install-RedHat-family.yml new file mode 100644 index 00000000..f027d09a --- /dev/null +++ b/roles/k9s/tasks/install-RedHat-family.yml @@ -0,0 +1,7 @@ +--- +- name: Install k9s package + become: true + ansible.builtin.dnf: + name: "{{ k9s_base_url }}/{{ k9s_version }}/{{ k9s_package_file }}" + disable_gpg_check: true + state: present diff --git a/roles/k9s/tasks/main.yml b/roles/k9s/tasks/main.yml new file mode 100644 index 00000000..a61ecabe --- /dev/null +++ b/roles/k9s/tasks/main.yml @@ -0,0 +1,6 @@ +--- +- name: Gather variables for each operating system + ansible.builtin.include_vars: "{{ ansible_os_family }}-family.yml" + +- name: Include distribution specific install tasks + ansible.builtin.include_tasks: "install-{{ ansible_os_family }}-family.yml" diff --git a/roles/k9s/vars/Debian-family.yml b/roles/k9s/vars/Debian-family.yml new file mode 100644 index 00000000..aee53686 --- /dev/null +++ b/roles/k9s/vars/Debian-family.yml @@ -0,0 +1,2 @@ +--- +k9s_package_file: k9s_linux_amd64.deb diff --git a/roles/k9s/vars/RedHat-family.yml b/roles/k9s/vars/RedHat-family.yml new file mode 100644 index 00000000..4cedcfc8 --- /dev/null +++ b/roles/k9s/vars/RedHat-family.yml @@ -0,0 +1,2 @@ +--- +k9s_package_file: k9s_linux_amd64.rpm