Skip to content

Commit 52820a7

Browse files
GrayHoangpre-commit-ci-lite[bot]williamckha
authored
Let ansible copy existing ssh key over to robot (UBC-Thunderbots#3490)
* changes * Willima nit * new task for copying ssh key * add task to relevant files * [pre-commit.ci lite] apply automatic fixes * Renaming stuff * Renaming stuff * bugfix for precommit --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Co-authored-by: williamckha <williamha@outlook.com>
1 parent bc5e720 commit 52820a7

5 files changed

Lines changed: 29 additions & 0 deletions

File tree

src/software/embedded/ansible/playbooks/deploy_powerboard.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
hosts: THUNDERBOTS_HOSTS
44

55
tasks:
6+
- name: Copy SSH public key
7+
ansible.builtin.import_tasks: ../tasks/copy_ssh_key.yml
8+
69
- name: Sync powerboard files
710
become: true
811
become_method: ansible.builtin.sudo

src/software/embedded/ansible/playbooks/deploy_robot_software.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
robot_diagnostics_cli_tar: ../../robot_diagnostics_cli/robot_diagnostics_cli_tar.tar.gz
1515

1616
tasks:
17+
- name: Copy SSH public key
18+
ansible.builtin.import_tasks: ../tasks/copy_ssh_key.yml
19+
1720
- name: Log Robot ID
1821
ansible.builtin.debug:
1922
msg: "[Robot ID = {{ inventory_hostname }}]"

src/software/embedded/ansible/playbooks/setup_nano.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
hosts: THUNDERBOTS_HOSTS
44

55
tasks:
6+
- name: Copy SSH public key
7+
ansible.builtin.import_tasks: ../tasks/copy_ssh_key.yml
68
- name: Check internet connection
79
tags: dependencies
810
ansible.builtin.import_tasks: ../tasks/check_internet.yml

src/software/embedded/ansible/playbooks/setup_pi.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
hosts: THUNDERBOTS_HOSTS
44

55
tasks:
6+
- name: Copy SSH public key
7+
ansible.builtin.import_tasks: ../tasks/copy_ssh_key.yml
8+
69
- name: Check internet connection
710
tags: dependencies
811
ansible.builtin.import_tasks:
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
- name: Copy SSH public key
3+
block:
4+
- name: Find SSH public key
5+
ansible.builtin.stat:
6+
path: ~/.ssh/id_ed25519.pub
7+
register: ssh_key_file
8+
9+
- name: Tell user to make key
10+
ansible.builtin.debug:
11+
msg: "Please create an ed25519 SSH key using ssh-keygen"
12+
when: not ssh_key_file.stat
13+
14+
- name: Copy SSH public key to robot
15+
ansible.posix.authorized_key:
16+
user: robot
17+
key: "{{ lookup('file', '~/.ssh/id_ed25519.pub') }}"
18+
when: ssh_key_file.stat

0 commit comments

Comments
 (0)