reverse kubeconf changes
This commit is contained in:
parent
98436c12c1
commit
8a3adf792a
@ -7,19 +7,17 @@
|
|||||||
block:
|
block:
|
||||||
|
|
||||||
- name: fetch kubeconfig
|
- name: fetch kubeconfig
|
||||||
ignore_errors: yes
|
|
||||||
ansible.builtin.fetch:
|
ansible.builtin.fetch:
|
||||||
src: "{{ k8s_config_path }}/{{ k8s_type }}.yaml"
|
src: "{{ k8s_config_path }}/{{ k8s_type }}.yaml"
|
||||||
dest: "$HOME/.kube/config-{{ k8s_cluster_name }}.yaml"
|
dest: "~/.kube/config-{{ k8s_cluster_name }}.yaml"
|
||||||
flat: yes
|
flat: yes
|
||||||
|
|
||||||
- name: update local kubeconfig
|
- name: update local kubeconfig
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
connection: local
|
connection: local
|
||||||
become: false
|
become: false
|
||||||
ignore_errors: yes
|
|
||||||
ansible.builtin.shell: |
|
ansible.builtin.shell: |
|
||||||
yq e '.clusters[].name = "{{ k8s_cluster_name }}"' -i $HOME/.kube/config-{{ k8s_cluster_name }}.yaml
|
yq e '.clusters[].name = "{{ k8s_cluster_name }}"' -i ~/.kube/config-{{ k8s_cluster_name }}.yaml
|
||||||
yq e '.contexts[].name = "{{ k8s_cluster_context | d(k8s_cluster_name) }}"' -i $HOME/.kube/config-{{ k8s_cluster_name }}.yaml
|
yq e '.contexts[].name = "{{ k8s_cluster_context | d(k8s_cluster_name) }}"' -i ~/.kube/config-{{ k8s_cluster_name }}.yaml
|
||||||
yq e '(.clusters[] | select(.name == "{{ k8s_cluster_name }}")).cluster.server = "https://{{ k8s_cluster_url }}:{{ k8s_api_port }}"' -i $HOME/.kube/config-{{ k8s_cluster_name }}.yaml
|
yq e '(.clusters[] | select(.name == "{{ k8s_cluster_name }}")).cluster.server = "https://{{ k8s_cluster_url }}:{{ k8s_api_port }}"' -i ~/.kube/config-{{ k8s_cluster_name }}.yaml
|
||||||
yq e '(.contexts[] | select(.name == "{{ k8s_cluster_name }}")).context.cluster = "{{ k8s_cluster_name }}"' -i $HOME/.kube/config-{{ k8s_cluster_name }}.yaml
|
yq e '(.contexts[] | select(.name == "{{ k8s_cluster_name }}")).context.cluster = "{{ k8s_cluster_name }}"' -i ~/.kube/config-{{ k8s_cluster_name }}.yaml
|
||||||
|
Loading…
Reference in New Issue
Block a user