Rework Role Structure (#254)

* Add more defaults
* Rename roles, covert download to airgap role
* Remove unnecessary gather_facts

Signed-off-by: Derek Nola <derek.nola@suse.com>
This commit is contained in:
Derek Nola
2023-11-16 12:03:07 -08:00
committed by GitHub
parent 52941b749b
commit 1e633c5ad1
17 changed files with 65 additions and 67 deletions

View File

@@ -0,0 +1,2 @@
---
systemd_dir: /etc/systemd/system

View File

@@ -0,0 +1,34 @@
---
# with_fileglob doesn't work with remote_src, it tries to find the file on the
# local control-plane instead of the remote host. Shell supports wildcards.
- name: Save current K3s service
ansible.builtin.shell:
cmd: "cp {{ systemd_dir }}/k3s*.service /tmp/"
changed_when: true
- name: Install new K3s Version
ansible.builtin.command:
cmd: /usr/local/bin/k3s-install.sh
environment:
INSTALL_K3S_SKIP_START: "true"
INSTALL_K3S_VERSION: "{{ k3s_version }}"
changed_when: true
- name: Restore K3s service
ansible.builtin.shell:
cmd: "mv /tmp/k3s*.service {{ systemd_dir }}/"
changed_when: true
- name: Restart K3s service [server]
when: "'server' in group_names"
ansible.builtin.systemd:
state: restarted
daemon_reload: true
name: k3s
- name: Restart K3s service [agent]
when: "'agent' in group_names"
ansible.builtin.systemd:
state: restarted
daemon_reload: true
name: k3s-agent