2023-02-16 14:15:37 +00:00
|
|
|
---
|
2023-04-25 17:54:29 +00:00
|
|
|
- name: "Update goteleport block"
|
|
|
|
when: (not teleport_version_check|bool) or (teleport_active_version.stdout != teleport_version)
|
|
|
|
block:
|
2023-02-16 14:15:37 +00:00
|
|
|
- name: Download teleport archive
|
2023-04-25 17:54:29 +00:00
|
|
|
ansible.builtin.get_url:
|
2023-02-16 14:15:37 +00:00
|
|
|
url: "{{ teleport_dl_url }}.tar.gz"
|
|
|
|
dest: "/tmp/teleport-{{ teleport_version }}-linux-{{ teleport_arch }}.tar.gz"
|
|
|
|
checksum: "sha256:{{ teleport_sha256_url }}.tar.gz.sha256"
|
2023-04-25 17:54:29 +00:00
|
|
|
mode: "0755"
|
2023-02-16 14:15:37 +00:00
|
|
|
register: _download_archive
|
|
|
|
until: _download_archive is succeeded
|
|
|
|
retries: 5
|
|
|
|
delay: 2
|
|
|
|
|
2023-04-25 17:54:29 +00:00
|
|
|
- name: Create directory if they don't exist
|
|
|
|
ansible.builtin.file:
|
2023-02-16 14:15:37 +00:00
|
|
|
path: "/tmp/teleport-{{ teleport_version }}"
|
|
|
|
state: directory
|
2023-04-25 17:54:29 +00:00
|
|
|
owner: "root"
|
|
|
|
group: "root"
|
|
|
|
mode: "0775"
|
2023-02-16 14:15:37 +00:00
|
|
|
|
|
|
|
- name: Unpack Teleport Package
|
2023-04-25 17:54:29 +00:00
|
|
|
ansible.builtin.unarchive:
|
|
|
|
remote_src: true
|
2023-02-16 14:15:37 +00:00
|
|
|
src: "/tmp/teleport-{{ teleport_version }}-linux-{{ teleport_arch }}.tar.gz"
|
|
|
|
dest: "/tmp/teleport-{{ teleport_version }}"
|
2023-04-25 17:54:29 +00:00
|
|
|
mode: "0755"
|
|
|
|
owner: "root"
|
|
|
|
group: "root"
|
2023-02-16 14:15:37 +00:00
|
|
|
|
2023-04-25 17:54:29 +00:00
|
|
|
- name: Create directory if they don't exist
|
|
|
|
ansible.builtin.file:
|
2023-02-16 14:15:37 +00:00
|
|
|
path: "/var/lib/teleport"
|
|
|
|
state: directory
|
2023-04-25 17:54:29 +00:00
|
|
|
owner: "root"
|
|
|
|
group: "root"
|
|
|
|
mode: "0775"
|
2023-02-16 14:15:37 +00:00
|
|
|
|
2023-04-25 17:54:29 +00:00
|
|
|
- name: Copy all binaries
|
|
|
|
ansible.builtin.copy:
|
2023-02-16 14:15:37 +00:00
|
|
|
remote_src: true
|
|
|
|
src: "/tmp/teleport-{{ teleport_version }}/teleport/{{ item }}"
|
|
|
|
dest: "/usr/local/bin/{{ item }}"
|
2023-04-25 17:54:29 +00:00
|
|
|
owner: "root"
|
|
|
|
group: "root"
|
|
|
|
mode: "0755"
|
2023-02-16 14:15:37 +00:00
|
|
|
loop:
|
|
|
|
- "tbot"
|
|
|
|
- "tctl"
|
|
|
|
- "tsh"
|
|
|
|
- "teleport"
|
|
|
|
|
2023-04-25 17:54:29 +00:00
|
|
|
- name: Copy teleport binary
|
|
|
|
ansible.builtin.copy:
|
2023-02-16 14:15:37 +00:00
|
|
|
remote_src: true
|
|
|
|
src: "/tmp/teleport-{{ teleport_version }}/teleport/teleport"
|
|
|
|
dest: "/usr/local/bin/teleport"
|
2023-04-25 17:54:29 +00:00
|
|
|
owner: "root"
|
|
|
|
group: "root"
|
|
|
|
mode: "0755"
|
2023-02-16 14:15:37 +00:00
|
|
|
notify: "Restart Teleport"
|