Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make k3s_server role idempotent #347

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion roles/k3s_server/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,20 @@
become: false
changed_when: false

# Copy the k3s config to a second file to detect changes.
# If no changes are found, we can skip copying the kubeconfig to the control node.
- name: Copy k3s.yaml to second file
ansible.builtin.copy:
src: /etc/rancher/k3s/k3s.yaml
dest: /etc/rancher/k3s/k3s-copy.yaml
mode: "0600"
remote_src: true
register: copy_k3s_yaml_file

- name: Apply K3S kubeconfig to control node
when: kubectl_installed.rc == 0
when:
- kubectl_installed.rc == 0
- copy_k3s_yaml_file.changed
block:
- name: Copy kubeconfig to control node
ansible.builtin.fetch:
Expand Down
Loading