Infra/ansible/roles/kubernetes/tasks/controlplane.yml

29 lines
608 B
YAML
Raw Normal View History

2022-10-18 22:18:54 +02:00
- name: Install kubectl
become: true
ansible.builtin.apt:
name: "{{ item }}={{ kube_apt }}"
state: present
with_items:
- kubectl
- name: Hold kubectl version
become: true
ansible.builtin.dpkg_selections:
name: "{{ item }}"
selection: "hold"
with_items:
- kubectl
- kubelet
- kubeadm
- name: Add kubectl alias to bash
ansible.builtin.lineinfile:
mode: "0644"
path: /home/{{ users.0.username }}/.bashrc
line: "{{ item }}"
create: yes
with_items:
- source <(kubectl completion bash)
- alias k=kubectl
- complete -F __start_kubectl k