Skip to content
Snippets Groups Projects
Unverified Commit 1c9edf82 authored by Varac's avatar Varac
Browse files

Fix context values in kubeconfig

Fixes: #1014
parent 7b4211b7
No related branches found
No related tags found
No related merge requests found
......@@ -26,15 +26,14 @@
line: " server: https://{{ ip_address }}:6443"
insertafter: "- cluster:"
- name: Replace clustername in kubeconfig context section
- name: Replace all "default" occurrences with clustername in kubeconfig
tags:
- k3s
- kubeconfig
lineinfile:
dest: "/etc/rancher/k3s/k3s.yaml"
state: present
regexp: "^ cluster: default"
line: " cluster: {{ inventory_hostname }}"
replace:
path: /etc/rancher/k3s/k3s.yaml
regexp: ': default$'
replace: ': {{ inventory_hostname }}'
- name: Replace clustername in kubeconfig cluster section
tags:
......@@ -43,10 +42,9 @@
lineinfile:
dest: "/etc/rancher/k3s/k3s.yaml"
state: present
regexp: "^ name: default"
line: " name: {{ inventory_hostname }}"
insertbefore: "contexts:"
firstmatch: true
insertbefore: "^contexts:"
firstmatch: yes
- name: Set kubeconfig variable
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment