Skip to content
Open
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
146e754
Create main.yml
Pritam1705 Jun 30, 2025
5aaf1e3
Create config.yml
Pritam1705 Jun 30, 2025
2938215
Create install.yml
Pritam1705 Jun 30, 2025
5d64905
Create main.yml
Pritam1705 Jun 30, 2025
5c1d807
Create service.yml
Pritam1705 Jun 30, 2025
0ccbb5b
Create teleport.crt.j2
Pritam1705 Jun 30, 2025
1ac9db2
Create teleport.key.j2
Pritam1705 Jun 30, 2025
f8f3850
Create teleport.service.j2
Pritam1705 Jun 30, 2025
828ea7f
Create teleport.yaml.j2
Pritam1705 Jun 30, 2025
ccd323e
Create main.yml
Pritam1705 Jun 30, 2025
c568d4f
remove chain key from teleport.crt.j2
Pritam1705 Jun 30, 2025
1cae60c
removed private key from teleport.key.j2
Pritam1705 Jun 30, 2025
7aa7a25
Create main.yml
Pritam1705 Jun 30, 2025
f4a4451
Create test
Pritam1705 Jun 30, 2025
0da4f51
Add files via upload
Pritam1705 Jun 30, 2025
391e207
Delete static/test
Pritam1705 Jun 30, 2025
f1da7c0
Update README.md
Pritam1705 Jun 30, 2025
7d222d0
Create ansible.cfg
Pritam1705 Jun 30, 2025
6738ddf
Create Teleport-agent.ini
Pritam1705 Jun 30, 2025
1d7c959
Delete roles/teleport/meta directory
Pritam1705 Jun 30, 2025
e3e4133
Update enabled: true main.yml
Pritam1705 Jun 30, 2025
47ab603
Update main.yml
Pritam1705 Jun 30, 2025
d873ead
Update config.yml
Pritam1705 Jun 30, 2025
be735c7
Update config.yml
Pritam1705 Jun 30, 2025
0d8ee90
Update main.yml
Pritam1705 Jun 30, 2025
1ef1ab7
Update config.yml
Pritam1705 Jun 30, 2025
7a567ed
Update install.yml
Pritam1705 Jun 30, 2025
e130765
Update service.yml
Pritam1705 Jun 30, 2025
2edb68d
Delete roles/teleport/templates/teleport.crt.j2
Pritam1705 Jun 30, 2025
0467b7d
Delete roles/teleport/templates/teleport.key.j2
Pritam1705 Jun 30, 2025
e9e2e8f
Delete roles/teleport/templates/teleport.service.j2
Pritam1705 Jun 30, 2025
3c57f5d
Update main.yml
Pritam1705 Jun 30, 2025
e605e72
Create teleport.crt
Pritam1705 Jun 30, 2025
6c2bba6
Create teleport.key
Pritam1705 Jun 30, 2025
91722e6
Create teleport.service
Pritam1705 Jun 30, 2025
722d7a6
Create main.yml
Pritam1705 Jun 30, 2025
0d0c921
Update install.yml
Pritam1705 Jun 30, 2025
46b0589
Update config.yml
Pritam1705 Jun 30, 2025
6f4069c
Update main.yml
Pritam1705 Jun 30, 2025
0af84bf
Update install.yml
Pritam1705 Jun 30, 2025
abaa34f
Update main.yml
Pritam1705 Jun 30, 2025
80159d0
Delete roles/teleport/vars directory
Pritam1705 Jun 30, 2025
dffd506
Update service.yml
Pritam1705 Jun 30, 2025
7471a1d
Delete roles/teleport/files/teleport.service
Pritam1705 Jun 30, 2025
de4ec73
Create teleport.service.j2
Pritam1705 Jun 30, 2025
2ef0d1b
Update main.yml
Pritam1705 Jun 30, 2025
6200923
Update install.yml
Pritam1705 Jun 30, 2025
0b05fc4
Update main.yml
Pritam1705 Jun 30, 2025
0356689
Update service.yml
Pritam1705 Jun 30, 2025
8094028
Added Telport role dir structure in README.md
Pritam1705 Jul 1, 2025
31e6b04
updated config.yml
Pritam1705 Jul 1, 2025
ae5f364
Update main.yml
Pritam1705 Jul 1, 2025
7615865
Update README.md
Pritam1705 Jul 1, 2025
9ceb10f
Update main.yml
Pritam1705 Jul 2, 2025
8b3cafb
Delete roles/teleport/files directory
Pritam1705 Jul 2, 2025
961ac5d
Update config.yml
Pritam1705 Jul 2, 2025
be4ea92
Update install.yml
Pritam1705 Jul 2, 2025
2ac4976
Update service.yml
Pritam1705 Jul 2, 2025
7c37dc9
Create teleport.crt.j2
Pritam1705 Jul 2, 2025
16b6cf1
Create teleport.key.j2
Pritam1705 Jul 2, 2025
422e9df
Update main.yml
Pritam1705 Jul 2, 2025
42a7ca3
Create playbook.yaml
Pritam1705 Jul 2, 2025
1bad6d9
Update Teleport-agent.ini
Pritam1705 Jul 2, 2025
8935377
Update Teleport-agent.ini
Pritam1705 Jul 2, 2025
a63c485
Update playbook.yaml
Pritam1705 Jul 2, 2025
9ff3e4e
Update Teleport-agent.ini
Pritam1705 Jul 2, 2025
8791397
Create main.yml
Pritam1705 Jul 3, 2025
2231cb0
Create main.yml
Pritam1705 Jul 3, 2025
b26f228
Create main.yml
Pritam1705 Jul 3, 2025
872a433
Create main.yml
Pritam1705 Jul 3, 2025
82f85f3
Create master.yml
Pritam1705 Jul 3, 2025
e8a4303
Create node.yml
Pritam1705 Jul 3, 2025
5f84f0e
Create main.yml
Pritam1705 Jul 3, 2025
f6e892b
Delete roles/teleport/teleport-agent directory
Pritam1705 Jul 3, 2025
ae13f6c
Update main.yml
Pritam1705 Jul 10, 2025
a4e2bda
Update config.yml
Pritam1705 Jul 10, 2025
096ddac
Update install.yml
Pritam1705 Jul 10, 2025
d2d9868
Update service.yml
Pritam1705 Jul 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 123 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,123 @@
# teleport
## Ansible Role: Teleport
[Teleport Image](https://github.com/OT-OSM/teleport/blob/teleport/static/teleport.png)

### Version History

|**Date**| **Version**| **Description**| **Changed By** |
|----------|---------|---------------|-----------------|
|**June '30'** | v.1.0 | Initial Draft | Pritam Kondapratiwar |


## Table of Content
- [Introduction](#introduction)
- [Salient Features](#salient-features)
- [Supported OS](#supported-os)
- [Dependencies](#dependencies)
- [Directory Structure](#directory-structure)
- [Role Variables](#role-variables)
- [Inventory](#inventory)
- [References](#references)


### Introduction
Teleport is an open-source access management tool that provides secure, identity-based access to SSH servers, Kubernetes clusters, databases, and internal apps. It replaces VPNs and static credentials with short-lived certificates and integrates with SSO for centralized control. Teleport also offers session recording, auditing, and role-based access control for compliance and security.

### Salient Features

| **Feature** | **Description** |
|----------------------------------|-------------------------------------------------------------------------------|
| **Identity-Based Access** | Provides secure access using short-lived certificates tied to user identity, integrating with SSO providers like Okta, GitHub, and Google. |
| **Session Recording** | Records all SSH, Kubernetes, and database sessions for compliance and auditing purposes. |
| **Role-Based Access Control (RBAC)** | Enables fine-grained access permissions based on user roles, teams, or environments. |
| **Unified Access Plane** | Centralizes access to SSH, Kubernetes, databases, internal apps, and desktops through a single interface. |
| **Just-in-Time Access Requests** | Allows users to request temporary access with approval workflows to reduce standing privileges. |
| **Audit Logging** | Maintains detailed audit logs of all user actions across infrastructure for security and compliance. |
| **Zero Trust Architecture** | Eliminates the need for VPNs and static credentials by using identity-based, short-lived access tokens. |
| **Multi-Protocol Support** | Supports secure access for SSH, Kubernetes, PostgreSQL, MySQL, MongoDB, Windows RDP, and internal web apps. |




### Supported OS
------------
* Debian 11 and above
* RHEL 8.2 and above
* macOS (for CLI tools like tsh)



### Dependencies
------------
* Domain should be pointed to the server IP
* SSL and TLS certicate

### Directory Structure

#### For Teleport
```
├── handlers
│   └── main.yml
├── meta
│   └── main.yml
├── README.md
├── tasks
│   ├── config.yml
│   ├── install.yml
│   ├── main.yml
│   └── service.yml
├── templates
│   ├── teleport.crt.j2
│   ├── teleport.key.j2
│   ├── teleport.service.j2
│   └── teleport.yaml.j2
└── vars
└── main.yml

```

### Role Variables

| **Variable** | **Default Value** | **Description** |
|------------------------------|----------------------------------------|---------------------------------------------------------------------------------|
| `teleport_version` | `"17.5.2"` | The version of Teleport to be installed. |
| `teleport_email` | `"[email protected]"` | Email used for certificate generation or Let's Encrypt integration. |
| `teleport_cluster_name` | `"teleport.opstree.net"` | Unique identifier for your Teleport cluster. |
| `teleport_nodename` | `"ldc-opstree"` | The node name that will appear in the Teleport cluster. |
| `teleport_data_dir` | `"/var/lib/teleport"` | Directory where Teleport stores data and logs. |
| `teleport_cert_file` | `"/etc/teleport/teleport.crt"` | Path to the TLS certificate used by Teleport. |
| `teleport_key_file` | `"/etc/teleport/teleport.key"` | Path to the private key corresponding to the TLS certificate. |
| `teleport_config_file` | `"/etc/teleport.yaml"` | Path to the main Teleport configuration file. |
| `teleport_service_file` | `"/etc/systemd/system/teleport.service"` | Path to the systemd service file for managing the Teleport service. |


## Inventory

An inventory should look like this:-
#### For Teleport
```ini
[Teleporthost]
13.xxx.xxx.xx ansible_user=ubuntu

```
Example Playbook
----------------

* Here is an example playbook:-
#### For Teleport
```sh
---
- hosts: Teleporthost
become: yes
roles:
- Teleport

```


**After the successful installation of Teleport, browse through the Teleport url and you would get your login page**
![teleport](https://github.com/user-attachments/assets/1bdcc1ea-18f5-4409-8825-7a766cfa072a)


## References
----------
- **[software](https://goteleport.com/docs/linux-demo/)**
17 changes: 17 additions & 0 deletions ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[ssh_connection]
pipelining=True
ansible_ssh_args = -o ControlMaster=auto -o ControlPersist=30m -o ConnectionAttempts=100 -o UserKnownHostsFile=/dev/null
#control_path = ~/.ssh/ansible-%%r@%%h:%%p

[defaults]
force_valid_group_names = ignore
host_key_checking=False
gathering = smart
fact_caching = jsonfile
fact_caching_connection = /tmp
fact_caching_timeout = 86400
stdout_callback = default
display_skipped_hosts = no
callbacks_enabled = profile_tasks,ara_default
deprecation_warnings=False
roles_path = roles
2 changes: 2 additions & 0 deletions inventory/Teleport-agent.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Teleporthost]
13.xxx.xxx.xx ansible_user=ubuntu
9 changes: 9 additions & 0 deletions roles/teleport/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
- name: Reload systemd
command: systemctl daemon-reexec

- name: Restart Teleport
systemd:
name: teleport
state: restarted
enabled: yes
34 changes: 34 additions & 0 deletions roles/teleport/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
galaxy_info:
author: Pritam Kondapratiwar
description: Ansible role for Teleport
company: Opstree Solutions

# 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

# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)

min_ansible_version: 2.1

# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:

galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.

dependencies: []

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove if not required

# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
34 changes: 34 additions & 0 deletions roles/teleport/tasks/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
- name: Ensure /etc/teleport directory exists
file:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try to use FQCN in place of using module
like use ansible.builtin.file in stead of file

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

path: /etc/teleport
state: directory
owner: root
group: root
mode: '0755'

- name: Create teleport certificate file from template
template:
src: teleport.crt.j2
dest: "{{ teleport_cert_file }}"
owner: root
group: root
mode: '0644'

- name: Create teleport key file from template
template:
src: teleport.key.j2
dest: "{{ teleport_key_file }}"
owner: root
group: root
mode: '0600'

- name: Deploy updated teleport.yaml
template:
src: teleport.yaml.j2
dest: "{{ teleport_config_file }}"
owner: root
group: root
mode: '0644'
notify:
- Restart Teleport
11 changes: 11 additions & 0 deletions roles/teleport/tasks/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
- name: Install teleport binary
shell: curl https://cdn.teleport.dev/install.sh | bash -s {{ teleport_version }}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use ansible.builtin.get_url to download script

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


- name: Generate initial teleport.yaml
shell: >
teleport configure -o file
--acme --acme-email={{ teleport_email }}
--cluster-name={{ teleport_cluster_name }}
args:
creates: "{{ teleport_config_file }}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add task to ensure teleport install successfully

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

9 changes: 9 additions & 0 deletions roles/teleport/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
- name: Install Teleport
import_tasks: install.yml

- name: Configure Teleport
import_tasks: config.yml

- name: Setup Teleport systemd service
import_tasks: service.yml
16 changes: 16 additions & 0 deletions roles/teleport/tasks/service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
- name: Deploy teleport systemd service unit file
template:
src: teleport.service.j2
dest: "{{ teleport_service_file }}"
owner: root
group: root
mode: '0644'
notify:
- Reload systemd
- Restart Teleport

- name: Enable teleport service at boot
systemd:
name: teleport
enabled: yes
1 change: 1 addition & 0 deletions roles/teleport/templates/teleport.crt.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions roles/teleport/templates/teleport.key.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

13 changes: 13 additions & 0 deletions roles/teleport/templates/teleport.service.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=Teleport SSH Service
After=network.target

[Service]
Type=simple
ExecStart=/usr/local/bin/teleport start --config={{ teleport_config_file }}
Restart=on-failure
RestartSec=5s
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target
34 changes: 34 additions & 0 deletions roles/teleport/templates/teleport.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: v3
teleport:
nodename: {{ teleport_nodename }}
data_dir: {{ teleport_data_dir }}
join_params:
token_name: ""
method: token
log:
output: stderr
severity: INFO
format:
output: text
ca_pin: ""
diag_addr: ""

auth_service:
enabled: "yes"
listen_addr: 0.0.0.0:3025
cluster_name: {{ teleport_cluster_name }}
proxy_listener_mode: multiplex

ssh_service:
enabled: "yes"

proxy_service:
enabled: "yes"
web_listen_addr: 0.0.0.0:443
public_addr: {{ teleport_cluster_name }}:443
https_keypairs:
- cert_file: {{ teleport_cert_file }}
key_file: {{ teleport_key_file }}
https_keypairs_reload_interval: 0s
acme:
enabled: "no"
10 changes: 10 additions & 0 deletions roles/teleport/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
teleport_version: "17.5.2"
teleport_email: "[email protected]"
teleport_cluster_name: "teleport.opstree.net"
teleport_nodename: "ldc-opstree"
teleport_data_dir: "/var/lib/teleport"
teleport_cert_file: "/etc/teleport/teleport.crt"
teleport_key_file: "/etc/teleport/teleport.key"
teleport_config_file: "/etc/teleport.yaml"
teleport_service_file: "/etc/systemd/system/teleport.service"
Binary file added static/teleport.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.