You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.5 KiB

9 years ago
  1. ---
  2. - name: Create etcd release directory
  3. local_action: file
  4. path={{ local_release_dir }}/etcd/bin
  5. recurse=yes
  6. state=directory
  7. delegate_to: "{{ groups['kube-master'][0] }}"
  8. - name: Check if etcd release archive has been downloaded
  9. local_action: stat
  10. path={{ local_release_dir }}/etcd/etcd-{{ etcd_version }}-linux-amd64.tar.gz
  11. register: e_tar
  12. delegate_to: "{{ groups['kube-master'][0] }}"
  13. # issues with get_url module and redirects, to be tested again in the near future
  14. - name: Download etcd
  15. local_action: shell
  16. curl -o {{ local_release_dir }}/etcd/etcd-{{ etcd_version }}-linux-amd64.tar.gz -Ls {{ etcd_download_url }}/{{ etcd_version }}/etcd-{{ etcd_version }}-linux-amd64.tar.gz
  17. when: not e_tar.stat.exists
  18. register: dl_etcd
  19. delegate_to: "{{ groups['kube-master'][0] }}"
  20. - name: Extract etcd archive
  21. local_action: unarchive
  22. src={{ local_release_dir }}/etcd/etcd-{{ etcd_version }}-linux-amd64.tar.gz
  23. dest={{ local_release_dir }}/etcd copy=no
  24. when: dl_etcd|changed
  25. delegate_to: "{{ groups['kube-master'][0] }}"
  26. - name: Pick up only etcd binaries
  27. local_action: copy
  28. src={{ local_release_dir }}/etcd/etcd-{{ etcd_version }}-linux-amd64/{{ item }}
  29. dest={{ local_release_dir }}/etcd/bin
  30. with_items:
  31. - etcdctl
  32. - etcd
  33. when: dl_etcd|changed
  34. - name: Delete unused etcd files
  35. local_action: file
  36. path={{ local_release_dir }}/etcd/etcd-{{ etcd_version }}-linux-amd64 state=absent
  37. when: dl_etcd|changed