2018-09-08 05:46:11 +02:00
|
|
|
---
|
2021-03-25 14:59:44 +01:00
|
|
|
|
|
|
|
# ---- DEPRECATED ----------------
|
|
|
|
#
|
|
|
|
# Most of the kubernetes_kubelet_extra_args are deprecated. See https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet for details.
|
|
|
|
# Use the kubernetes_kubelet_config variable instead, which will be used to create the kubelet config file.
|
|
|
|
|
|
|
|
- name: Check for existence of kubelet environment file. (deprecated)
|
2018-09-08 05:46:11 +02:00
|
|
|
stat:
|
|
|
|
path: '{{ kubelet_environment_file_path }}'
|
|
|
|
register: kubelet_environment_file
|
|
|
|
|
2021-03-25 14:59:44 +01:00
|
|
|
- name: Set facts for KUBELET_EXTRA_ARGS task if environment file exists. (deprecated)
|
2018-09-08 05:46:11 +02:00
|
|
|
set_fact:
|
|
|
|
kubelet_args_path: '{{ kubelet_environment_file_path }}'
|
|
|
|
kubelet_args_line: "{{ 'KUBELET_EXTRA_ARGS=' + kubernetes_kubelet_extra_args }}"
|
|
|
|
kubelet_args_regexp: '^KUBELET_EXTRA_ARGS='
|
|
|
|
when: kubelet_environment_file.stat.exists
|
|
|
|
|
2021-03-25 14:59:44 +01:00
|
|
|
- name: Set facts for KUBELET_EXTRA_ARGS task if environment file doesn't exist. (deprecated)
|
2018-09-08 05:46:11 +02:00
|
|
|
set_fact:
|
|
|
|
kubelet_args_path: '/etc/systemd/system/kubelet.service.d/10-kubeadm.conf'
|
|
|
|
kubelet_args_line: "{{ 'Environment=\"KUBELET_EXTRA_ARGS=' + kubernetes_kubelet_extra_args + '\"' }}"
|
2019-04-19 21:11:09 +02:00
|
|
|
kubelet_args_regexp: '^Environment="KUBELET_EXTRA_ARGS='
|
2018-12-06 23:45:06 +01:00
|
|
|
when: not kubelet_environment_file.stat.exists
|
2018-09-08 05:46:11 +02:00
|
|
|
|
2021-03-25 14:59:44 +01:00
|
|
|
- name: Configure KUBELET_EXTRA_ARGS. (deprecated)
|
2018-09-08 05:46:11 +02:00
|
|
|
lineinfile:
|
|
|
|
path: '{{ kubelet_args_path }}'
|
|
|
|
line: '{{ kubelet_args_line }}'
|
|
|
|
regexp: '{{ kubelet_args_regexp }}'
|
|
|
|
state: present
|
2020-08-20 19:23:45 +02:00
|
|
|
mode: 0644
|
2021-03-25 14:59:44 +01:00
|
|
|
register: kubelet_extra_args
|
|
|
|
when: kubernetes_kubelet_extra_args|length > 0
|
2018-09-08 05:46:11 +02:00
|
|
|
|
2021-03-25 14:59:44 +01:00
|
|
|
- name: Reload systemd unit if args were changed. (deprecated)
|
2018-09-08 05:46:11 +02:00
|
|
|
systemd:
|
|
|
|
state: restarted
|
2018-09-28 05:17:50 +02:00
|
|
|
daemon_reload: true
|
2018-09-08 05:46:11 +02:00
|
|
|
name: kubelet
|
2021-03-25 14:59:44 +01:00
|
|
|
when: kubelet_extra_args is changed
|