Skip to content

non-idempotent task causes reload kubelet before that is installed #11996

@bbaassssiiee

Description

@bbaassssiiee

etc_hosts_localhosts_dict_target is a dictionary which is used in a loop, adding a sort will make it idempotent. It can now cause a rewite of /etc/hosts because dictionaries are unsorted. Running the cluster.yml playbook twice is a workaround.

    - name: Hosts | Update (if necessary) hosts file
      lineinfile:
        dest: /etc/hosts
        line: "{{ item.key }} {{ item.value | join(' ') }}"
        regexp: "^{{ item.key }}.*$"
        state: present
        backup: "{{ leave_etc_backup_files }}"
        unsafe_writes: true
      loop: "{{ etc_hosts_localhosts_dict_target | default({}) | dict2items }}"

https://github.com/kubernetes-sigs/kubespray/blob/e0a141ab12b293b2cc2644d58330ae3d50f4f85f/roles/kubernetes/preinstall/tasks/0090-etchosts.yml#L73C66-L73C77

Metadata

Metadata

Assignees

No one assigned

    Labels

    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions