add ssh key
This commit is contained in:
7
glusterfs/ansible/files/ansible_key
Normal file
7
glusterfs/ansible/files/ansible_key
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
-----BEGIN OPENSSH PRIVATE KEY-----
|
||||||
|
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
|
||||||
|
QyNTUxOQAAACCn14U5lXczU3gyBa7x7m1RRgVOHHphBwDQTxvFiZrd9AAAAJikswD/pLMA
|
||||||
|
/wAAAAtzc2gtZWQyNTUxOQAAACCn14U5lXczU3gyBa7x7m1RRgVOHHphBwDQTxvFiZrd9A
|
||||||
|
AAAECqUlHZcmQAUp9+iZH509A3euZ6fL0MME4CC3U91H2EK6fXhTmVdzNTeDIFrvHubVFG
|
||||||
|
BU4cemEHANBPG8WJmt30AAAAEWR1bW15QGV4YW1wbGUuY29tAQIDBA==
|
||||||
|
-----END OPENSSH PRIVATE KEY-----
|
||||||
1
glusterfs/ansible/files/ansible_key.pub
Normal file
1
glusterfs/ansible/files/ansible_key.pub
Normal file
@@ -0,0 +1 @@
|
|||||||
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKfXhTmVdzNTeDIFrvHubVFGBU4cemEHANBPG8WJmt30 dummy@example.com
|
||||||
@@ -1,6 +1,15 @@
|
|||||||
---
|
---
|
||||||
|
- name: deploy key
|
||||||
|
hosts: bastion
|
||||||
|
gather_facts: false
|
||||||
|
tasks:
|
||||||
|
- name: Set authorized key taken from file
|
||||||
|
ansible.posix.authorized_key:
|
||||||
|
user: clusteruser
|
||||||
|
state: present
|
||||||
|
key: "{{ lookup('file', './files/ansible_key.pub') }}"
|
||||||
|
|
||||||
- hosts: bastion
|
- hosts: test_server
|
||||||
gather_facts: true
|
gather_facts: true
|
||||||
become: false
|
become: false
|
||||||
|
|
||||||
|
|||||||
@@ -16,4 +16,4 @@ ansible_user=clusteruser
|
|||||||
ansible_ssh_pass=password
|
ansible_ssh_pass=password
|
||||||
|
|
||||||
[test_server:vars]
|
[test_server:vars]
|
||||||
ansible_ssh_common_args='-o ProxyCommand="ssh -W %h:%p -q clusteruser@${bastion.default_ipv4_address}"'
|
ansible_ssh_common_args='-o ProxyCommand="ssh -i ./ansible/files/ansible_key -W %h:%p -q clusteruser@${bastion.default_ipv4_address}"'
|
||||||
Reference in New Issue
Block a user