diff options
author | Adam Malinowski <a.malinowsk2@partner.samsung.com> | 2016-06-13 15:07:37 +0200 |
---|---|---|
committer | Adam Malinowski <a.malinowsk2@partner.samsung.com> | 2016-09-27 12:37:45 +0200 |
commit | 7199210e39c05d1131dd5c236a0a20d401a7028b (patch) | |
tree | 8296b2bfc7ee9183dd5a0e4e4783d6d05d20b33b | |
parent | 17e17b624a4ff4f45c997f06d0cb492922637822 (diff) | |
download | host-7199210e39c05d1131dd5c236a0a20d401a7028b.tar.gz host-7199210e39c05d1131dd5c236a0a20d401a7028b.tar.bz2 host-7199210e39c05d1131dd5c236a0a20d401a7028b.zip |
Add setting ssh key on the target machines
This patch adds playbook script for setting ssh keys on the remote
machine in order to execute further ansible commands without password
prompt.
Change-Id: I09fcdd1c6d29d8faf75aca22c2175c21a62b89b0
-rw-r--r-- | config/hosts/README | 27 | ||||
-rw-r--r-- | config/hosts/hosts.sample | 16 | ||||
-rwxr-xr-x | config/hosts/install_key.sh | 2 | ||||
-rw-r--r-- | config/hosts/install_ssh_key.yml | 7 |
4 files changed, 52 insertions, 0 deletions
diff --git a/config/hosts/README b/config/hosts/README new file mode 100644 index 0000000..a306ba2 --- /dev/null +++ b/config/hosts/README @@ -0,0 +1,27 @@ +This folder contains configuration of host machines taking part in Tizen Common +automated laboratory. + +Requirements: +* Ansible - the configuration was tested with version: 2.0.2 +* ssh on the local machine and sshd on the remote one +* a user with passwordless sudo privileges (ansible_user) + +Before doing anything you must set valid ip addresses and ansible user name +in file 'hosts'. +You must provide address of master and runner machine. User is common for both +hosts. Example hosts file might look like this: + +[master] +192.168.69.10 + +[runner] +192.168.69.10 + +[all:vars] +ansible_user=vagrant + +Note that runner and master may be the same machine. + +Next step is to install ssh key in order to be able to run other scripts. +To do that run script named 'installkey.sh'. It will execute ansible playbook +'installsshkey.yml' and you will have to enter password for specified user. diff --git a/config/hosts/hosts.sample b/config/hosts/hosts.sample new file mode 100644 index 0000000..9f71eec --- /dev/null +++ b/config/hosts/hosts.sample @@ -0,0 +1,16 @@ +# This file contains addresses of hosts that are to be configured +# and user used by ansible to perform all actions + +# Replace below examplary addresses with the ones you need + +[runner] +192.168.69.10 + +[master] +192.168.69.10 + +# Replace below ansible_user variable with the one which ansible should use to +# perform actions + +[all:vars] +ansible_user=vagrant diff --git a/config/hosts/install_key.sh b/config/hosts/install_key.sh new file mode 100755 index 0000000..66864bb --- /dev/null +++ b/config/hosts/install_key.sh @@ -0,0 +1,2 @@ +#!/bin/sh +ansible-playbook install_ssh_key.yml --inventory-file=hosts --ask-pass diff --git a/config/hosts/install_ssh_key.yml b/config/hosts/install_ssh_key.yml new file mode 100644 index 0000000..11e8f60 --- /dev/null +++ b/config/hosts/install_ssh_key.yml @@ -0,0 +1,7 @@ +--- +# This playbook installs user's ssh key on the target machine + +- hosts: runner master + + tasks: + - authorized_key: user="{{ ansible_user }}" key="{{ lookup('file', '~/.ssh/id_rsa.pub') }}" |