2021-04-29 20:20:50 +08:00
|
|
|
---
|
2023-12-05 06:24:00 +08:00
|
|
|
- name: Check ansible version
|
|
|
|
import_playbook: ansible_version.yml
|
|
|
|
|
2024-09-21 20:16:17 +08:00
|
|
|
# These are inventory compatibility tasks with two purposes:
|
|
|
|
# - to ensure we keep compatibility with old style group names
|
|
|
|
# - to reduce inventory boilerplate (defining parent groups / empty groups)
|
2021-04-29 20:20:50 +08:00
|
|
|
|
2024-10-03 17:14:27 +08:00
|
|
|
- name: Define groups for legacy less structured inventories
|
|
|
|
hosts: all
|
2021-04-29 20:20:50 +08:00
|
|
|
gather_facts: false
|
2021-08-26 03:01:54 +08:00
|
|
|
tags: always
|
2021-04-29 20:20:50 +08:00
|
|
|
tasks:
|
2024-10-03 17:14:27 +08:00
|
|
|
- name: Match needed groups by their old names or definition
|
|
|
|
vars:
|
|
|
|
group_mappings:
|
|
|
|
kube_control_plane:
|
|
|
|
- kube-master
|
|
|
|
kube_node:
|
|
|
|
- kube-node
|
|
|
|
calico_rr:
|
|
|
|
- calico-rr
|
|
|
|
no_floating:
|
|
|
|
- no-floating
|
|
|
|
k8s_cluster:
|
|
|
|
- kube_node
|
|
|
|
- kube_control_plane
|
|
|
|
- calico_rr
|
2021-04-29 20:20:50 +08:00
|
|
|
group_by:
|
2024-10-03 17:14:27 +08:00
|
|
|
key: "{{ (group_names | intersect(item.value) | length > 0) | ternary(item.key, '_all') }}"
|
|
|
|
loop: "{{ group_mappings | dict2items }}"
|
2023-12-05 06:24:00 +08:00
|
|
|
|
|
|
|
- name: Install bastion ssh config
|
|
|
|
hosts: bastion[0]
|
2024-08-28 13:30:56 +08:00
|
|
|
gather_facts: false
|
2023-12-05 06:24:00 +08:00
|
|
|
environment: "{{ proxy_disable_env }}"
|
|
|
|
roles:
|
|
|
|
- { role: kubespray-defaults }
|
|
|
|
- { role: bastion-ssh-config, tags: ["localhost", "bastion"] }
|