Skip to content

Commit 497ab41

Browse files
authored
Merge pull request #9 from juju4/devel-misc
add ssh label, proxy server, template alignment
2 parents 82f2c3e + 9909a7f commit 497ab41

File tree

4 files changed

+72
-23
lines changed

4 files changed

+72
-23
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test.yml

README.md

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ An ansible role to install or update the teleport node service and teleport conf
88

99
Works with any architecture that teleport has a binary for, see available [teleport downloads](https://goteleport.com/teleport/download/).
1010

11-
If you add your own teleport config file template you can run any node services you want (ssh, app, database, kubernetes)
11+
If you add your own teleport config file template you can run any node services you want (ssh, app, database, kubernetes).
12+
13+
Please Check the teleport config file [documentation](https://goteleport.com/docs/reference/config/) for more information and confirm it is setup correctly.
1214

1315
## TODO:
1416
- add idempotence tests to verify teleport is updated correctly (config, service and binary)
@@ -20,7 +22,7 @@ If you add your own teleport config file template you can run any node services
2022

2123
A running teleport cluster so that you can provide the following information:
2224

23-
- auth token (dynamic or static)
25+
- auth token (dynamic or static). Ex: `tctl nodes add --ttl=5m --roles=node | grep "invite token:" | grep -Eo "[0-9a-z]{32}"`
2426
- CA pin
2527
- address of the authentication server
2628

@@ -104,46 +106,66 @@ This role reloads `teleport.service` after any of the following occur:
104106
None
105107

106108
## Example Playbook
107-
For example to install teleport on a raspberry pi:
109+
For example to install teleport on a node:
108110
```
109111
- hosts: all
110112
roles:
111113
- mdsketch.teleport
114+
vars:
115+
# optional ssh labels
116+
teleport_ssh_labels:
117+
- k: "label_key"
118+
v: "label_value"
119+
teleport_auth_token: "super secret auth token"
120+
teleport_ca_pin: "not as secret ca pin"
121+
teleport_auth_servers:
122+
- "1st auth server"
123+
- "2nd auth server"
124+
teleport_proxy_server:
125+
- "proxy server"
112126
```
113127

114-
*Inside `templates/teleport.yaml.j2`*
128+
*Created Teleport Config to `/etc/teleport.yaml`*
115129

116130
```
131+
---
132+
version: v3
117133
teleport:
118-
auth_token: {{ teleport_auth_token }}
119-
ca_pin: {{ teleport_ca_pin }}
134+
auth_token: "super secret auth token"
135+
ca_pin: "not as secret ca pin"
120136
auth_servers:
121-
{% for auth_server in teleport_auth_servers %}
122-
- {{ auth_server }}
123-
{% endfor %}
137+
- "1st auth server"
138+
- "2nd auth server"
139+
proxy_server: ['proxy server']
140+
log:
141+
output: stderr
142+
severity: INFO
143+
format:
144+
output: text
145+
diag_addr: ""
124146
ssh_service:
125147
enabled: "yes"
148+
labels:
149+
label_key: label_value
126150
commands:
151+
- name: hostname
152+
command: [hostname]
153+
period: 60m0s
127154
- name: uptime
128155
command: [uptime, -p]
129156
period: 5m0s
157+
- name: version
158+
command: [teleport, version]
159+
period: 60m0s
130160
proxy_service:
131161
enabled: "no"
162+
https_keypairs: []
163+
https_keypairs_reload_interval: 0s
164+
acme: {}
132165
auth_service:
133166
enabled: "no"
134167
```
135168

136-
*Inside `templates/teleport.yaml.j2`*
137-
138-
```
139-
teleport_auth_token: 1234
140-
teleport_ca_pin: 1234
141-
teleport_auth_servers:
142-
- "https://auth.example.com:443"
143-
teleport_version: "7.3.3"
144-
teleport_architecture: "arm-bin"
145-
```
146-
147169
## License
148170

149171
MIT / BSD

defaults/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ teleport_config_path: "/etc/teleport.yaml"
1212
backup_teleport_config: yes
1313
teleport_config_template: "default_teleport.yaml.j2"
1414
teleport_service_template: "default_teleport.service.j2"
15+
teleport_ssh_labels: []
16+
teleport_proxy_server: ''
1517
teleport_control_systemd: yes
1618
teleport_template_config: yes
1719
# Default dont change

templates/default_teleport.yaml.j2

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,41 @@
1+
---
2+
version: v3
13
teleport:
24
auth_token: "{{ teleport_auth_token }}"
35
ca_pin: "{{ teleport_ca_pin }}"
46
auth_servers:
57
{% for auth_server in teleport_auth_servers %}
68
- "{{ auth_server }}"
79
{% endfor %}
10+
{% if teleport_proxy_server|string %}
11+
proxy_server: {{ teleport_proxy_server }}
12+
{% endif %}
13+
log:
14+
output: stderr
15+
severity: INFO
16+
format:
17+
output: text
18+
diag_addr: ""
819
ssh_service:
920
enabled: "yes"
21+
labels:
22+
{% for ssh_label in teleport_ssh_labels %}
23+
{{ ssh_label.k }}: {{ ssh_label.v }}
24+
{% endfor %}
1025
commands:
11-
- name: uptime
12-
command: [uptime, -p]
13-
period: 5m0s
26+
- name: hostname
27+
command: [hostname]
28+
period: 60m0s
29+
- name: uptime
30+
command: [uptime, -p]
31+
period: 5m0s
32+
- name: version
33+
command: [teleport, version]
34+
period: 60m0s
1435
proxy_service:
1536
enabled: "no"
37+
https_keypairs: []
38+
https_keypairs_reload_interval: 0s
39+
acme: {}
1640
auth_service:
1741
enabled: "no"

0 commit comments

Comments
 (0)