Don't break root ssh with authorized_keys copy
For multinode testing we copy content into authorized_keys. Previously we blew away any old content which meant that if you use eg root to ssh to the host then you will no longer be able to do so. Address that by appending to any existing content in authorized_keys files. Change-Id: I163637d7cc7002b63d6d43eabfa573a56c916d36
This commit is contained in:
parent
53db8c8d18
commit
38cb21faa9
|
@ -80,8 +80,10 @@ function setup_ssh {
|
|||
local dest_file=${2:-id_rsa}
|
||||
$ANSIBLE all --sudo -f 5 -i "$WORKSPACE/inventory" -m file \
|
||||
-a "path='$path' mode=0700 state=directory"
|
||||
$ANSIBLE all --sudo -f 5 -i "$WORKSPACE/inventory" -m copy \
|
||||
-a "src=/etc/nodepool/id_rsa.pub dest='$path/authorized_keys' mode=0600"
|
||||
# Note that we append to the authorized keys file just in case something
|
||||
# is already authorized to ssh with content in that file.
|
||||
$ANSIBLE all --sudo -f 5 -i "$WORKSPACE/inventory" -m lineinfile \
|
||||
-a "line={{ lookup('file', '/etc/nodepool/id_rsa.pub') }} dest='$path/authorized_keys' insertafter=EOF create=yes mode=0600"
|
||||
$ANSIBLE all --sudo -f 5 -i "$WORKSPACE/inventory" -m copy \
|
||||
-a "src=/etc/nodepool/id_rsa.pub dest='$path/${dest_file}.pub' mode=0600"
|
||||
$ANSIBLE all --sudo -f 5 -i "$WORKSPACE/inventory" -m copy \
|
||||
|
|
Loading…
Reference in New Issue