29 lines
634 B
YAML
29 lines
634 B
YAML
- name: Install kubectl
|
|
become: "{{ do_become }}"
|
|
ansible.builtin.apt:
|
|
name: "{{ item }}={{ kube_apt }}"
|
|
state: present
|
|
with_items:
|
|
- kubectl
|
|
|
|
- name: Hold kubectl version
|
|
become: "{{ do_become }}"
|
|
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
|