diff --git a/playbooks/01_site.yml b/playbooks/01_site.yml index 30d9c83..f54388a 100644 --- a/playbooks/01_site.yml +++ b/playbooks/01_site.yml @@ -126,7 +126,7 @@ - include_role: name: hooks_call vars: - kubeadm_hook_list: ['pre_cp_upgrade', 'pre_nodes_upgrade'] + kubeadm_hook_list: ['early_cp_upgrade', 'early_nodes_upgrade'] roles: - role: packages vars: @@ -153,7 +153,7 @@ - include_role: name: hooks_call vars: - kubeadm_hook_list: ['pre_workers_upgrade', 'pre_nodes_upgrade'] + kubeadm_hook_list: ['early_workers_upgrade', 'early_nodes_upgrade'] roles: - role: packages vars: diff --git a/roles/drain_nodes/handlers/main.yml b/roles/drain_nodes/handlers/main.yml index a48484d..2818f44 100644 --- a/roles/drain_nodes/handlers/main.yml +++ b/roles/drain_nodes/handlers/main.yml @@ -3,6 +3,12 @@ pause: when: pause_after_drain_and_node_upgrade|bool +- name: 'Restart kubelet' + service: + name: kubelet + state: restarted + when: not reboot_node|bool + - name: 'Reboot node' reboot: when: reboot_node|bool diff --git a/roles/drain_nodes/tasks/main.yml b/roles/drain_nodes/tasks/main.yml index 89bc11b..decb57a 100644 --- a/roles/drain_nodes/tasks/main.yml +++ b/roles/drain_nodes/tasks/main.yml @@ -18,6 +18,12 @@ when: drain_node|bool notify: - Pause after upgrade + - Restart kubelet - Reboot node - Wait for node - Uncordon node + +- include_role: + name: hooks_call + vars: + kubeadm_hook_list: ['pre_nodes_upgrade'] diff --git a/roles/packages/tasks/pkg_Debian.yml b/roles/packages/tasks/pkg_Debian.yml index a70b4de..654cfd4 100644 --- a/roles/packages/tasks/pkg_Debian.yml +++ b/roles/packages/tasks/pkg_Debian.yml @@ -24,15 +24,5 @@ apt: name: "{{ kube_package_dict.keys() }}" state: "latest" - allow_change_held_packages: "{{ ansible_check_mode if ansible_version.string is version('2.13', '>=') else omit }}" when: not(_kube_repo_just_added is changed and ansible_check_mode) register: _kube_pkg_installed - -- name: 'Restart kubelet' - service: - name: 'kubelet' - state: restarted - when: - - _kube_pkg_installed is changed - - '"kubelet" in kube_package_dict' - - not ansible_check_mode diff --git a/roles/upgrade_nodes/tasks/main.yml b/roles/upgrade_nodes/tasks/main.yml index 0494a9f..7727633 100644 --- a/roles/upgrade_nodes/tasks/main.yml +++ b/roles/upgrade_nodes/tasks/main.yml @@ -17,6 +17,8 @@ {%- endif %} {%- endif -%} register: upgrade_node + notify: + - Restart kubelet - name: 'Display result of "kubeadm upgrade node"' debug: