Files
ansible/roles/k3s_storage
Tuan-Dat Tran ef652fac20 refactor: yml -> yaml
Signed-off-by: Tuan-Dat Tran <tuan-dat.tran@tudattr.dev>
2025-11-07 20:44:14 +01:00
..
2025-11-07 20:44:14 +01:00
2025-11-07 20:44:14 +01:00
2025-07-27 16:40:46 +02:00

k3s_storage Ansible Role

This role installs and configures a k3s node with storage-specific taints and labels.

Role Variables

  • k3s.loadbalancer.default_port: The port of the k3s loadbalancer. Defaults to 6443.
  • k3s_token: The token to join the k3s cluster. This is a required variable.
  • hostvars['k3s-loadbalancer'].ansible_default_ipv4.address: The IP address of the k3s loadbalancer. This is discovered automatically from the host with the name k3s-loadbalancer.

Tasks

The main task includes the following files:

  • requirements.yml:
    • Updates and upgrades system packages.
    • Installs open-iscsi and nfs-common.
    • Starts and enables the open-iscsi service.
  • installation.yml:
    • Downloads the k3s installation script.
    • Installs k3s on the node with the following configurations:
      • Taint: storage=true:NoExecute
      • Label: longhorn=true

Handlers

  • Restart k3s: Restarts the k3s service.

Usage

Here is an example of how to use this role in a playbook:

- hosts: k3s_storage_nodes
  roles:
    - role: k3s_storage
      vars:
        k3s_token: "your_k3s_token"