forked from usmqe/usmqe-setup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqe_server_sshkey.yml
37 lines (34 loc) · 1.02 KB
/
qe_server_sshkey.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
---
#
# This playbook deploy various ssh keys to various locations:
# * local public key to qe_server for usmqe user
# * public key from usmqe user on qe_server generated by qe_server_jenkins.yml
# role qe-server to all testing nodes
#
- name: Deploy ssh public keys for usmqe user account on qe_server
hosts: qe_server
user: root
tasks:
- name: Deploy public ssh key
authorized_key:
exclusive=no
user=usmqe
state=present
key="{{ item }}"
with_items:
- "{{ lookup('file', lookup('env', 'HOME') + '/.ssh/id_rsa.pub') }}"
- name: Get public key from qe_server (from user usmqe).
command: cat /home/usmqe/.ssh/id_rsa.pub
register: usmqe_ssh_key
- name: Deploy ssh public key of usmqe user to test machines
hosts: usm_server:usm_nodes:usm_client
user: root
vars:
ssh_key: "{{ hostvars[groups['qe_server'][0]].usmqe_ssh_key.stdout }}"
tasks:
- name: Deploy public ssh key
authorized_key:
exclusive=no
user=root
state=present
key="{{ ssh_key }}"