mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2025-12-13 21:34:40 +03:00
Using the hosts directive at the play level prevent those tasks from being run when using --limit and the group in question is not part of the limit (ex: running scale.yml on new worker nodes only) Instead, run on all hosts, and for each group, partition between that group and '_' (generic group name which is not used; using an empty string as the group is not supported by ansible.builtin.group_by) Reported-by: asteppat <asteppat@cisco.com>
40 lines
1.2 KiB
YAML
40 lines
1.2 KiB
YAML
---
|
|
- name: Check ansible version
|
|
import_playbook: ansible_version.yml
|
|
|
|
# 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)
|
|
|
|
- name: Define groups for legacy less structured inventories
|
|
hosts: all
|
|
gather_facts: false
|
|
tags: always
|
|
tasks:
|
|
- 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
|
|
group_by:
|
|
key: "{{ (group_names | intersect(item.value) | length > 0) | ternary(item.key, '_all') }}"
|
|
loop: "{{ group_mappings | dict2items }}"
|
|
|
|
- name: Install bastion ssh config
|
|
hosts: bastion[0]
|
|
gather_facts: false
|
|
environment: "{{ proxy_disable_env }}"
|
|
roles:
|
|
- { role: kubespray-defaults }
|
|
- { role: bastion-ssh-config, tags: ["localhost", "bastion"] }
|