Compare commits

..

No commits in common. "ff802476c9b9453572b4d04aa4ecf5668c370da3" and "1e63b2e192ec7a18b72c7825d3aa86459fcca980" have entirely different histories.

6 changed files with 44 additions and 89 deletions

View File

@ -1,9 +1,5 @@
--- ---
teleport_version_check: true teleport_version_check: true
teleport_version: "12.2.4" teleport_version: "12.0.2"
teleport_base_url_tar: "https://cdn.teleport.dev" teleport_dl_url: "https://cdn.teleport.dev/teleport-v{{ teleport_version }}-linux-{{ teleport_arch }}-bin"
teleport_base_url_sha: "https://get.gravitational.com" teleport_sha256_url: "https://get.gravitational.com/teleport-v{{ teleport_version }}-linux-{{ teleport_arch }}-bin"
teleport_base_filename: teleport-v{{ teleport_version }}-linux-{{ teleport_arch }}-bin
teleport_dl_url: "{{ teleport_base_url_tar }}/{{ teleport_base_filename }}.tar.gz"
teleport_sha256_url: "{{ teleport_base_url_sha }}/{{ teleport_base_filename }}.tar.gz.sha256"
pid_file_telport: "/run/teleport.pid"

View File

@ -1,24 +1,11 @@
--- ---
- name: "Reload systemd"
ansible.builtin.systemd:
daemon_reload: true
when: ansible_service_mgr == "systemd"
- name: "Restart Teleport" - name: "Restart Teleport"
ansible.builtin.service: ansible.builtin.service:
name: teleport name: teleport
state: restarted state: restarted
async: 15
poll: 0
when: ansible_service_mgr == "systemd" when: ansible_service_mgr == "systemd"
notify: "Check Teleport restart"
- name: "Check Teleport restart" - name: "Reload systemd"
delegate_to: localhost ansible.builtin.systemd:
ansible.builtin.wait_for: daemon_reload: true
host: "{{ inventory_hostname }}" when: ansible_service_mgr == "systemd"
port: "3022"
delay: 10
timeout: 30
state: started
msg: "Telport has restarted"

View File

@ -1,14 +1,8 @@
galaxy_info: galaxy_info:
role_name: update_goteleport author: your name
namespace: dragse description: your role description
author: Lennard Brinkhaus company: your company (optional)
description: This role update a binary installation of goteleport
company: DragSE
platforms:
- name: GenericLinux
versions:
- all
# If the issue tracker for your role is not on github, uncomment the # If the issue tracker for your role is not on github, uncomment the
# next line and provide a value # next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker # issue_tracker_url: http://example.com/issue/tracker
@ -20,9 +14,9 @@ galaxy_info:
# - GPL-3.0-only # - GPL-3.0-only
# - Apache-2.0 # - Apache-2.0
# - CC-BY-4.0 # - CC-BY-4.0
license: None license: license (GPL-2.0-or-later, MIT, etc)
min_ansible_version: "2.1" min_ansible_version: 2.1
# If this a Container Enabled role, provide the minimum Ansible Container version. # If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version: # min_ansible_container_version:

View File

@ -1,60 +1,55 @@
--- ---
- name: "Update goteleport block" - block:
when: (not teleport_version_check|bool) or (teleport_active_version.stdout != teleport_version)
block:
- name: Download teleport archive - name: Download teleport archive
ansible.builtin.get_url: get_url:
url: "{{ teleport_dl_url }}" url: "{{ teleport_dl_url }}.tar.gz"
dest: "/tmp/{{ teleport_base_filename }}.tar.gz" dest: "/tmp/teleport-{{ teleport_version }}-linux-{{ teleport_arch }}.tar.gz"
checksum: "sha256:{{ teleport_sha256_url }}" checksum: "sha256:{{ teleport_sha256_url }}.tar.gz.sha256"
mode: "0755"
register: _download_archive register: _download_archive
until: _download_archive is succeeded until: _download_archive is succeeded
retries: 5 retries: 5
delay: 2 delay: 2
- name: Create directory if they don't exist - name: create directory if they don't exist
ansible.builtin.file: file:
path: "/tmp/teleport-{{ teleport_version }}" path: "/tmp/teleport-{{ teleport_version }}"
state: directory state: directory
owner: "root" owner: root
group: "root" group: root
mode: "0775" mode: 0775
- name: Unpack Teleport Package - name: Unpack Teleport Package
ansible.builtin.unarchive: unarchive:
remote_src: true remote_src: yes
src: "/tmp/{{ teleport_base_filename }}.tar.gz" src: "/tmp/teleport-{{ teleport_version }}-linux-{{ teleport_arch }}.tar.gz"
dest: "/tmp/teleport-{{ teleport_version }}" dest: "/tmp/teleport-{{ teleport_version }}"
mode: "0755" mode: 0755
owner: "root" owner: root
group: "root" group: root
- name: Create directory if they don't exist - name: create directory if they don't exist
ansible.builtin.file: file:
path: "/var/lib/teleport" path: "/var/lib/teleport"
state: directory state: directory
owner: "root" owner: root
group: "root" group: root
mode: "0775" mode: 0775
- name: Copy all binaries - name: copy all binaries
ansible.builtin.copy: copy:
remote_src: true remote_src: true
src: "/tmp/teleport-{{ teleport_version }}/teleport/{{ item }}" src: "/tmp/teleport-{{ teleport_version }}/teleport/{{ item }}"
dest: "/usr/local/bin/{{ item }}" dest: "/usr/local/bin/{{ item }}"
owner: "root"
group: "root"
mode: "0755"
loop: loop:
- "tbot" - "tbot"
- "tctl" - "tctl"
- "tsh" - "tsh"
- "teleport" - "teleport"
notify:
- "Restart Teleport"
- name: "Clean Up Temporary Files" - name: copy teleport binary
ansible.builtin.file: copy:
state: absent remote_src: true
path: /tmp/teleport-{{ teleport_version }} src: "/tmp/teleport-{{ teleport_version }}/teleport/teleport"
dest: "/usr/local/bin/teleport"
notify: "Restart Teleport"
when: (not teleport_version_check|bool) or (teleport_active_version.stdout != teleport_version)

View File

@ -8,20 +8,4 @@
failed_when: false failed_when: false
when: teleport_version_check|bool when: teleport_version_check|bool
- name: "Check if teleport pid file exist" - include_tasks: "install.yml"
ansible.builtin.stat:
path: "{{ pid_file_telport }}"
register: pid_file_telport_state
- name: "Get Main PID of Teleport"
when: pid_file_teleport_state.stat.isdir is defined and not pid_file_teleport_state.stat.isdir
ansible.builtin.shell: "cat /run/teleport.pid"
args:
executable: /bin/bash
register: teleport_main_pid
changed_when: false
failed_when: false
- name: "Update goteleport"
ansible.builtin.include_tasks: "install.yml"

View File

@ -1,6 +1,5 @@
--- ---
- name: Test Playbook for testing goteleport - hosts: all
hosts: all
remote_user: root remote_user: root
roles: roles:
- role-goteleport - role-goteleport