Skip to content

Commit

Permalink
Add SSH private key and authorized_keys to root user
Browse files Browse the repository at this point in the history
Signed-off-by: Xavi Hernandez <[email protected]>
  • Loading branch information
xhernandez committed Feb 12, 2024
1 parent 397bba1 commit e6f79b5
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions playbooks/ansible/roles/common.prep/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,31 @@

- name: create ansible directory (for ssh key)
file:
path: ansible
path: /root/ansible
state: directory

- name: copy ssh key
copy:
src: insecure_private_ssh_key
dest: ansible/insecure_private_ssh_key
dest: /root/ansible/insecure_private_ssh_key
mode: 0600

- name: Create .ssh directory
file:
path: /root/.ssh
state: directory
mode: 0700

- name: copy ssh config
copy:
src: ssh-config-setup
dest: .ssh/config
dest: /root/.ssh/config

- name: Copy authorized_keys
copy:
src: ~/.ssh/authorized_keys
dest: /root/.ssh/authorized_keys
mode: 0600

- name: Create /etc/hosts
template:
Expand Down

0 comments on commit e6f79b5

Please sign in to comment.