update homedir variable in get-kubeconf task, update task names, add k8s_get_kubeconf hook to skip fetching the kubeconf
This commit is contained in:
parent
11e482ae39
commit
4d3b6341a9
@ -36,6 +36,9 @@ k8s_taint_servers: false
|
|||||||
# apply label role=agent to agent nodes
|
# apply label role=agent to agent nodes
|
||||||
k8s_label_agents: false
|
k8s_label_agents: false
|
||||||
|
|
||||||
|
# fetch kubeconfig from the bootstrap node
|
||||||
|
k8s_get_kubeconfig: true
|
||||||
|
|
||||||
# shared k8s api port
|
# shared k8s api port
|
||||||
k8s_api_port: 6443
|
k8s_api_port: 6443
|
||||||
|
|
||||||
|
@ -110,6 +110,7 @@
|
|||||||
ansible.builtin.include_tasks: "shared/kubeconf.yml"
|
ansible.builtin.include_tasks: "shared/kubeconf.yml"
|
||||||
when:
|
when:
|
||||||
- k8s_node_type == "bootstrap"
|
- k8s_node_type == "bootstrap"
|
||||||
|
- k8s_get_kubeconf
|
||||||
tags:
|
tags:
|
||||||
- k8s-get-kubeconf
|
- k8s-get-kubeconf
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
- name: install helm
|
- name: install helm
|
||||||
ansible.builtin.shell: "{{ k8s_helm_install_script }}"
|
ansible.builtin.shell: "{{ k8s_helm_install_script }}"
|
||||||
|
|
||||||
- name: Add chart repos
|
- name: add chart repos
|
||||||
kubernetes.core.helm_repository:
|
kubernetes.core.helm_repository:
|
||||||
name: "{{ item.repo_name }}"
|
name: "{{ item.repo_name }}"
|
||||||
repo_url: "{{ item.repo_url }}"
|
repo_url: "{{ item.repo_url }}"
|
||||||
|
@ -9,15 +9,15 @@
|
|||||||
- name: fetch kubeconfig
|
- name: fetch kubeconfig
|
||||||
ansible.builtin.fetch:
|
ansible.builtin.fetch:
|
||||||
src: "{{ k8s_config_path }}/{{ k8s_type }}.yaml"
|
src: "{{ k8s_config_path }}/{{ k8s_type }}.yaml"
|
||||||
dest: "~/.kube/config-{{ k8s_cluster_name }}.yaml"
|
dest: "$HOME/.kube/config-{{ k8s_cluster_name }}.yaml"
|
||||||
flat: yes
|
flat: yes
|
||||||
|
|
||||||
- name: Update k8s Local Config
|
- name: update local kubeconfig
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
connection: local
|
connection: local
|
||||||
become: false
|
become: false
|
||||||
ansible.builtin.shell: |
|
ansible.builtin.shell: |
|
||||||
yq e '.clusters[].name = "{{ k8s_cluster_name }}"' -i ~/.kube/config-{{ k8s_cluster_name }}.yaml
|
yq e '.clusters[].name = "{{ 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 '.contexts[].name = "{{ k8s_cluster_context | d(k8s_cluster_name) }}"' -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 '(.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 '(.contexts[] | select(.name == "{{ k8s_cluster_name }}")).context.cluster = "{{ k8s_cluster_name }}"' -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
|
||||||
|
Loading…
Reference in New Issue
Block a user