Skip to content
Snippets Groups Projects
Commit 7c977136 authored by beierl's avatar beierl
Browse files

SSH improvements for Ansible


Adds the juju private key for ansible in case no passwords are
being used.
Adds a shortened control path in case the model name is too
long.

Change-Id: I0a5027fdaa8e20641d1a3a0841b1ba3554f825fb
Signed-off-by: default avatarbeierl <mbeierl@vmware.com>
parent 0e5f5fe1
No related branches found
No related tags found
No related merge requests found
......@@ -49,7 +49,8 @@ def create_hosts(cfg, hosts):
with open(inventory_path, 'w') as f:
f.write('[{}]\n'.format(hosts))
h1 = '{0} ansible_connection=ssh ansible_ssh_user={1} ansible_ssh_pass={2} ' \
'ansible_python_interpreter=/usr/bin/python3\n'.format(cfg['ssh-hostname'], cfg['ssh-username'],
'ansible_ssh_private_key_file=~/.ssh/id_juju_sshproxy ' \
'ansible_python_interpreter=/usr/bin/python\n'.format(cfg['ssh-hostname'], cfg['ssh-username'],
cfg['ssh-password'])
f.write(h1)
......@@ -63,6 +64,11 @@ def create_ansible_cfg():
# logs playbook execution attempts to the specified path
f.write('log_path = /var/log/ansible.log\n')
f.write('[ssh_connection]\n')
f.write('control_path=%(directory)s/%%h-%%r\n')
f.write('control_path_dir=~/.ansible/cp\n')
# Function to find the playbook path
def find(pattern, path):
result = ''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment