Last active
January 29, 2024 13:51
-
-
Save danpawlik/fff565078a0c805c2b4836287f5d167a to your computer and use it in GitHub Desktop.
Simply cloud init config to enable tmate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
# user: test password: test | |
users: | |
- default | |
- name: test | |
sudo: ALL=(ALL) NOPASSWD:ALL | |
groups: users, admin | |
ssh_authorized_keys: | |
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOKLl0NYKwoZ/JY5KeZU8VwRAggeOxqQJeoqp3dsAaY9 dpawlik@x1 | |
passwd: $6$IpSPDr7.eOTI2jAO$5Y4oNGAyFRvbwlSo5XLxnVudcktW35FQ77LlFcX7wqCjDwuypW9JVAxCWQJvJgnpS.C6jX.8vN1NvUfp1UZHF0 | |
lock_passwd: false | |
ssh_authorized_keys: | |
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOKLl0NYKwoZ/JY5KeZU8VwRAggeOxqQJeoqp3dsAaY9 dpawlik@x1 | |
password: test | |
chpasswd: { expire: False } | |
write_files: | |
- path: /usr/local/bin/tmate.sh | |
permissions: '0755' | |
content: | | |
#!/bin/bash | |
/usr/bin/tmate -F &> /tmp/tmate.log & | |
- path: /etc/systemd/system/tmate.service | |
content: | | |
[Install] | |
WantedBy=multi-user.target | |
[Unit] | |
Description=Tmate | |
Wants=network-online.target | |
After=network-online.target | |
[Service] | |
User=test | |
Group=test | |
Type=oneshot | |
ExecStart=/usr/local/bin/tmate.sh | |
StandardOutput=file:/tmp/tmate-out.log | |
StandardError=file:/tmp/tmate-err.log | |
runcmd: | |
- [ dnf, install, -y, epel-release ] | |
- [ dnf, install, -y, tmate ] | |
- [ systemctl, daemon-reload ] | |
- [ systemctl, enable, tmate.service ] | |
- [ systemctl, start, tmate.service ] | |
- [ systemctl, status, tmate.service ] | |
- [ journalctl, -u, tmate.service ] | |
- [ systemd-cat, cat, /tmp/tmate.log ] | |
- [ systemd-cat, cat, /tmp/tmate-out.log ] | |
- [ systemd-cat, cat, /tmp/tmate-err.log ] | |
- [ cat, /tmp/tmate.log ] | |
# If the tmate service is not started, login via web console: | |
# openstack console url show <VM NAME> | |
# then run /usr/local/bin/tmate.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment