Skip to content
Snippets Groups Projects
Commit 07125dc0 authored by jurgenhaas's avatar jurgenhaas
Browse files

Issue #6 Use IdentitiesOnly and Pipelining only for inithost playbook

parent 43cab7e6
No related branches found
No related tags found
No related merge requests found
......@@ -42,7 +42,7 @@ if args.groups:
if args.ip:
extraVars.append('inithostip=' + args.ip)
cmd = [path + 'ansible-playbook.sh', 'inithost', '--extra-vars=' + ' '.join(extraVars)]
cmd = [path + 'ansible-playbook.py', 'inithost', '--extra-vars=' + ' '.join(extraVars)]
if args.key:
cmd.append('--private-key=' + args.key)
......@@ -52,4 +52,23 @@ else:
for extra in extras:
cmd.append(extra)
def setEnvironment(key, value):
if key in os.environ:
default = os.environ[key]
else:
default = None
if value:
os.environ[key] = value
else:
del os.environ[key]
return default
# Set the ssh arguments so that IdentitiesOnly is being set to true
originalAnsibleSshArgs = setEnvironment('ANSIBLE_SSH_ARGS', '-o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s')
originalAnsibleSshPipelining = setEnvironment('ANSIBLE_SSH_PIPELINING', 'False')
call(cmd)
# reset the ssh arguments
setEnvironment('ANSIBLE_SSH_ARGS', originalAnsibleSshArgs)
setEnvironment('ANSIBLE_SSH_PIPELINING', originalAnsibleSshPipelining)
......@@ -24,7 +24,7 @@ extraVars = ['host=' + args.host]
if args.cloud:
extraVars.append('cloud=' + args.cloud)
cmd = [path + 'ansible-playbook.sh', 'removehost', '--extra-vars=' + ' '.join(extraVars)]
cmd = [path + 'ansible-playbook.py', 'removehost', '--extra-vars=' + ' '.join(extraVars)]
for extra in extras:
cmd.append(extra)
......
......@@ -75,12 +75,6 @@
- option: "scp_if_ssh"
value: "True"
section: "ssh_connection"
- option: "ssh_args"
value: "-o IdentitiesOnly=yes"
section: "ssh_connection"
- option: "pipelining"
value: "False"
section: "ssh_connection"
- name: "Add vault to ansible configuration"
ini_file:
dest: "~/.ansible.cfg"
......
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