Browse Source
Factorize dynamic groups into a role
pull/12302/head
Max Gautier
3 months ago
Failed to extract signature
3 changed files with
34 additions and
25 deletions
-
playbooks/boilerplate.yml
-
roles/container-engine/containerd/molecule/default/prepare.yml
-
roles/dynamic_groups/tasks/main.yml
|
|
@ -6,35 +6,12 @@ |
|
|
|
# - 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: Check inventory settings |
|
|
|
- name: Inventory setup and validation |
|
|
|
hosts: all |
|
|
|
gather_facts: false |
|
|
|
tags: always |
|
|
|
roles: |
|
|
|
- dynamic_groups |
|
|
|
- validate_inventory |
|
|
|
|
|
|
|
- name: Install bastion ssh config |
|
|
|
|
|
@ -28,3 +28,16 @@ |
|
|
|
roles: |
|
|
|
- role: kubespray_defaults |
|
|
|
- role: network_plugin/cni |
|
|
|
tasks: |
|
|
|
- name: Create /etc/cni/net.d directory |
|
|
|
file: |
|
|
|
path: /etc/cni/net.d |
|
|
|
state: directory |
|
|
|
owner: root |
|
|
|
mode: "0755" |
|
|
|
- name: Config bridge host-local CNI |
|
|
|
copy: |
|
|
|
src: "10-mynet.conf" |
|
|
|
dest: "/etc/cni/net.d/" |
|
|
|
owner: root |
|
|
|
mode: "0644" |
|
|
@ -0,0 +1,19 @@ |
|
|
|
--- |
|
|
|
- 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 }}" |