Compare commits
11 Commits
1e63b2e192
...
ff802476c9
Author | SHA1 | Date | |
---|---|---|---|
ff802476c9 | |||
|
7d334559b7 | ||
|
8cf12cc880 | ||
|
a989dd2368 | ||
|
f6e152c313 | ||
|
fc26ec4745 | ||
|
8a42acb378 | ||
|
3fac9583ac | ||
|
dc0d44d78f | ||
|
4235e237e2 | ||
|
4aaaf2fa4f |
@ -1,5 +1,9 @@
|
||||
---
|
||||
teleport_version_check: true
|
||||
teleport_version: "12.0.2"
|
||||
teleport_dl_url: "https://cdn.teleport.dev/teleport-v{{ teleport_version }}-linux-{{ teleport_arch }}-bin"
|
||||
teleport_sha256_url: "https://get.gravitational.com/teleport-v{{ teleport_version }}-linux-{{ teleport_arch }}-bin"
|
||||
teleport_version: "12.2.4"
|
||||
teleport_base_url_tar: "https://cdn.teleport.dev"
|
||||
teleport_base_url_sha: "https://get.gravitational.com"
|
||||
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"
|
||||
|
@ -1,11 +1,24 @@
|
||||
---
|
||||
- name: "Restart Teleport"
|
||||
ansible.builtin.service:
|
||||
name: teleport
|
||||
state: restarted
|
||||
when: ansible_service_mgr == "systemd"
|
||||
|
||||
- name: "Reload systemd"
|
||||
ansible.builtin.systemd:
|
||||
daemon_reload: true
|
||||
when: ansible_service_mgr == "systemd"
|
||||
|
||||
- name: "Restart Teleport"
|
||||
ansible.builtin.service:
|
||||
name: teleport
|
||||
state: restarted
|
||||
async: 15
|
||||
poll: 0
|
||||
when: ansible_service_mgr == "systemd"
|
||||
notify: "Check Teleport restart"
|
||||
|
||||
- name: "Check Teleport restart"
|
||||
delegate_to: localhost
|
||||
ansible.builtin.wait_for:
|
||||
host: "{{ inventory_hostname }}"
|
||||
port: "3022"
|
||||
delay: 10
|
||||
timeout: 30
|
||||
state: started
|
||||
msg: "Telport has restarted"
|
||||
|
@ -1,8 +1,14 @@
|
||||
galaxy_info:
|
||||
author: your name
|
||||
description: your role description
|
||||
company: your company (optional)
|
||||
role_name: update_goteleport
|
||||
namespace: dragse
|
||||
author: Lennard Brinkhaus
|
||||
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
|
||||
# next line and provide a value
|
||||
# issue_tracker_url: http://example.com/issue/tracker
|
||||
@ -14,9 +20,9 @@ galaxy_info:
|
||||
# - GPL-3.0-only
|
||||
# - Apache-2.0
|
||||
# - CC-BY-4.0
|
||||
license: license (GPL-2.0-or-later, MIT, etc)
|
||||
license: None
|
||||
|
||||
min_ansible_version: 2.1
|
||||
min_ansible_version: "2.1"
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
@ -1,55 +1,60 @@
|
||||
---
|
||||
- block:
|
||||
- name: "Update goteleport block"
|
||||
when: (not teleport_version_check|bool) or (teleport_active_version.stdout != teleport_version)
|
||||
block:
|
||||
- name: Download teleport archive
|
||||
get_url:
|
||||
url: "{{ teleport_dl_url }}.tar.gz"
|
||||
dest: "/tmp/teleport-{{ teleport_version }}-linux-{{ teleport_arch }}.tar.gz"
|
||||
checksum: "sha256:{{ teleport_sha256_url }}.tar.gz.sha256"
|
||||
ansible.builtin.get_url:
|
||||
url: "{{ teleport_dl_url }}"
|
||||
dest: "/tmp/{{ teleport_base_filename }}.tar.gz"
|
||||
checksum: "sha256:{{ teleport_sha256_url }}"
|
||||
mode: "0755"
|
||||
register: _download_archive
|
||||
until: _download_archive is succeeded
|
||||
retries: 5
|
||||
delay: 2
|
||||
|
||||
- name: create directory if they don't exist
|
||||
file:
|
||||
- name: Create directory if they don't exist
|
||||
ansible.builtin.file:
|
||||
path: "/tmp/teleport-{{ teleport_version }}"
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0775
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0775"
|
||||
|
||||
- name: Unpack Teleport Package
|
||||
unarchive:
|
||||
remote_src: yes
|
||||
src: "/tmp/teleport-{{ teleport_version }}-linux-{{ teleport_arch }}.tar.gz"
|
||||
ansible.builtin.unarchive:
|
||||
remote_src: true
|
||||
src: "/tmp/{{ teleport_base_filename }}.tar.gz"
|
||||
dest: "/tmp/teleport-{{ teleport_version }}"
|
||||
mode: 0755
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0755"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
|
||||
- name: create directory if they don't exist
|
||||
file:
|
||||
- name: Create directory if they don't exist
|
||||
ansible.builtin.file:
|
||||
path: "/var/lib/teleport"
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0775
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0775"
|
||||
|
||||
- name: copy all binaries
|
||||
copy:
|
||||
- name: Copy all binaries
|
||||
ansible.builtin.copy:
|
||||
remote_src: true
|
||||
src: "/tmp/teleport-{{ teleport_version }}/teleport/{{ item }}"
|
||||
dest: "/usr/local/bin/{{ item }}"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0755"
|
||||
loop:
|
||||
- "tbot"
|
||||
- "tctl"
|
||||
- "tsh"
|
||||
- "teleport"
|
||||
notify:
|
||||
- "Restart Teleport"
|
||||
|
||||
- name: copy teleport binary
|
||||
copy:
|
||||
remote_src: true
|
||||
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)
|
||||
- name: "Clean Up Temporary Files"
|
||||
ansible.builtin.file:
|
||||
state: absent
|
||||
path: /tmp/teleport-{{ teleport_version }}
|
||||
|
@ -8,4 +8,20 @@
|
||||
failed_when: false
|
||||
when: teleport_version_check|bool
|
||||
|
||||
- include_tasks: "install.yml"
|
||||
- name: "Check if teleport pid file exist"
|
||||
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"
|
||||
|
@ -1,5 +1,6 @@
|
||||
---
|
||||
- hosts: all
|
||||
- name: Test Playbook for testing goteleport
|
||||
hosts: all
|
||||
remote_user: root
|
||||
roles:
|
||||
- role-goteleport
|
||||
|
Loading…
Reference in New Issue
Block a user