Doing su -c 'ssh {{ ssh_peer }}'

22 views
Skip to first unread message

Axel Rau

unread,
Oct 12, 2022, 1:31:26 PM10/12/22
to Ansible Project
Hi all,

This stopped working after some upgrade of ansible:

- - -
- name: Test new ssh connection
command: "su {{ sk_user }} -c 'ssh {{ ssh_peer }} date‘“
- - -

It just hungs in the shell.

How can this be done in 2.13.1?

Any help appreciated,
Axel
---
PGP-Key: CDE74120 ☀ computing @ chaos claudius

Axel Rau

unread,
Oct 12, 2022, 1:49:06 PM10/12/22
to ansible...@googlegroups.com
OS is FreeBSD.

A.

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/1C3B0288-958C-4BC3-B3B2-59BB3DCCFCEF%40Chaos1.DE.

Axel Rau

unread,
Oct 12, 2022, 2:19:35 PM10/12/22
to Ansible Project
If I install sudo, this seems to work:
- - -
shell: sudo -u {{ sk_user }} ssh {{ ssh_peer }} date
- - - 

Axel

Stefan Hornburg (Racke)

unread,
Oct 13, 2022, 3:52:05 AM10/13/22
to ansible...@googlegroups.com, Axel Rau
On 12/10/2022 21:19, Axel Rau wrote:
> If I install sudo, this seems to work:
> - - -
> shell: sudo -u {{ sk_user }} ssh {{ ssh_peer }} date
> - - -
>
Ansible can do the privilege escalation to an arbitrary user as well:

  command: ssh {{ ssh_peer }} date

  become_user: "{{ sympa_unix_user }}"
  vars:
    ansible_ssh_pipelining: true

Regards

          Racke
>> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/8663F1A6-8A70-4DF8-902C-75532D165EC2%40Chaos1.DE <https://groups.google.com/d/msgid/ansible-project/8663F1A6-8A70-4DF8-902C-75532D165EC2%40Chaos1.DE?utm_medium=email&utm_source=footer>.
>
> ---
> PGP-Key: CDE74120  ☀  computing @ chaos claudius
>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/1F508E13-30F7-4376-9A8F-1CDBD7AC8397%40Chaos1.DE <https://groups.google.com/d/msgid/ansible-project/1F508E13-30F7-4376-9A8F-1CDBD7AC8397%40Chaos1.DE?utm_medium=email&utm_source=footer>.


--
Automation expert - Ansible and friends
Linux administrator & Debian maintainer
Perl Dancer & conference hopper

Axel Rau

unread,
Oct 13, 2022, 4:44:29 AM10/13/22
to Stefan Hornburg (Racke), ansible...@googlegroups.com
Looks good. Will try it!

Thanks,
Axel
Reply all
Reply to author
Forward
0 new messages