2023-08-23 22:04:22 +08:00
|
|
|
---
|
|
|
|
- name: Copy etcdctl and etcdutl binary from docker container
|
|
|
|
command: sh -c "{{ docker_bin_dir }}/docker rm -f etcdxtl-binarycopy;
|
|
|
|
{{ docker_bin_dir }}/docker create --name etcdxtl-binarycopy {{ etcd_image_repo }}:{{ etcd_image_tag }} &&
|
|
|
|
{{ docker_bin_dir }}/docker cp etcdxtl-binarycopy:/usr/local/bin/{{ item }} {{ bin_dir }}/{{ item }} &&
|
|
|
|
{{ docker_bin_dir }}/docker rm -f etcdxtl-binarycopy"
|
|
|
|
with_items:
|
|
|
|
- etcdctl
|
|
|
|
- etcdutl
|
|
|
|
register: etcdxtl_install_result
|
|
|
|
until: etcdxtl_install_result.rc == 0
|
2023-11-28 17:52:03 +08:00
|
|
|
retries: 4
|
2023-08-23 22:04:22 +08:00
|
|
|
delay: "{{ retry_stagger | random + 3 }}"
|
|
|
|
changed_when: false
|
|
|
|
when: container_manager == "docker"
|
|
|
|
|
|
|
|
- name: Download etcd binary
|
|
|
|
include_tasks: "../../download/tasks/download_file.yml"
|
|
|
|
vars:
|
|
|
|
download: "{{ download_defaults | combine(downloads.etcd) }}"
|
|
|
|
when: container_manager in ['crio', 'containerd']
|
|
|
|
|
|
|
|
- name: Copy etcd binary
|
|
|
|
unarchive:
|
|
|
|
src: "{{ downloads.etcd.dest }}"
|
|
|
|
dest: "{{ local_release_dir }}/"
|
|
|
|
remote_src: yes
|
|
|
|
when: container_manager in ['crio', 'containerd']
|
|
|
|
|
|
|
|
- name: Copy etcdctl and etcdutl binary from download dir
|
|
|
|
copy:
|
|
|
|
src: "{{ local_release_dir }}/etcd-{{ etcd_version }}-linux-{{ host_architecture }}/{{ item }}"
|
|
|
|
dest: "{{ bin_dir }}/{{ item }}"
|
|
|
|
mode: 0755
|
|
|
|
remote_src: yes
|
|
|
|
with_items:
|
|
|
|
- etcdctl
|
|
|
|
- etcdutl
|
|
|
|
when: container_manager in ['crio', 'containerd']
|
|
|
|
|
|
|
|
- name: Create etcdctl wrapper script
|
|
|
|
template:
|
|
|
|
src: etcdctl.sh.j2
|
|
|
|
dest: "{{ bin_dir }}/etcdctl.sh"
|
|
|
|
mode: 0755
|