mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2025-12-13 21:34:40 +03:00
Enable reserved variable name checks and fix violations (#12463)
* Enable reserved variable name checks and fix violations Updated .ansible-lint configuration to skip only var-naming[pattern] and var-naming[no-role-prefix] instead of skipping the entire var-naming rule. This enables the check for reserved variable names. Renamed variables that used reserved names to avoid conflicts. Updated all references in tasks, variables, and templates. Signed-off-by: Ali Afsharzadeh <afsharzadeh8@gmail.com> * Rename namespace variable inside tasks instead of deleting it Signed-off-by: Ali Afsharzadeh <afsharzadeh8@gmail.com> * Change hosts variable to vm_hosts Signed-off-by: Ali Afsharzadeh <afsharzadeh8@gmail.com> * Use k8s_namespace instead of dashboard_namespace in dashboard.yml.j2 template Signed-off-by: Ali Afsharzadeh <afsharzadeh8@gmail.com> --------- Signed-off-by: Ali Afsharzadeh <afsharzadeh8@gmail.com>
This commit is contained in:
@@ -32,14 +32,14 @@
|
||||
ips: "{{ vmis.resources | map(attribute='status.interfaces.0.ipAddress') }}"
|
||||
names: "{{ vmis.resources | map(attribute='metadata.annotations.inventory_name') }}"
|
||||
_groups: "{{ (vmis.resources | map(attribute='metadata.annotations.ansible_groups') | map('split', ','))}}"
|
||||
hosts: "{{ ips | zip(_groups, names)
|
||||
vm_hosts: "{{ ips | zip(_groups, names)
|
||||
| map('zip', ['ansible_host', 'ansible_groups', 'inventory_name'])
|
||||
| map('map', 'reverse') | map('community.general.dict') }}"
|
||||
loop: "{{ hosts | map(attribute='ansible_groups') | flatten | unique }}"
|
||||
loop: "{{ vm_hosts | map(attribute='ansible_groups') | flatten | unique }}"
|
||||
set_fact:
|
||||
ci_inventory: "{{ ci_inventory|d({}) | combine({
|
||||
item: {
|
||||
'hosts': hosts | selectattr('ansible_groups', 'contains', item)
|
||||
'hosts': vm_hosts | selectattr('ansible_groups', 'contains', item)
|
||||
| rekey_on_member('inventory_name')
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user