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_ssh_private_key_file=~/.ssh/id_juju_sshproxy ' \
'ansible_python_interpreter=/usr/bin/python3\n'.format(cfg['ssh-hostname'], cfg['ssh-username'],
cfg['ssh-password'])
f.write(h1)
with open(ansible_config_path, 'w') as f:
f.write('[defaults]\n')
f.write('host_key_checking = False\n')
+ # 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