ansible-role-k8s/tasks/shared/setup.yml
2025-10-01 04:55:40 +00:00

78 lines
2.3 KiB
YAML

---
- name: SETUP ENVIRONMENT
tags:
- k8s
- k8s-get-kubeconf
- k8s-apply-secrets
- k8s-apply-charts
- k8s-apply-manifests
block:
- name: SETUP gather local fact
delegate_to: localhost
set_fact:
local_user: "{{ lookup('env', 'USER') }}"
# resolve actual node type, boostrap is not recognized
- name: SETUP set true node type
set_fact:
node_type: "{{ 'server' if k8s_node_type == 'bootstrap' else k8s_node_type }}"
- name: SETUP load type specific values
ansible.builtin.include_vars:
file: "types/{{ k8s_type }}.yml"
- name: SETUP load system specific values
ansible.builtin.include_vars: "{{ item }}"
with_first_found:
- files:
- "systems/{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml"
- "systems/{{ ansible_os_family }}.yml"
- "systems/{{ ansible_distribution }}.yml"
- "systems/{{ ansible_system }}.yml"
skip: true
- name: SETUP check for existing http_proxy
shell: echo $http_proxy
register: host_http_proxy
ignore_errors: true
changed_when: false
when:
- k8s_http_proxy is not defined
- name: SETUP check for existing https_proxy
shell: echo $https_proxy
register: host_https_proxy
ignore_errors: true
changed_when: false
when:
- k8s_https_proxy is not defined
- name: SETUP check for existing no_proxy
shell: echo $no_proxy
register: host_no_proxy
ignore_errors: true
changed_when: false
when:
- k8s_no_proxy is not defined
- name: SETUP set fact for HTTP_PROXY
set_fact:
k8s_http_proxy: "{{ host_http_proxy.stdout | default('') | trim }}"
when:
- k8s_http_proxy is not defined
- host_http_proxy.stdout != ""
- name: SETUP set fact for HTTPS_PROXY
set_fact:
k8s_https_proxy: "{{ host_https_proxy.stdout | default('') | trim }}"
when:
- k8s_https_proxy is not defined
- host_https_proxy.stdout != ""
- name: SETUP set fact for NO_PROXY
set_fact:
k8s_no_proxy: "{{ host_no_proxy.stdout | default('') | trim }}"
when:
- k8s_no_proxy is not defined
- host_no_proxy.stdout != ""