Skip to content

Instantly share code, notes, and snippets.

@bh7cw
Last active September 5, 2020 01:03
Show Gist options
  • Save bh7cw/7aeb01c408df93f904a24ee1862a074f to your computer and use it in GitHub Desktop.
Save bh7cw/7aeb01c408df93f904a24ee1862a074f to your computer and use it in GitHub Desktop.
Refer to https://github.com/coreos/afterburn/pull/481#issuecomment-675054667
sudo systemctl start afterburn-sshkeys@test.service
sudo systemctl start afterburn-sshkeys@jing.service
[core@ip-172-31-13-182 system]$ systemctl list-dependencies afterburn-sshkeys.target
afterburn-sshkeys.target
● └─afterburn-sshkeys@core.service
--------------------------------------
Different from test before, which shows all the instances, not just core
--------------------------------------
sudo systemctl start afterburn-sshkeys.target
[core@ip-172-31-13-182 system]$ sudo journalctl -u 'afterburn-sshkeys@*.service'
Sep 04 22:47:57 ip-172-31-13-182 systemd[1]: Starting Afterburn (SSH Keys)...
Sep 04 22:47:57 ip-172-31-13-182 afterburn[1470]: Sep 04 22:47:57.068 INFO Putting http://169.254.169.254/latest/api/token: Attempt #1
Sep 04 22:47:57 ip-172-31-13-182 afterburn[1470]: Sep 04 22:47:57.124 INFO Fetching http://169.254.169.254/2019-10-01/meta-data/public-keys: Attempt >
Sep 04 22:47:57 ip-172-31-13-182 afterburn[1470]: Sep 04 22:47:57.125 INFO Fetch successful
Sep 04 22:47:57 ip-172-31-13-182 afterburn[1470]: Sep 04 22:47:57.125 INFO Fetching http://169.254.169.254/2019-10-01/meta-data/public-keys/0/openssh>
Sep 04 22:47:57 ip-172-31-13-182 afterburn[1470]: Sep 04 22:47:57.127 INFO Fetch successful
Sep 04 22:47:57 ip-172-31-13-182 afterburn[1470]: wrote ssh authorized keys file for user: core
Sep 04 22:47:57 ip-172-31-13-182 systemd[1]: afterburn-sshkeys@core.service: Succeeded.
Sep 04 22:47:57 ip-172-31-13-182 systemd[1]: Finished Afterburn (SSH Keys).
Sep 04 22:52:30 ip-172-31-13-182 systemd[1]: Starting Afterburn (SSH Keys)...
Sep 04 22:52:30 ip-172-31-13-182 afterburn[1495]: Sep 04 22:52:30.314 INFO Putting http://169.254.169.254/latest/api/token: Attempt #1
Sep 04 22:52:30 ip-172-31-13-182 afterburn[1495]: Sep 04 22:52:30.380 INFO Fetching http://169.254.169.254/2019-10-01/meta-data/public-keys: Attempt >
Sep 04 22:52:30 ip-172-31-13-182 afterburn[1495]: Sep 04 22:52:30.382 INFO Fetch successful
Sep 04 22:52:30 ip-172-31-13-182 afterburn[1495]: Sep 04 22:52:30.382 INFO Fetching http://169.254.169.254/2019-10-01/meta-data/public-keys/0/openssh>
Sep 04 22:52:30 ip-172-31-13-182 afterburn[1495]: Sep 04 22:52:30.384 INFO Fetch successful
Sep 04 22:52:30 ip-172-31-13-182 afterburn[1495]: wrote ssh authorized keys file for user: core
Sep 04 22:52:30 ip-172-31-13-182 systemd[1]: afterburn-sshkeys@core.service: Succeeded.
Sep 04 22:52:30 ip-172-31-13-182 systemd[1]: Finished Afterburn (SSH Keys).
--------------------------------------
Different from test before, which shows all the instances at the same time, not just core
--------------------------------------
Also, the following shows not all the instances are updated at the same time.
[core@ip-172-31-13-182 system]$ sudo systemctl status afterburn-sshkeys@test.service afterburn-sshkeys@core.service afterburn-sshkeys@jing.service
● afterburn-sshkeys@test.service - Afterburn (SSH Keys)
Loaded: loaded (/usr/lib/systemd/system/afterburn-sshkeys@.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Sep 04 22:39:57 ip-172-31-13-182 systemd[1]: Finished Afterburn (SSH Keys).
Sep 04 22:41:44 ip-172-31-13-182 systemd[1]: Starting Afterburn (SSH Keys)...
Sep 04 22:41:45 ip-172-31-13-182 afterburn[1380]: Sep 04 22:41:45.027 INFO Putting http://169.254.169.254/latest/api/token: Attempt #1
Sep 04 22:41:45 ip-172-31-13-182 afterburn[1380]: Sep 04 22:41:45.032 INFO Fetching http://169.254.169.254/2019-10-01/meta-data/public-keys: Attempt >
Sep 04 22:41:45 ip-172-31-13-182 afterburn[1380]: Sep 04 22:41:45.033 INFO Fetch successful
Sep 04 22:41:45 ip-172-31-13-182 afterburn[1380]: Sep 04 22:41:45.034 INFO Fetching http://169.254.169.254/2019-10-01/meta-data/public-keys/0/openssh>
Sep 04 22:41:45 ip-172-31-13-182 afterburn[1380]: Sep 04 22:41:45.035 INFO Fetch successful
Sep 04 22:41:45 ip-172-31-13-182 afterburn[1380]: wrote ssh authorized keys file for user: test
Sep 04 22:41:45 ip-172-31-13-182 systemd[1]: afterburn-sshkeys@test.service: Succeeded.
Sep 04 22:41:45 ip-172-31-13-182 systemd[1]: Finished Afterburn (SSH Keys).
● afterburn-sshkeys@core.service - Afterburn (SSH Keys)
Loaded: loaded (/usr/lib/systemd/system/afterburn-sshkeys@.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Fri 2020-09-04 22:52:30 UTC; 35s ago
Process: 1495 ExecStart=/usr/bin/afterburn ${AFTERBURN_OPT_PROVIDER} --ssh-keys=core (code=exited, status=0/SUCCESS)
Main PID: 1495 (code=exited, status=0/SUCCESS)
Sep 04 22:52:30 ip-172-31-13-182 systemd[1]: Starting Afterburn (SSH Keys)...
Sep 04 22:52:30 ip-172-31-13-182 afterburn[1495]: Sep 04 22:52:30.314 INFO Putting http://169.254.169.254/latest/api/token: Attempt #1
Sep 04 22:52:30 ip-172-31-13-182 afterburn[1495]: Sep 04 22:52:30.380 INFO Fetching http://169.254.169.254/2019-10-01/meta-data/public-keys: Attempt >
Sep 04 22:52:30 ip-172-31-13-182 afterburn[1495]: Sep 04 22:52:30.382 INFO Fetch successful
Sep 04 22:52:30 ip-172-31-13-182 afterburn[1495]: Sep 04 22:52:30.382 INFO Fetching http://169.254.169.254/2019-10-01/meta-data/public-keys/0/openssh>
Sep 04 22:52:30 ip-172-31-13-182 afterburn[1495]: Sep 04 22:52:30.384 INFO Fetch successful
Sep 04 22:52:30 ip-172-31-13-182 afterburn[1495]: wrote ssh authorized keys file for user: core
Sep 04 22:52:30 ip-172-31-13-182 systemd[1]: afterburn-sshkeys@core.service: Succeeded.
Sep 04 22:52:30 ip-172-31-13-182 systemd[1]: Finished Afterburn (SSH Keys).
● afterburn-sshkeys@jing.service - Afterburn (SSH Keys)
Loaded: loaded (/usr/lib/systemd/system/afterburn-sshkeys@.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2020-09-04 22:41:45 UTC; 11min ago
Process: 1386 ExecStart=/usr/bin/afterburn ${AFTERBURN_OPT_PROVIDER} --ssh-keys=jing (code=exited, status=1/FAILURE)
Main PID: 1386 (code=exited, status=1/FAILURE)
Sep 04 22:41:45 ip-172-31-13-182 afterburn[1386]: Sep 04 22:41:45.099 INFO Fetching http://169.254.169.254/2019-10-01/meta-data/public-keys: Attempt >
Sep 04 22:41:45 ip-172-31-13-182 afterburn[1386]: Sep 04 22:41:45.124 INFO Fetch successful
Sep 04 22:41:45 ip-172-31-13-182 afterburn[1386]: Sep 04 22:41:45.124 INFO Fetching http://169.254.169.254/2019-10-01/meta-data/public-keys/0/openssh>
Sep 04 22:41:45 ip-172-31-13-182 afterburn[1386]: Sep 04 22:41:45.147 INFO Fetch successful
Sep 04 22:41:45 ip-172-31-13-182 afterburn[1386]: Error: failed to run
Sep 04 22:41:45 ip-172-31-13-182 afterburn[1386]: Caused by: writing ssh keys
Sep 04 22:41:45 ip-172-31-13-182 afterburn[1386]: Caused by: could not find user with username "jing"
Sep 04 22:41:45 ip-172-31-13-182 systemd[1]: afterburn-sshkeys@jing.service: Main process exited, code=exited, status=1/FAILURE
Sep 04 22:41:45 ip-172-31-13-182 systemd[1]: afterburn-sshkeys@jing.service: Failed with result 'exit-code'.
Sep 04 22:41:45 ip-172-31-13-182 systemd[1]: Failed to start Afterburn (SSH Keys).
@bh7cw
Copy link
Author

bh7cw commented Sep 5, 2020

sudo systemctl start afterburn-sshkeys@test.service doesn't work.
sudo systemctl enable afterburn-sshkeys@test.service works.
Needs to further test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment