40 lines
1.1 KiB
Markdown
40 lines
1.1 KiB
Markdown
# 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:
|
|
|
|
```yaml
|
|
- hosts: k3s_storage_nodes
|
|
roles:
|
|
- role: k3s_storage
|
|
vars:
|
|
k3s_token: "your_k3s_token"
|
|
```
|