Added README.md for roles
Signed-off-by: Tuan-Dat Tran <tuan-dat.tran@tudattr.dev>
This commit is contained in:
49
roles/k3s_server/README.md
Normal file
49
roles/k3s_server/README.md
Normal file
@@ -0,0 +1,49 @@
|
||||
# K3s Server Ansible Role
|
||||
|
||||
This Ansible role installs and configures a K3s server cluster.
|
||||
|
||||
## Role Variables
|
||||
|
||||
- `k3s_primary_server_ip`: The IP address of the primary K3s server.
|
||||
- `k3s_server_name`: The server name for the K3s cluster.
|
||||
- `k3s_cluster_name`: The name for the K3s cluster in the kubeconfig.
|
||||
- `k3s_user_name`: The user name for the K3s cluster in the kubeconfig.
|
||||
- `k3s_context_name`: The context name for the K3s cluster in the kubeconfig.
|
||||
- `k3s_server_token_vault_file`: The path to the Ansible Vault file containing the K3s token. Default is `../vars/group_vars/k3s/secrets_token.yml`.
|
||||
|
||||
## Tasks
|
||||
|
||||
The main tasks are:
|
||||
|
||||
1. **Install dependencies**: Installs `qemu-guest-agent`.
|
||||
2. **Primary Server Installation**:
|
||||
- Downloads the K3s installation script.
|
||||
- Installs the K3s server on the primary node with a TLS SAN.
|
||||
3. **Pull Token**:
|
||||
- Retrieves the K3s token from the primary server.
|
||||
- Stores the token in an Ansible Vault encrypted file.
|
||||
4. **Secondary Server Installation**:
|
||||
- Installs K3s on the secondary servers, joining them to the cluster using the token from the vault.
|
||||
5. **Create Kubeconfig**:
|
||||
- Slurps the `k3s.yaml` from the primary server.
|
||||
- Creates a kubeconfig file on the local machine for accessing the cluster.
|
||||
|
||||
## Handlers
|
||||
|
||||
- `Restart k3s`: Restarts the K3s service.
|
||||
|
||||
## Usage
|
||||
|
||||
Here is an example of how to use this role in a playbook:
|
||||
|
||||
```yaml
|
||||
- hosts: k3s_servers
|
||||
roles:
|
||||
- role: k3s_server
|
||||
vars:
|
||||
k3s_primary_server_ip: "192.168.1.100"
|
||||
k3s_server_name: "k3s.example.com"
|
||||
k3s_cluster_name: "my-k3s-cluster"
|
||||
k3s_user_name: "my-k3s-user"
|
||||
k3s_context_name: "my-k3s-context"
|
||||
```
|
||||
Reference in New Issue
Block a user