mirror of
https://github.com/PyratLabs/ansible-role-k3s
synced 2025-01-08 18:50:19 +01:00
Releasable feature for hardlinks
This commit is contained in:
parent
d2a34546cf
commit
809e9cd73c
4 changed files with 54 additions and 6 deletions
43
README.md
43
README.md
|
@ -50,6 +50,7 @@ consistency.
|
||||||
| `k3s_build_cluster` | When multiple `play_hosts` are available, attempt to cluster. Read notes below. | `true` |
|
| `k3s_build_cluster` | When multiple `play_hosts` are available, attempt to cluster. Read notes below. | `true` |
|
||||||
| `k3s_github_url` | Set the GitHub URL to install k3s from. | https://github.com/rancher/k3s |
|
| `k3s_github_url` | Set the GitHub URL to install k3s from. | https://github.com/rancher/k3s |
|
||||||
| `k3s_install_dir` | Installation directory for k3s. | `/usr/local/bin` |
|
| `k3s_install_dir` | Installation directory for k3s. | `/usr/local/bin` |
|
||||||
|
| `k3s_install_hard_links` | Install using hard links rather than symbolic links. | `false` |
|
||||||
| `k3s_server_manifests_dir` | Path for place the `k3s_server_manifests_templates`. | `/var/lib/rancher/k3s/server/manifests` |
|
| `k3s_server_manifests_dir` | Path for place the `k3s_server_manifests_templates`. | `/var/lib/rancher/k3s/server/manifests` |
|
||||||
| `k3s_server_manifests_templates` | A list of Auto-Deploying Manifests Templates. | [] |
|
| `k3s_server_manifests_templates` | A list of Auto-Deploying Manifests Templates. | [] |
|
||||||
| `k3s_use_experimental` | Allow the use of experimental features in k3s. | `false` |
|
| `k3s_use_experimental` | Allow the use of experimental features in k3s. | `false` |
|
||||||
|
@ -117,6 +118,48 @@ k3s_release_version: v1.18 # latest v1.18 release
|
||||||
k3s_release_version: v1.17-testing # latest v1.17 testing release
|
k3s_release_version: v1.17-testing # latest v1.17 testing release
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Important node about `k3s_install_hard_links`
|
||||||
|
|
||||||
|
If you are using the [system-upgrade-controller](https://github.com/rancher/system-upgrade-controller)
|
||||||
|
you will need to use hard links rather than symbolic links as the controller
|
||||||
|
will not be able to follow symbolic links. This option has been added however
|
||||||
|
is not enabled by default to avoid breaking existing installations.
|
||||||
|
|
||||||
|
To enable the use of hard links, ensure `k3s_install_hard_links` is set
|
||||||
|
to `true`.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
k3s_install_hard_links: true
|
||||||
|
```
|
||||||
|
|
||||||
|
The result of this can be seen by running the following in `k3s_install_dir`:
|
||||||
|
|
||||||
|
`ls -larthi | grep -E 'k3s|ctr|ctl' | grep -vE ".sh$" | sort`
|
||||||
|
|
||||||
|
Symbolic Links:
|
||||||
|
|
||||||
|
```text
|
||||||
|
[root@node1 bin]# ls -larthi | grep -E 'k3s|ctr|ctl' | grep -vE ".sh$" | sort
|
||||||
|
3277823 -rwxr-xr-x 1 root root 52M Jul 25 12:50 k3s-v1.18.4+k3s1
|
||||||
|
3279565 lrwxrwxrwx 1 root root 31 Jul 25 12:52 k3s -> /usr/local/bin/k3s-v1.18.6+k3s1
|
||||||
|
3279644 -rwxr-xr-x 1 root root 51M Jul 25 12:52 k3s-v1.18.6+k3s1
|
||||||
|
3280079 lrwxrwxrwx 1 root root 31 Jul 25 12:52 ctr -> /usr/local/bin/k3s-v1.18.6+k3s1
|
||||||
|
3280080 lrwxrwxrwx 1 root root 31 Jul 25 12:52 crictl -> /usr/local/bin/k3s-v1.18.6+k3s1
|
||||||
|
3280081 lrwxrwxrwx 1 root root 31 Jul 25 12:52 kubectl -> /usr/local/bin/k3s-v1.18.6+k3s1
|
||||||
|
```
|
||||||
|
|
||||||
|
Hard Links:
|
||||||
|
|
||||||
|
```text
|
||||||
|
[root@node1 bin]# ls -larthi | grep -E 'k3s|ctr|ctl' | grep -vE ".sh$" | sort
|
||||||
|
3277823 -rwxr-xr-x 1 root root 52M Jul 25 12:50 k3s-v1.18.4+k3s1
|
||||||
|
3279644 -rwxr-xr-x 5 root root 51M Jul 25 12:52 crictl
|
||||||
|
3279644 -rwxr-xr-x 5 root root 51M Jul 25 12:52 ctr
|
||||||
|
3279644 -rwxr-xr-x 5 root root 51M Jul 25 12:52 k3s
|
||||||
|
3279644 -rwxr-xr-x 5 root root 51M Jul 25 12:52 k3s-v1.18.6+k3s1
|
||||||
|
3279644 -rwxr-xr-x 5 root root 51M Jul 25 12:52 kubectl
|
||||||
|
```
|
||||||
|
|
||||||
#### Important note about `k3s_build_cluster`
|
#### Important note about `k3s_build_cluster`
|
||||||
|
|
||||||
If you set `k3s_build_cluster` to `false`, this role will install each play
|
If you set `k3s_build_cluster` to `false`, this role will install each play
|
||||||
|
|
|
@ -19,6 +19,9 @@ k3s_github_url: https://github.com/rancher/k3s
|
||||||
# Installation directory for k3s
|
# Installation directory for k3s
|
||||||
k3s_install_dir: /usr/local/bin
|
k3s_install_dir: /usr/local/bin
|
||||||
|
|
||||||
|
# Install using hard links rather than symbolic links
|
||||||
|
k3s_install_hard_links: false
|
||||||
|
|
||||||
# Path for additional Kubernetes Manifests
|
# Path for additional Kubernetes Manifests
|
||||||
# https://rancher.com/docs/k3s/latest/en/advanced/#auto-deploying-manifests
|
# https://rancher.com/docs/k3s/latest/en/advanced/#auto-deploying-manifests
|
||||||
k3s_server_manifests_dir: /var/lib/rancher/k3s/server/manifests
|
k3s_server_manifests_dir: /var/lib/rancher/k3s/server/manifests
|
||||||
|
|
|
@ -4,5 +4,7 @@
|
||||||
become: true
|
become: true
|
||||||
vars:
|
vars:
|
||||||
molecule_is_test: true
|
molecule_is_test: true
|
||||||
|
k3s_release_version: v1.18.6+k3s1
|
||||||
|
k3s_install_hard_links: true
|
||||||
roles:
|
roles:
|
||||||
- role: xanmanning.k3s
|
- role: xanmanning.k3s
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- name: Ensure k3s is hard linked into the installation destination on the contol plane
|
- name: Ensure k3s is linked into the installation destination on the contol plane
|
||||||
file:
|
file:
|
||||||
src: "{{ k3s_install_dir }}/k3s-{{ k3s_release_version }}"
|
src: "{{ k3s_install_dir }}/k3s-{{ k3s_release_version }}"
|
||||||
dest: "{{ k3s_install_dir }}/k3s"
|
dest: "{{ k3s_install_dir }}/k3s"
|
||||||
state: hard
|
state: "{{ 'hard' if k3s_install_hard_links else 'link' }}"
|
||||||
force: true
|
force: "{{ k3s_install_hard_links }}"
|
||||||
when: (k3s_control_node and k3s_controller_count | length == 1)
|
when: (k3s_control_node and k3s_controller_count | length == 1)
|
||||||
or (k3s_primary_control_node and k3s_controller_count | length > 1)
|
or (k3s_primary_control_node and k3s_controller_count | length > 1)
|
||||||
notify:
|
notify:
|
||||||
|
@ -45,12 +45,12 @@
|
||||||
mode: 0700
|
mode: 0700
|
||||||
become: "{{ k3s_become_for_usr_local_bin | ternary(true, false, k3s_become_for_all) }}"
|
become: "{{ k3s_become_for_usr_local_bin | ternary(true, false, k3s_become_for_all) }}"
|
||||||
|
|
||||||
- name: Ensure k3s is hard linked into the installation destinations across all nodes
|
- name: Ensure k3s is linked into the installation destinations across all nodes
|
||||||
file:
|
file:
|
||||||
src: "{{ k3s_install_dir }}/k3s-{{ k3s_release_version }}"
|
src: "{{ k3s_install_dir }}/k3s-{{ k3s_release_version }}"
|
||||||
dest: "{{ k3s_install_dir }}/{{ item }}"
|
dest: "{{ k3s_install_dir }}/{{ item }}"
|
||||||
state: hard
|
state: "{{ 'hard' if k3s_install_hard_links else 'link' }}"
|
||||||
force: true
|
force: "{{ k3s_install_hard_links }}"
|
||||||
notify:
|
notify:
|
||||||
- restart k3s
|
- restart k3s
|
||||||
loop:
|
loop:
|
||||||
|
|
Loading…
Reference in a new issue