Skip to content
Snippets Groups Projects
Commit 507a7118 authored by jurgenhaas's avatar jurgenhaas
Browse files

Improve commonauth_extra handling and introduce SSH proxy

parent 6fe04b81
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,7 @@
- name: "Create The /etc/hosts File"
template:
src: 'etc_hosts'
src: 'etc_hosts.jinja2'
dest: '/etc/hosts'
owner: 'root'
group: 'root'
......@@ -17,7 +17,7 @@
- name: "Copy SSH Config For Server-To-Server Communication For Admins"
template:
src: 'ssh_config'
src: 'ssh_config.jinja2'
dest: '/home/{{ item }}/.ssh/config'
owner: '{{ item }}'
group: 'root'
......
......@@ -46,9 +46,9 @@ ff02::2 ip6-allrouters
{% endif %}
{% endfor %}
{% for host in commonauth_extras|default([]) %}
{% for hostname, host in (commonauth_extras|default([])).iteritems() %}
{% if host.ip is defined %}
{{host.ip}}{% for name in host['names'] %} {{name}}{% endfor %}
{% endif %}
{{ host.ip }} {{ hostname }}{% for alias in host.aliases|default([]) %} {{ alias }}{% endfor %}
{% endif %}
{% endfor %}
......@@ -3,16 +3,23 @@
StrictHostKeyChecking no
ForwardAgent no
{% for host in commonauth_extras|default([]) %}
{% if commonauth_extras is defined %}
{% for hostname, host in commonauth_extras.iteritems() %}
{% if host.ssh is defined or host.proxy is defined %}
Host {{ hostname }}{% for alias in host.aliases|default([]) %} {{ alias }}{% endfor %}
{% if host.ssh is defined %}
{% for name in host.names %}
Host {{ name }}
{% for key, value in host.ssh.iteritems() %}
{{ key }} {{ value }}
{% endfor %}
{% endif %}
{% if host.proxy is defined %}
ForwardAgent yes
ProxyCommand /usr/bin/ssh {{ host.proxy }} /bin/nc %h %p
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
Host *
IdentityFile ~/.ssh/id_rsa
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