Skip to content
Permalink
Browse files

Merge pull request #161 from tiraboschi/remote_sudo

Access the ssh proxy host with the right user
  • Loading branch information
irosenzw committed Mar 31, 2019
2 parents 3ded07c + bdd7ecd commit 09fbe6b5330ece44490f0672f1fa685199210e52
@@ -4,6 +4,11 @@
- name: Fetch the value of HOST_KEY_CHECKING
set_fact: host_key_checking="{{ lookup('config', 'HOST_KEY_CHECKING') }}"
- debug: var=host_key_checking
- name: Get the username running the deploy
become: false
command: whoami
delegate_to: localhost
register: username_on_controller
- name: Register the engine FQDN as a host
add_host:
name: "{{ he_fqdn }}"
@@ -13,7 +18,7 @@
-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null {% if he_ansible_host_name != "localhost" %}
-o ProxyCommand="ssh -W %h:%p -q
{% if not host_key_checking %} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null {% endif %}
root@{{ he_ansible_host_name }}" {% endif %}
{{ username_on_controller.stdout }}@{{ he_ansible_host_name }}" {% endif %}
ansible_ssh_pass: "{{ he_appliance_password }}"
ansible_user: root
no_log: true
@@ -4,6 +4,11 @@
- name: Fetch the value of HOST_KEY_CHECKING
set_fact: host_key_checking="{{ lookup('config', 'HOST_KEY_CHECKING') }}"
- debug: var=host_key_checking
- name: Get the username running the deploy
become: false
command: whoami
delegate_to: localhost
register: username_on_controller
- name: Register the engine FQDN as a host
add_host:
name: "{{ he_fqdn }}"
@@ -13,7 +18,7 @@
-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null {% if he_ansible_host_name != "localhost" %}
-o ProxyCommand="ssh -W %h:%p -q
{% if not host_key_checking %} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null {% endif %}
root@{{ he_ansible_host_name }}" {% endif %}
{{ username_on_controller.stdout }}@{{ he_ansible_host_name }}" {% endif %}
ansible_ssh_pass: "{{ he_appliance_password }}"
ansible_user: root
no_log: true

0 comments on commit 09fbe6b

Please sign in to comment.
You can’t perform that action at this time.