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
|
||||
k8s_label_agents: false
|
||||
|
||||
# fetch kubeconfig from the bootstrap node
|
||||
k8s_get_kubeconfig: true
|
||||
|
||||
# shared k8s api port
|
||||
k8s_api_port: 6443
|
||||
|
||||
|
@ -110,9 +110,10 @@
|
||||
ansible.builtin.include_tasks: "shared/kubeconf.yml"
|
||||
when:
|
||||
- k8s_node_type == "bootstrap"
|
||||
- k8s_get_kubeconf
|
||||
tags:
|
||||
- k8s-get-kubeconf
|
||||
|
||||
|
||||
- name: include secret block
|
||||
ansible.builtin.include_tasks: "shared/secrets.yml"
|
||||
when:
|
||||
|
@ -18,7 +18,7 @@
|
||||
- name: install helm
|
||||
ansible.builtin.shell: "{{ k8s_helm_install_script }}"
|
||||
|
||||
- name: Add chart repos
|
||||
- name: add chart repos
|
||||
kubernetes.core.helm_repository:
|
||||
name: "{{ item.repo_name }}"
|
||||
repo_url: "{{ item.repo_url }}"
|
||||
|
@ -9,15 +9,15 @@
|
||||
- name: fetch kubeconfig
|
||||
ansible.builtin.fetch:
|
||||
src: "{{ k8s_config_path }}/{{ k8s_type }}.yaml"
|
||||
dest: "~/.kube/config-{{ k8s_cluster_name }}.yaml"
|
||||
dest: "$HOME/.kube/config-{{ k8s_cluster_name }}.yaml"
|
||||
flat: yes
|
||||
|
||||
- name: Update k8s Local Config
|
||||
- name: update local kubeconfig
|
||||
delegate_to: localhost
|
||||
connection: local
|
||||
become: false
|
||||
ansible.builtin.shell: |
|
||||
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 ~/.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 ~/.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 $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 $HOME/.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