From e026d2a4a7e5de9c237d60840ad6a33813144f8e Mon Sep 17 00:00:00 2001 From: Xan Manning Date: Sun, 24 Jan 2021 18:21:51 +0000 Subject: [PATCH] Added 2.9 Ansible support --- README.md | 2 +- documentation/README.md | 1 + documentation/operations/updating-k3s.md | 52 ++++++++++++++++++++++++ meta/main.yml | 2 +- molecule/requirements.txt | 2 +- requirements.txt | 2 +- 6 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 documentation/operations/updating-k3s.md diff --git a/README.md b/README.md index 636dc39..22f6857 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ and [CHANGELOG.md](CHANGELOG.md). The host you're running Ansible from requires the following Python dependencies: - - `ansible >= 2.10.4` + - `ansbile >= 2.9.17` or `ansible-base >= 2.10.4` You can install dependencies using the requirements.txt file in this repository: `pip3 install -r requirements.txt`. diff --git a/documentation/README.md b/documentation/README.md index 6e01d62..c1ab83b 100644 --- a/documentation/README.md +++ b/documentation/README.md @@ -35,5 +35,6 @@ minimum configuration. ### Operations - [Stop/Start a cluster](operations/stop-start-cluster.md) + - [Updating k3s](operations/updating-k3s.md) - [Extending a cluster](operations/extending-a-cluster.md) - [Shrinking a cluster](operations/shrinking-a-cluster.md) diff --git a/documentation/operations/updating-k3s.md b/documentation/operations/updating-k3s.md new file mode 100644 index 0000000..b6713e4 --- /dev/null +++ b/documentation/operations/updating-k3s.md @@ -0,0 +1,52 @@ +# Updating k3s + +## Before you start! + +Ensure you back up your k3s cluster. This is particularly important if you use +an external datastore or embedded Etcd. Please refer to the below guide to +backing up your k3s datastore: + +https://rancher.com/docs/k3s/latest/en/backup-restore/ + +Also, check your volume backups are also working! + +## Proceedure + +### Updates using Ansible + +To update via Ansible, set `k3s_release_version` to the target version you wish +to go to. For example, from your `v1.19.3+k3s1` playbook: + +```yaml +--- +# BEFORE + +- name: Provision k3s cluster + hosts: k3s_cluster + roles: + - name: xanmanning.k3s + vars: + k3s_release_version: v1.19.3+k3s1 +``` + +Updating to `v1.20.2+k3s1`: + +```yaml +--- +# AFTER + +- name: Provision k3s cluster + hosts: k3s_cluster + roles: + - name: xanmanning.k3s + vars: + k3s_release_version: v1.20.2+k3s1 +``` + +### Automatic updates + +For automatic updates, consider installing Rancher's +[system-upgrade-controller](https://rancher.com/docs/k3s/latest/en/upgrades/automated/) + +**Please note**, to be able to update using the system-upgrade-controller you +will need to set `k3s_install_hard_links` to `true`. diff --git a/meta/main.yml b/meta/main.yml index 8d9033c..4e32a4c 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -20,7 +20,7 @@ galaxy_info: # - CC-BY license: BSD - min_ansible_version: '2.10' + min_ansible_version: '2.9' # If this a Container Enabled role, provide the minimum Ansible Container version. # min_ansible_container_version: diff --git a/molecule/requirements.txt b/molecule/requirements.txt index 8afe838..41787de 100644 --- a/molecule/requirements.txt +++ b/molecule/requirements.txt @@ -1,6 +1,6 @@ -r ../requirements.txt -molecule[docker]>=3.2.1 +molecule[docker]>=3.2 docker>=4.3.1 yamllint>=1.25.0 ansible-lint>=4.3.5 diff --git a/requirements.txt b/requirements.txt index c857628..03308f8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -ansible>=2.10.4 +ansible>=2.9.16,!=2.10.0,!=2.10.1,!=2.10.2,!=2.10.3