infra-ansible
ansible script to ship alpine/ssh/wireguard
git clone https://9o.is/git/infra-ansible.git
commit 4bd7db45c385b736058065afad94c1b78ae7c6e2 parent 1a658b7c9d35f5aca492d333da1101c35f1fbb0a Author: Jul <jul@9o.is> Date: Wed, 15 May 2024 14:43:24 +0800 install latest k0s stable version Diffstat:
| M | host/group_vars/all | | | 1 | - |
| M | host/roles/k0s/tasks/prepare.yml | | | 12 | ++++++++---- |
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/host/group_vars/all b/host/group_vars/all @@ -1,5 +1,4 @@ wireguard_port: 62620 -k0s_version: v1.30.0+k0s.0 wg_client_ip: 10.0.0.2 wg_client_public_key: ZlBc9LbWP4CBm/9aIbZ2dwPZQbkYdvi7TZimAo5czWk= diff --git a/host/roles/k0s/tasks/prepare.yml b/host/roles/k0s/tasks/prepare.yml @@ -6,18 +6,22 @@ path: '{{ k0s_distros }}' state: directory -- name: Download k0s binary k0s-{{ k0s_version }}-amd64 +- name: Get stable version + command: curl https://docs.k0sproject.io/stable.txt + register: k0s_version + +- name: Download k0s binary k0s-{{ k0s_version.stdout }}-amd64 delegate_to: localhost become: false get_url: - url: https://github.com/k0sproject/k0s/releases/download/{{ k0s_version }}/k0s-{{ k0s_version }}-amd64 + url: https://github.com/k0sproject/k0s/releases/download/{{ k0s_version.stdout }}/k0s-{{ k0s_version.stdout }}-amd64 dest: '{{ k0s_distros }}' - when: item == 'x86_64' and not (k0s_distros + '/k0s-' + k0s_version + '-amd64') is exists + when: item == 'x86_64' and not (k0s_distros + '/k0s-' + k0s_version.stdout + '-amd64') is exists with_items: '{{ ansible_facts.architecture }}' - name: Upload k0s binary copy: - src: '{{ k0s_distros }}/k0s-{{ k0s_version }}-amd64' + src: '{{ k0s_distros }}/k0s-{{ k0s_version.stdout }}-amd64' dest: '/usr/local/bin/k0s' owner: root group: root