Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 01104136347 for ; Wed, 16 Jul 2025 18:47:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752691676; cv=none; b=EIdSYxTfSwzUGJn+SDRW7oCQqq0+pzd9gVN+S7cpSZFsZmokKpS9qPrzDyBlfaZL4KV8WOGghPGN4OdrubsJ3UghaMbh6Bj+p4iv5n3CK0BX8aP9LrHC6nTWkfh3pQDRXg5gv0204KJmtcJp9lqoBWCI0+l0tCgWey9UXLtPncA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752691676; c=relaxed/simple; bh=y+Q53Xc6/cFELCygd4uewURfPQ6pxskumV8CrzHyqB0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=a19ndcD3bwHqs2x+Yvna3gcjGcxMMY3FHjkLRCXEcIwjGo4NoNst3prxzMpRICvDR2zC8WB3oD+BSeX+/ccO1tqECXB6O+x/u/QCTtqzyIHzrvr9MlxmJdNlwAMzNztH+L6YDRkqZ6y4bRi5e/S/a5K8Imnqa5F/L3OTIoyFP9g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jU3tSqkC; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jU3tSqkC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 246DAC4CEE7; Wed, 16 Jul 2025 18:47:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1752691674; bh=y+Q53Xc6/cFELCygd4uewURfPQ6pxskumV8CrzHyqB0=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=jU3tSqkC3sBmhTwtz9f72U8zUB5aqn9IUiTc+9FzZ0J0xrtXt5RtWJXSMsnbX7Ssk RolEuv+07ut5HWCUNZY26LLkRSsgVhysK/KejgV4/hQYLbqsF5/zaQZjWS6jYCrsRe 4Zrzi55qxnLJaFgExEcBEczjZDBA9iUonqq7epXIw5nBbcLTUSzXpT2RBAk96EHRV5 l3yY/I7WfZLHtsAn0PfOrCES/P3FCXH6X05V1fqP94ZbtZdd0QY0GFdaY01WvrkhCY TwHzHTbKwPJ1bNiVcFD69n/x7v95DP6R77raxzReOm12XJW2ExS+VFv4sAHzN1luZE QB6TETD5qKh7A== Message-ID: <919d5240-087f-4d80-afc3-95b9050923e1@kernel.org> Date: Wed, 16 Jul 2025 14:47:53 -0400 Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH 2/2] ansible.cfg: Explicitly set the ssh user To: Daniel Gomez , kdevops@lists.linux.dev Cc: Chuck Lever References: <20250716001117.1125930-1-cel@kernel.org> <20250716001117.1125930-2-cel@kernel.org> <4fc27877-1fe6-4860-a4f9-8b4c617dac4c@kernel.org> Content-Language: en-US From: Chuck Lever Organization: kernel.org In-Reply-To: <4fc27877-1fe6-4860-a4f9-8b4c617dac4c@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 7/16/25 2:05 PM, Daniel Gomez wrote: > On 16/07/2025 02.11, Chuck Lever wrote: >> From: Chuck Lever >> >> I've been seeing tasks that are marked "become: true" fail with >> this message: >> >> Timeout (12s): waiting for privilege escalation promt: >> >> This appears to be a common failure mode, but it is due to a broad >> variety of causes. I think I've nailed this one with this addition >> to ansible.cfg. It changes "ESTABLISHING SSH SESSION FOR: NONE" >> to "... FOR: " where is always a user that is allowed >> to use sudo. > > In which cases do we get NONE instead of the user? I see that for all connections to remote (non-controller) hosts. Now, I've also followed a recent recommendation to supercede paramiko with python3-ansible-pylibssh. Could that be the problem? > Looks like we may be > missing something... Perhaps tasks that are marked as become: true but not with > become_method: ansible.builtin.sudo? I saw the privilege escalation failure with tasks that had a become_method: attribute. >> The current Terraform Kconfig menu sets this user, but guestfs does >> not -- the Ansible ssh user for guestfs is always "kdevops". The >> ansible.cfg.j2 file reflects this. > > Does this also affect the controller host user? It does not appear to. Local connections continue to utilize my user (cel). >> Signed-off-by: Chuck Lever >> --- >> playbooks/roles/ansible_cfg/templates/ansible.cfg.j2 | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/playbooks/roles/ansible_cfg/templates/ansible.cfg.j2 b/playbooks/roles/ansible_cfg/templates/ansible.cfg.j2 >> index f71033b2c88f..60525506335c 100644 >> --- a/playbooks/roles/ansible_cfg/templates/ansible.cfg.j2 >> +++ b/playbooks/roles/ansible_cfg/templates/ansible.cfg.j2 >> @@ -11,6 +11,11 @@ show_task_path_on_failure = {{ ansible_cfg_callback_plugin_show_task_path_on_fai >> interpreter_python = {{ ansible_cfg_interpreter_python_string }} >> forks = {{ ansible_cfg_forks }} >> enable_task_debugger = {{ ansible_cfg_task_debugger }} >> +{% if ssh_config_user is defined %} >> +remote_user = {{ ssh_config_user }} >> +{% else %} >> +remote_user = kdevops >> +{% endif %} > > I think it makes sense. But I wonder if we want this to be set in the inventory > file instead of globally here? I'm looking at these 2 links: > > https://docs.ansible.com/ansible/latest/inventory_guide/connection_details.html#setting-a-remote-user > https://docs.ansible.com/ansible/2.9/plugins/connection/ssh.html#ssh-connection I didn't see anything there that suggested setting these in the inventory was any better. I don't have much of a preference, though. >> {% if ansible_facts['distribution'] == 'openSUSE' %} >> [connection] >> retries = {{ ansible_cfg_reconnection_retries }} -- Chuck Lever