Remove hardcoded libexec directory path
[ta/caas-kubernetes.git] / ansible / roles / kubelet / tasks / configure_kubelet.yml
1 ---
2 # Copyright 2019 Nokia
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 - name: template master kubelet config
17   template:
18     src: master-config.yaml.j2
19     dest: /etc/kubernetes/kubeconfig/master-config.yaml
20     mode: 0600
21   when: hostname in groups.caas_master
22   become_user: "root"
23
24 - name: template worker kubelet config
25   template:
26     src: worker-config.yaml.j2
27     dest: /etc/kubernetes/kubeconfig/worker-config.yaml
28     mode: 0600
29   when: hostname in groups.caas_worker
30   become_user: "root"
31
32 - name: assemble kubelet params for master
33   set_fact:
34     kubelet_params: "{{ common_kubelet_params + master_kubelet_params | default([], true) }}"
35   when: hostname in groups.caas_master
36
37 - name: assemble kubelet params for worker
38   set_fact:
39     kubelet_params: "{{ common_kubelet_params + worker_kubelet_params | default([], true) }}"
40   when: hostname in groups.caas_worker
41
42 - name: template kubelet scripts
43   template:
44     src: "{{ item }}"
45     dest: "{{ caas.libexec_dir }}/{{ item }}"
46     mode: 0700
47   with_items:
48     - kubelet_start.sh
49     - kubelet_healthcheck.sh
50     - kubelet_stop.sh
51   become_user: "root"
52
53 - name: template service file
54   template:
55     src: "{{ item.src }}"
56     dest: "{{ item.dest }}"
57   with_items:
58     - src: kubelet.service
59       dest: /usr/lib/systemd/system/kubelet.service
60     - src: kubelet_healthcheck.service
61       dest: /usr/lib/systemd/system/kubelet_healthcheck.service
62
63 - name: create dummy kubeletc file for boostrapper nodes
64   file:
65     path: "/etc/kubernetes/kubeconfig/kubeletc.yml"
66     state: touch
67   when: hostname in groups.caas_worker