streamlining ssh key process

This commit is contained in:
iRaven 2024-08-17 04:54:10 -05:00
parent 9282147e86
commit 6ace7519c1

View File

@ -18,11 +18,10 @@
# Ansible user SSH pub key # Ansible user SSH pub key
# This is a really stupid way to do it, but alas. # This is a really stupid way to do it, but alas.
# This uses an environment variable named ansiblesvc_key in Semaphore which has the ssh-rsa pubkey. # This uses an environment variable named ansiblesvc_key in Semaphore which has the ssh-rsa pubkey.
- name: Create deployment user .ssh directory. - name: Add deployment user's SSH key.
file: file:
path: /home/ansible/.ssh path: /home/ansible/.ssh
state: directory state: directory
- name: Add deployment user's SSH key.
shell: shell:
cmd: echo "{{ ansiblesvc_key }}" > /home/ansible/.ssh/authorized_keys cmd: echo "{{ ansiblesvc_key }}" > /home/ansible/.ssh/authorized_keys
creates: /home/ansible/.ssh/authorized_keys creates: /home/ansible/.ssh/authorized_keys
@ -63,11 +62,10 @@
# Sysadmin user SSH pub key # Sysadmin user SSH pub key
# This is a really stupid way to do it, but alas. # This is a really stupid way to do it, but alas.
# This uses an environment variable named nhadmin_key in Semaphore which has the ssh-rsa pubkey. # This uses an environment variable named nhadmin_key in Semaphore which has the ssh-rsa pubkey.
- name: Create deployment user .ssh directory. - name: Add nhadmin user's SSH key.
file: file:
path: /home/nhadmin/.ssh path: /home/nhadmin/.ssh
state: directory state: directory
- name: Add nhadmin user's SSH key.
shell: shell:
cmd: echo "{{ nhadmin_key }}" > /home/nhadmin/.ssh/authorized_keys cmd: echo "{{ nhadmin_key }}" > /home/nhadmin/.ssh/authorized_keys
creates: /home/nhadmin/.ssh/authorized_keys creates: /home/nhadmin/.ssh/authorized_keys