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 to6443.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 namek3s-loadbalancer.
Tasks
The main task includes the following files:
requirements.yml:- Updates and upgrades system packages.
- Installs
open-iscsiandnfs-common. - Starts and enables the
open-iscsiservice.
installation.yml:- Downloads the k3s installation script.
- Installs k3s on the node with the following configurations:
- Taint:
storage=true:NoExecute - Label:
longhorn=true
- Taint:
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"