- Added uninstall task to remove hard-linked files #88
  - Fixed missing become for `systemd` operations tasks. #89
  - Added `k3s_start_on_boot` to control `systemd.enabled`.
This commit is contained in:
Xan Manning 2021-01-30 17:23:31 +00:00
parent d4d24aec79
commit 2c12436226
7 changed files with 35 additions and 5 deletions

View File

@ -14,6 +14,16 @@
---
-->
## 2021-01-30, v2.5.1
### Notable changes
- Added uninstall task to remove hard-linked files #88
- Fixed missing become for `systemd` operations tasks. #89
- Added `k3s_start_on_boot` to control `systemd.enabled`.
---
## 2021-01-24, v2.5.0
### Notable changes

View File

@ -71,6 +71,7 @@ consistency. These are generally cluster-level configuration.
| `k3s_github_url` | Set the GitHub URL to install k3s from. | https://github.com/k3s-io/k3s |
| `k3s_install_dir` | Installation directory for k3s. | `/usr/local/bin` |
| `k3s_install_hard_links` | Install using hard links rather than symbolic links. | `false` |
| `k3s_start_on_boot` | Start k3s on boot. | `true` |
| `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_unsupported_config` | Allow the use of unsupported configurations in k3s. | `false` |

View File

@ -35,6 +35,9 @@ k3s_install_dir: /usr/local/bin
# Install using hard links rather than symbolic links
k3s_install_hard_links: false
# Start k3s on system boot
k3s_start_on_boot: true
# A list of templates used for preconfigure the cluster.
k3s_server_manifests_templates: []

View File

@ -11,7 +11,7 @@
name: k3s
state: restarted
scope: "{{ k3s_systemd_context }}"
enabled: true
enabled: "{{ k3s_start_on_boot }}"
retries: 3
delay: 3
become: "{{ k3s_become_for_systemd | ternary(true, false, k3s_become_for_all) }}"

View File

@ -4,13 +4,15 @@
ansible.builtin.systemd:
name: k3s
state: started
enabled: true
enabled: "{{ k3s_start_on_boot }}"
when: k3s_non_root is not defined or not k3s_non_root
become: "{{ k3s_become_for_systemd | ternary(true, false, k3s_become_for_all) }}"
- name: Ensure k3s service is started
ansible.builtin.systemd:
name: k3s
state: started
enabled: true
enabled: "{{ k3s_start_on_boot }}"
scope: user
when: k3s_non_root is defined and k3s_non_root
become: "{{ k3s_become_for_systemd | ternary(true, false, k3s_become_for_all) }}"

View File

@ -4,13 +4,15 @@
ansible.builtin.systemd:
name: k3s
state: stopped
enabled: false
enabled: "{{ k3s_start_on_boot }}"
when: k3s_non_root is not defined or not k3s_non_root
become: "{{ k3s_become_for_systemd | ternary(true, false, k3s_become_for_all) }}"
- name: Ensure k3s service is started
ansible.builtin.systemd:
name: k3s
state: stopped
enabled: false
enabled: "{{ k3s_start_on_boot }}"
scope: user
when: k3s_non_root is defined and k3s_non_root
become: "{{ k3s_become_for_systemd | ternary(true, false, k3s_become_for_all) }}"

View File

@ -32,6 +32,18 @@
when: check_k3s_uninstall_script.stat.exists
become: "{{ k3s_become_for_uninstall | ternary(true, false, k3s_become_for_all) }}"
- name: Ensure hard links are removed
ansible.builtin.file:
path: "{{ k3s_install_dir }}/{{ item }}"
state: absent
loop:
- kubectl
- crictl
- ctr
when: k3s_install_hard_links
and not ansible_check_mode
become: "{{ k3s_become_for_uninstall | ternary(true, false, k3s_become_for_all) }}"
- name: Clean up Docker
ansible.builtin.command: docker system prune -a --force
when: ("docker" in k3s_runtime_config and k3s_runtime_config.docker)