role-goteleport/tasks/install.yml

61 lines
1.7 KiB
YAML
Raw Permalink 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-06-25 13:34:24 +00:00
url: "{{ teleport_dl_url }}"
dest: "/tmp/{{ teleport_base_filename }}.tar.gz"
checksum: "sha256:{{ teleport_sha256_url }}"
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-06-25 13:34:24 +00:00
src: "/tmp/{{ teleport_base_filename }}.tar.gz"
2023-02-16 14:15:37 +00:00
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"
notify:
- "Restart Teleport"
2023-02-16 14:15:37 +00:00
- name: "Clean Up Temporary Files"
ansible.builtin.file:
state: absent
path: /tmp/teleport-{{ teleport_version }}