role-goteleport/tasks/install.yml

64 lines
1.9 KiB
YAML
Raw Normal View History

2023-02-16 14:15:37 +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
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"
mode: "0755"
2023-02-16 14:15:37 +00:00
register: _download_archive
until: _download_archive is succeeded
retries: 5
delay: 2
- 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
owner: "root"
group: "root"
mode: "0775"
2023-02-16 14:15:37 +00:00
- name: Unpack Teleport Package
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 }}"
mode: "0755"
owner: "root"
group: "root"
2023-02-16 14:15:37 +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
owner: "root"
group: "root"
mode: "0775"
2023-02-16 14:15:37 +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 }}"
owner: "root"
group: "root"
mode: "0755"
2023-02-16 14:15:37 +00:00
loop:
- "tbot"
- "tctl"
- "tsh"
- "teleport"
- 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"
owner: "root"
group: "root"
mode: "0755"
2023-02-16 14:15:37 +00:00
notify: "Restart Teleport"